mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Android: Fixes #1062: Don t display Play Service alert when Play Service unavailable
This commit is contained in:
parent
12efc02d91
commit
59402cf198
@ -1,8 +1,14 @@
|
||||
// Note: currently, if Play Services aren't available, notifications will not work at all
|
||||
// There won't be any warning or error message.
|
||||
|
||||
import firebase from 'react-native-firebase';
|
||||
|
||||
class AlarmServiceDriver {
|
||||
|
||||
constructor() {
|
||||
this.playServiceAvailable_ = firebase.utils().playServicesAvailability.isAvailable;
|
||||
if (!this.playServiceAvailable_) return;
|
||||
|
||||
this.channel_ = new firebase.notifications.Android.Channel('net.cozic.joplin.notification', 'Joplin Alarm',firebase.notifications.Android.Importance.Max)
|
||||
.setDescription('Displays a notification for alarms associated with to-dos.');
|
||||
firebase.notifications().android.createChannel(this.channel_);
|
||||
@ -21,10 +27,14 @@ class AlarmServiceDriver {
|
||||
}
|
||||
|
||||
async clearNotification(id) {
|
||||
if (!this.playServiceAvailable_) return;
|
||||
|
||||
return firebase.notifications().cancelNotification(this.firebaseNotificationId_(id))
|
||||
}
|
||||
|
||||
async scheduleNotification(notification) {
|
||||
if (!this.playServiceAvailable_) return;
|
||||
|
||||
const firebaseNotification = new firebase.notifications.Notification()
|
||||
firebaseNotification.setNotificationId(this.firebaseNotificationId_(notification.id));
|
||||
firebaseNotification.setTitle(notification.title)
|
||||
|
Loading…
Reference in New Issue
Block a user