Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
const status = await checkPermission();
if (status !== "granted") {
return;
}
const notificationId = await createNotification(event);
await AsyncStorage.setItem(id, notificationId);
// await CalendarManager.toggleEvent(event, true);
syncReminder(id, true);
return true;
} catch (error) {
Alert.alert("Error", error.message);
return;
}
}
const { ipAddress, channel } = getState().main.connectQrData;
const socket = io.connect(`http://${ipAddress}`);
socket.emit('join', channel);
console.log(`Joined channel: ${channel}`);
socket.on('signals', () => {
console.log('signals');
dispatch(fetchData());
});
return socket;
} catch (err) {
Alert.alert(err.message || 'Error', err.stack);
}
};
cbFail: () => {
dispatch(actions.processingTask(''));
let {location, network} = getState();
let errors = [];
if (network.isConnected === undefined) {
errors.push('获取网络状态失败。');
}
if (!location.position) {
errors.push('获取位置失败。');
}
if (errors.length > 0) {
Alert.alert(
'检测网络和位置出错',
errors.join(''),
[
{text: '重试', onPress: () => dispatch(bootstrap({navigator}))},
],
);
} else if (!network.isConnected) {
Alert.alert(
'网络不可用',
'请打开WIFI或移动网络后重试。',
[
{text: '重试', onPress: () => {
dispatch(bootstrap({navigator}));
}},
],
);
_showURLAlert() {
const { t } = this.props;
Alert.alert(
t('settingsView.alertTitle'),
t('settingsView.alertURLText'),
[
{
onPress: () => this._urlField.focus(),
text: t('settingsView.alertOk')
}
]
);
}
removeFriend = (currentEmail, friendEmail, title) => {
this.props.loaderToggle();
Alert.alert(title, `Are you sure you want remove this ${title.toLowerCase()}?`, [
{
text: 'Yes',
onPress: () =>
deleteFriend(currentEmail, friendEmail).then(user => {
this.props.loaderToggle();
this.props.getFriendList(this.props.choice);
Toast.show(`${title} Removed`);
})
},
{
text: 'No',
onPress: null
}
]);
};
function logout({ dispatch, scrollTo }) {
Alert.alert("Logout", "Are you sure?", [
{
text: "Cancel",
style: "cancel"
},
{
text: "OK",
onPress: () => {
dispatch(User.logout());
scrollTo({ page: 0 });
}
}
]);
}
componentDidUpdate(prevProps) {
if (prevProps.fetching && !this.props.fetching) {
if (this.props.error) {
Alert.alert('Error', this.props.error, [{ text: 'OK' }])
} else {
Alert.alert('Success', 'Password reset email sent', [{ text: 'OK' }])
Navigation.popToRoot(this.props.componentId)
}
}
}
promptForLocationPermission(message, confirmationMessage, onConfirmation) {
const confirmOption = { text: confirmationMessage, onPress: onConfirmation };
const cancelOption = { text: I18n.t(ext('cancelLocationPermissions')) };
const alertOptions = [confirmOption, cancelOption];
Alert.alert(
I18n.t(ext('locationPermissionsPrompt')),
message,
alertOptions,
);
}
}
.then((update) => {
if (update) {
Alert.alert(
'Update Available',
`Version ${update.appVersion} (${(update.packageSize / 1024 / 1024).toFixed(2)}mb) is available for download`,
[
{ text: 'Cancel', style: 'cancel' },
{ text: 'Install & Restart', onPress: this.installUpdate },
],
{ cancelable: false },
);
} else {
Alert.alert('No updates available.');
}
});
}
const onDeleteAlert = ({ id }: ItemProps) => {
Alert.alert(
'削除しますか?',
'',
[
{
text: 'キャンセル',
style: 'cancel',
},
{
text: '削除する',
onPress: () => {
onDelete(id);
},
},
],
{ cancelable: false }
);