From e6dc026708ddcdddbc75c21b1f71c2ba34a8a99f Mon Sep 17 00:00:00 2001 From: Vendicated Date: Tue, 24 Oct 2023 23:12:08 +0200 Subject: [PATCH] Fix for latest canary --- src/renderer/appBadge.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/renderer/appBadge.ts b/src/renderer/appBadge.ts index de46701..b55d488 100644 --- a/src/renderer/appBadge.ts +++ b/src/renderer/appBadge.ts @@ -15,15 +15,19 @@ let NotificationSettingsStore: any; export function setBadge() { if (Settings.store.appBadge === false) return; - const mentionCount = GuildReadStateStore.getTotalMentionCount(); - const pendingRequests = RelationshipStore.getPendingCount(); - const hasUnread = GuildReadStateStore.hasAnyUnread(); - const disableUnreadBadge = NotificationSettingsStore.getDisableUnreadBadge(); + try { + const mentionCount = GuildReadStateStore.getTotalMentionCount(); + const pendingRequests = RelationshipStore.getPendingCount(); + const hasUnread = GuildReadStateStore.hasAnyUnread(); + const disableUnreadBadge = NotificationSettingsStore.getDisableUnreadBadge(); - let totalCount = mentionCount + pendingRequests; - if (!totalCount && hasUnread && !disableUnreadBadge) totalCount = -1; + let totalCount = mentionCount + pendingRequests; + if (!totalCount && hasUnread && !disableUnreadBadge) totalCount = -1; - VesktopNative.app.setBadgeCount(totalCount); + VesktopNative.app.setBadgeCount(totalCount); + } catch (e) { + console.error(e); + } } let toFind = 3;