Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
identifier: 'SNOOZE_ACTION',
}, (action, completed) => {
this.dispatch(snoozeAlarm(action.notification.getData().alarmUUID));
completed();
});
this.stopAction = new NotificationAction({
activationMode: 'background',
title: 'Stop',
identifier: 'STOP_ACTION',
}, (action, completed) => {
this.dispatch(stopAlarm(action.notification.getData().alarmUUID));
completed();
});
this.alarmActions = new NotificationCategory({
identifier: 'ALARM',
actions: [this.snoozeAction, this.stopAction],
context: 'default',
});
this.requestPermissions().then(() => {
this.checkStatus().catch(() => {
this.checkStatus();
});
});
// consume actions
NotificationsIOS.consumeBackgroundQueue();
// consume notifications
PushNotificationIOS.getInitialNotification(0).then((notification) => {
if (notification !== null) {
this.deviceToken = null;
NotificationsIOS.addEventListener('remoteNotificationsRegistered', (deviceToken) => {
this.deviceToken = deviceToken;
});
NotificationsIOS.addEventListener('notificationOpened', (notification, completion) => {
const { background } = reduxStore.getState().app;
if (background) {
this.onNotification(notification);
}
completion();
});
const actions = [];
actions.push(new NotificationCategory({
identifier: 'MESSAGE',
actions: [replyAction]
}));
NotificationsIOS.requestPermissions(actions);
}