mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-19 05:55:34 +09:00
fix(app): keep the red taskbar badge on windows (#3491)
This commit is contained in:
1 parent
8c38e06a15
commit
da1842ecab
2 files changed
+5
-3
No files matched your search
@@ -7,7 +7,7 @@ import GuildReadState from '@app/features/guild/state/GuildReadState';
|
|||||||
import {Logger} from '@app/features/platform/utils/AppLogger';
|
import {Logger} from '@app/features/platform/utils/AppLogger';
|
||||||
import Relationships from '@app/features/relationship/state/Relationships';
|
import Relationships from '@app/features/relationship/state/Relationships';
|
||||||
import Notification from '@app/features/ui/state/Notification';
|
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 {updateDocumentTitleBadge} from '@app/features/window/hooks/useFluxerDocumentTitle';
|
||||||
import {RelationshipTypes} from '@fluxer/constants/src/UserConstants';
|
import {RelationshipTypes} from '@fluxer/constants/src/UserConstants';
|
||||||
import Favico from 'favico.js';
|
import Favico from 'favico.js';
|
||||||
@@ -87,7 +87,7 @@ const setFaviconBadge = (badge: number, source: string | null): void => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const setPwaBadge = (badge: number): void => {
|
const setPwaBadge = (badge: number): void => {
|
||||||
if (!navigator.setAppBadge || !navigator.clearAppBadge) {
|
if (isDesktop() || !navigator.setAppBadge || !navigator.clearAppBadge) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -188,6 +188,9 @@ self.addEventListener('message', (event: ExtendableMessageEvent) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const updateAppBadge = async (count: number | null): Promise<void> => {
|
const updateAppBadge = async (count: number | null): Promise<void> => {
|
||||||
|
if (isNativeDesktopUserAgent(workerNavigator.userAgent)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (typeof navigator.setAppBadge !== 'function' && typeof navigator.clearAppBadge !== 'function') {
|
if (typeof navigator.setAppBadge !== 'function' && typeof navigator.clearAppBadge !== 'function') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -355,7 +358,6 @@ self.addEventListener('push', (event: PushEvent) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isNativeDesktopUserAgent(workerNavigator.userAgent)) {
|
if (isNativeDesktopUserAgent(workerNavigator.userAgent)) {
|
||||||
await updateAppBadge(badgeCount);
|
|
||||||
await log('warn', 'push ignored in native desktop service worker', {badgeCount});
|
await log('warn', 'push ignored in native desktop service worker', {badgeCount});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user