init
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
[notificationconfig]
|
||||
title = Notifications
|
||||
push_subscriptions = Push notifications
|
||||
push_subscriptions_text = Movim will send push notifications to the following registered devices
|
||||
push_enabled = Push notifications enabled for this device
|
||||
push_disabled = Push notifications disabled for this device
|
||||
unknown_browser = Unknown browser
|
||||
unknown_platform = Unknown platform
|
||||
@@ -0,0 +1,18 @@
|
||||
MovimWebsocket.attach(function() {
|
||||
if (Notification.permission !== 'granted') {
|
||||
NotificationConfig_ajaxHttpRequest();
|
||||
}
|
||||
|
||||
navigator.serviceWorker.getRegistration(SW_URI).then((registration) => {
|
||||
if (!registration) {
|
||||
NotificationConfig_ajaxHttpPushGetConfig();
|
||||
return;
|
||||
}
|
||||
|
||||
registration.pushManager.getSubscription().then((pushSubscription) => {
|
||||
NotificationConfig_ajaxHttpPushGetConfig(pushSubscription ? pushSubscription.endpoint : null);
|
||||
}, () => {
|
||||
NotificationConfig_ajaxHttpPushGetConfig();
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user