Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(function() {
// Register all the valid actions for notifications here and add the action handler for each action
PushNotification.registerNotificationActions([ i18n.t('notificationAction') ])
DeviceEventEmitter.addListener('notificationActionReceived', (action) => {
console.log ('Notification action received: ' + action)
const info = JSON.parse(action.dataJSON)
if (info.action == i18n.t('notificationAction')) {
if (Platform.OS === 'android') BackHandler.exitApp()
else RNExitApp.exitApp()
}
})
})()
});
PushNotification.unregister();
PushNotification.localNotification = (details) => {};
PushNotification.localNotificationSchedule = (details) => {};
PushNotification.requestPermissions();
PushNotification.presentLocalNotification = (details) => {};
PushNotification.scheduleLocalNotification = (details) => {};
PushNotification.cancelLocalNotifications = (details) => {};
PushNotification.cancelAllLocalNotifications();
PushNotification.setApplicationIconBadgeNumber(1);
PushNotification.getApplicationIconBadgeNumber((badgeCount) => {});
PushNotification.popInitialNotification((notification) => {});
PushNotification.checkPermissions((checkPermissions) => {});
PushNotification.abandonPermissions();
PushNotification.registerNotificationActions(['Accept', 'Reject', 'Yes', 'No']);
PushNotification.clearAllNotifications();
if (notification.action === 'Stop') {
store.dispatch(stopAlarm(notification.alarmUUID));
} else if (notification.action === 'Snooze') {
store.dispatch(snoozeAlarm(notification.alarmUUID));
}
} else {
store.dispatch(soundAlarm(notification.alarmUUID));
}
},
popInitialNotification: true,
requestPermissions: true,
});
PushNotification.registerNotificationActions(['Snooze', 'Stop']);
this.checkStatus();
}