Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async refreshUI() {
const appCenterEnabled = await AppCenter.isEnabled();
this.setState({ appCenterEnabled });
const authEnabled = await Auth.isEnabled();
this.setState({ authEnabled });
const pushEnabled = await Push.isEnabled();
this.setState({ pushEnabled });
const installId = await AppCenter.getInstallId();
this.setState({ installId });
}
async componentDidMount() {
const component = this;
const appCenterEnabled = await AppCenter.isEnabled();
component.setState({ appCenterEnabled });
const installId = await AppCenter.getInstallId();
component.setState({ installId });
const logLevel = await AppCenter.getLogLevel();
component.setState({ logLevel });
}
_setPushToken = async notifyTypes => {
const { isLoggedIn, otherAccounts = [] } = this.props;
if (isLoggedIn) {
const token = await AppCenter.getInstallId();
getExistUser().then(isExistUser => {
if (isExistUser) {
otherAccounts.forEach(item => {
const { isNotificationSettingsOpen } = this.props;
const data = {
username: item.username,
token,
system: Platform.OS,
allows_notify: Number(isNotificationSettingsOpen),
notify_types: notifyTypes,
};
setPushToken(data);
});
}
async refreshUI() {
const appCenterEnabled = await AppCenter.isEnabled();
this.setState({ appCenterEnabled });
const authEnabled = await Auth.isEnabled();
this.setState({ authEnabled });
const pushEnabled = await Push.isEnabled();
this.setState({ pushEnabled });
const installId = await AppCenter.getInstallId();
this.setState({ installId });
}
_setPushToken = async username => {
const { notificationSettings, notificationDetails } = this.props;
const notifyTypesConst = {
vote: 1,
mention: 2,
follow: 3,
comment: 4,
reblog: 5,
transfers: 6,
};
const notifyTypes = [];
const token = await AppCenter.getInstallId();
Object.keys(notificationDetails).map(item => {
const notificationType = item.replace('Notification', '');
if (notificationDetails[item]) {
notifyTypes.push(notifyTypesConst[notificationType]);
}
});
const data = {
username,
token,
system: Platform.OS,
allows_notify: Number(notificationSettings),
notify_types: notifyTypes,
};
async componentDidMount() {
const component = this;
const appCenterEnabled = await AppCenter.isEnabled();
component.setState({ appCenterEnabled });
const installId = await AppCenter.getInstallId();
component.setState({ installId });
const logLevel = await AppCenter.getLogLevel();
component.setState({ logLevel });
}
async componentDidMount() {
const component = this;
const appCenterEnabled = await AppCenter.isEnabled();
component.setState({ appCenterEnabled });
const installId = await AppCenter.getInstallId();
component.setState({ installId });
const logLevel = await AppCenter.getLogLevel();
component.setState({ logLevel });
}
_enableNotification = async (username, isEnable) => {
const token = await AppCenter.getInstallId();
setPushToken({
username,
token,
system: Platform.OS,
allows_notify: Number(isEnable),
notify_types: [1, 2, 3, 4, 5, 6],
});
};