1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-03-20 20:55:18 +02:00

Android: Fixed cancelling of notification

This commit is contained in:
Laurent Cozic 2017-11-28 19:49:03 +00:00
parent 67a457b9c5
commit 1a610054d3

View File

@ -11,14 +11,19 @@ class AlarmServiceDriver {
}
async clearNotification(id) {
PushNotification.cancelLocalNotifications({ id: id });
PushNotification.cancelLocalNotifications({ id: id + '' });
}
async scheduleNotification(notification) {
// Arguments must be set in a certain way and certain format otherwise it cannot be
// cancelled later on. See:
// https://github.com/zo0r/react-native-push-notification/issues/570#issuecomment-337642922
const androidNotification = {
id: notification.id,
message: notification.title, // No idea what the limits are for title and body but set something reasonable anyway
id: notification.id + '',
message: notification.title,
date: notification.date,
userInfo: { id: notification.id + '' },
number: 0,
};
if ('body' in notification) androidNotification.body = notification.body;