1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-12 08:54:00 +02:00
joplin/ReactNativeClient/lib/services/AlarmServiceDriver.android.js

31 lines
778 B
JavaScript
Raw Normal View History

const PushNotification = require('react-native-push-notification');
class AlarmServiceDriver {
hasPersistentNotifications() {
return true;
}
notificationIsSet(alarmId) {
throw new Error('Available only for non-persistent alarms');
}
async clearNotification(id) {
PushNotification.cancelLocalNotifications({ id: id });
}
async scheduleNotification(notification) {
const androidNotification = {
id: notification.id,
2017-11-28 20:58:04 +02:00
message: notification.title, // No idea what the limits are for title and body but set something reasonable anyway
date: notification.date,
};
2017-11-28 20:58:04 +02:00
if ('body' in notification) androidNotification.body = notification.body;
PushNotification.localNotificationSchedule(androidNotification);
}
}
module.exports = AlarmServiceDriver;