Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3509656
D7329.id24944.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
D7329.id24944.diff
View Options
diff --git a/web/push-notif/push-notifs-handler.js b/web/push-notif/push-notifs-handler.js
--- a/web/push-notif/push-notifs-handler.js
+++ b/web/push-notif/push-notifs-handler.js
@@ -96,9 +96,11 @@
const dispatch = useDispatch();
+ const supported = 'Notification' in window && !electron;
+
React.useEffect(() => {
(async () => {
- if (!navigator.serviceWorker || electron) {
+ if (!navigator.serviceWorker || !supported) {
return;
}
@@ -126,7 +128,7 @@
// Ask for permission on login
const prevLoggedIn = React.useRef(loggedIn);
React.useEffect(() => {
- if (!navigator.serviceWorker || electron) {
+ if (!navigator.serviceWorker || !supported) {
return;
}
@@ -152,11 +154,12 @@
modalContext,
notifPermissionAlertInfo,
prevLoggedIn,
+ supported,
]);
// Redirect to thread on notification click
React.useEffect(() => {
- if (!navigator.serviceWorker || electron) {
+ if (!navigator.serviceWorker || !supported) {
return;
}
@@ -179,7 +182,7 @@
navigator.serviceWorker.addEventListener('message', callback);
return () =>
navigator.serviceWorker?.removeEventListener('message', callback);
- }, [dispatch]);
+ }, [dispatch, supported]);
return null;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 22, 7:06 AM (25 m, 19 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2690273
Default Alt Text
D7329.id24944.diff (1 KB)
Attached To
Mode
D7329: [web] Check if notifications are supported
Attached
Detach File
Event Timeline
Log In to Comment