Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
}
if (status !== 'authorized') {
if (status === 'restricted') {
OkAlert('Cannot Access Calendar', 'Could not access calendar.');
return false;
} else if (status === 'denied') {
try {
// TODO(localization)
await OkCancelAlert(
'Cannot Access Calendar',
'Please open Settings to allow Calendar permissions.'
);
if (await Permissions.canOpenSettings()) {
Permissions.openSettings();
}
} catch (err) {
console.log('Canceled: Add to Calendar Permissions');
}
}
return false;
}
const { start, end } = getStartEndTime(event);
try {
CalendarEventsIOS.saveEvent(event.name, {
location: event.venue.fullAddress(),
notes: getDescription(event),
startDate: start.toISOString(),
endDate: end.toISOString(),
this.setState({ watchAppState: true }, () => {
RNPermissions.openSettings();
});
}}
onClick: () => {
Permissions.openSettings()
NavStore.popupCustom.hide()
}
}
onPress: () => Permissions.openSettings(),
};
onPress: () => Permissions.openSettings(),
};
onNotificationSwitch = () => {
Platform.OS === 'ios' ? Permissions.openSettings() : Linking.openURL('settings://notification/golden')
}
async onOpenSettings() {
if (!await this.checkPermissionsAndNavigateAsync()) {
Permissions.openSettings();
}
}
onClick: () => {
Permissions.openSettings()
NavStore.popupCustom.hide()
}
}
Permissions.canOpenSettings().then(canIt => {
if (canIt) {
return Permissions.openSettings();
}
Alert.alert(
'Not supported',
'openSettings is currently not supported on this platform',
);
});
onPress: () => Permissions.openSettings(),
};