diff --git a/fluxer_app/src/features/app/components/AppNotificationBadge.ts b/fluxer_app/src/features/app/components/AppNotificationBadge.ts index 733a4281c..f9930e637 100644 --- a/fluxer_app/src/features/app/components/AppNotificationBadge.ts +++ b/fluxer_app/src/features/app/components/AppNotificationBadge.ts @@ -7,7 +7,7 @@ import GuildReadState from '@app/features/guild/state/GuildReadState'; import {Logger} from '@app/features/platform/utils/AppLogger'; import Relationships from '@app/features/relationship/state/Relationships'; import Notification from '@app/features/ui/state/Notification'; -import {getElectronAPI} from '@app/features/ui/utils/NativeUtils'; +import {getElectronAPI, isDesktop} from '@app/features/ui/utils/NativeUtils'; import {updateDocumentTitleBadge} from '@app/features/window/hooks/useFluxerDocumentTitle'; import {RelationshipTypes} from '@fluxer/constants/src/UserConstants'; import Favico from 'favico.js'; @@ -87,7 +87,7 @@ const setFaviconBadge = (badge: number, source: string | null): void => { } }; const setPwaBadge = (badge: number): void => { - if (!navigator.setAppBadge || !navigator.clearAppBadge) { + if (isDesktop() || !navigator.setAppBadge || !navigator.clearAppBadge) { return; } try { diff --git a/fluxer_app/src/features/platform/service_worker/Worker.ts b/fluxer_app/src/features/platform/service_worker/Worker.ts index 009ea45a4..10ca68db8 100644 --- a/fluxer_app/src/features/platform/service_worker/Worker.ts +++ b/fluxer_app/src/features/platform/service_worker/Worker.ts @@ -188,6 +188,9 @@ self.addEventListener('message', (event: ExtendableMessageEvent) => { }); const updateAppBadge = async (count: number | null): Promise => { + if (isNativeDesktopUserAgent(workerNavigator.userAgent)) { + return; + } if (typeof navigator.setAppBadge !== 'function' && typeof navigator.clearAppBadge !== 'function') { return; } @@ -355,7 +358,6 @@ self.addEventListener('push', (event: PushEvent) => { return; } if (isNativeDesktopUserAgent(workerNavigator.userAgent)) { - await updateAppBadge(badgeCount); await log('warn', 'push ignored in native desktop service worker', {badgeCount}); return; }