Page MenuHomePhabricator

D6818.id22868.diff
No OneTemporary

D6818.id22868.diff

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

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)

Event Timeline