Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3514693
D6818.id22868.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D6818.id22868.diff
View Options
diff --git a/web/app.react.js b/web/app.react.js
--- a/web/app.react.js
+++ b/web/app.react.js
@@ -42,6 +42,7 @@
import UpdateModalHandler from './modals/update-modal.react.js';
import SettingsSwitcher from './navigation-panels/settings-switcher.react.js';
import Topbar from './navigation-panels/topbar.react.js';
+import { PushNotificationsHandler } from './push-notif/push-notifs-handler.js';
import { updateNavInfoActionType } from './redux/action-types.js';
import DeviceIDUpdater from './redux/device-id-updater.js';
import DisconnectedBarVisibilityHandler from './redux/disconnected-bar-visibility-handler.js';
@@ -164,6 +165,7 @@
<VisibilityHandler />
<DeviceIDUpdater />
<PolicyAcknowledgmentHandler />
+ <PushNotificationsHandler />
{content}
{this.props.modals}
</WagmiENSCacheProvider>
diff --git a/web/push-notif/push-notifs-handler.js b/web/push-notif/push-notifs-handler.js
new file mode 100644
--- /dev/null
+++ b/web/push-notif/push-notifs-handler.js
@@ -0,0 +1,22 @@
+// @flow
+
+import React from 'React';
+
+import electron from '../electron.js';
+
+function PushNotificationsHandler(): React.Node {
+ React.useEffect(() => {
+ (async () => {
+ if (!navigator.serviceWorker || electron) {
+ return;
+ }
+
+ await navigator.serviceWorker.register('/worker/notif', { scope: '/' });
+ })();
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
+
+ return null;
+}
+
+export { PushNotificationsHandler };
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 23, 6:12 AM (18 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2693752
Default Alt Text
D6818.id22868.diff (1 KB)
Attached To
Mode
D6818: [web] Register service worker for notifs
Attached
Detach File
Event Timeline
Log In to Comment