about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/actions/push_notifications
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-10-28 21:22:04 -0500
committerFire Demon <firedemon@creature.cafe>2020-10-28 21:35:03 -0500
commit3de376650c700be81d893554b90ac8ce27646333 (patch)
treed3b0ca2da8b5f4f4f4cca5e5602293d8f89f50c4 /app/javascript/flavours/glitch/actions/push_notifications
parentf12ad9098f0608f558b92e36b4adeef2e8c28604 (diff)
Make push notifications optional
Diffstat (limited to 'app/javascript/flavours/glitch/actions/push_notifications')
-rw-r--r--app/javascript/flavours/glitch/actions/push_notifications/registerer.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/actions/push_notifications/registerer.js b/app/javascript/flavours/glitch/actions/push_notifications/registerer.js
index 8fdb239f7..1f9ebe569 100644
--- a/app/javascript/flavours/glitch/actions/push_notifications/registerer.js
+++ b/app/javascript/flavours/glitch/actions/push_notifications/registerer.js
@@ -1,7 +1,9 @@
 import api from 'flavours/glitch/util/api';
+import { webPushEnabled } from 'flavours/glitch/util/initial_state';
 import { pushNotificationsSetting } from 'flavours/glitch/util/settings';
 import { setBrowserSupport, setSubscription, clearSubscription } from './setter';
 
+
 // Taken from https://www.npmjs.com/package/web-push
 const urlBase64ToUint8Array = (base64String) => {
   const padding = '='.repeat((4 - base64String.length % 4) % 4);
@@ -49,7 +51,7 @@ const sendSubscriptionToBackend = (getState, subscription, me) => {
 };
 
 // Last one checks for payload support: https://web-push-book.gauntface.com/chapter-06/01-non-standards-browsers/#no-payload
-const supportsPushNotifications = ('serviceWorker' in navigator && 'PushManager' in window && 'getKey' in PushSubscription.prototype);
+const supportsPushNotifications = (webPushEnabled && 'serviceWorker' in navigator && 'PushManager' in window && 'getKey' in PushSubscription.prototype);
 
 export function register () {
   return (dispatch, getState) => {