feat: Include message requests in count
This commit is contained in:
parent
6af88e0432
commit
d850a62794
1 changed files with 4 additions and 1 deletions
|
@ -11,6 +11,7 @@ import { Settings } from "./settings";
|
|||
|
||||
let GuildReadStateStore: any;
|
||||
let NotificationSettingsStore: any;
|
||||
let MessageRequestStore: any;
|
||||
|
||||
export function setBadge() {
|
||||
if (Settings.store.appBadge === false) return;
|
||||
|
@ -18,10 +19,11 @@ export function setBadge() {
|
|||
try {
|
||||
const mentionCount = GuildReadStateStore.getTotalMentionCount();
|
||||
const pendingRequests = RelationshipStore.getPendingCount();
|
||||
const messageRequests = MessageRequestStore.getMessageRequestsCount();
|
||||
const hasUnread = GuildReadStateStore.hasAnyUnread();
|
||||
const disableUnreadBadge = NotificationSettingsStore.getDisableUnreadBadge();
|
||||
|
||||
let totalCount = mentionCount + pendingRequests;
|
||||
let totalCount = mentionCount + pendingRequests + messageRequests;
|
||||
if (!totalCount && hasUnread && !disableUnreadBadge) totalCount = -1;
|
||||
|
||||
VesktopNative.app.setBadgeCount(totalCount);
|
||||
|
@ -44,4 +46,5 @@ function waitForAndSubscribeToStore(name: string, cb?: (m: any) => void) {
|
|||
|
||||
waitForAndSubscribeToStore("GuildReadStateStore", store => (GuildReadStateStore = store));
|
||||
waitForAndSubscribeToStore("NotificationSettingsStore", store => (NotificationSettingsStore = store));
|
||||
waitForAndSubscribeToStore("MessageRequestStore", store => (MessageRequestStore = store));
|
||||
waitForAndSubscribeToStore("RelationshipStore");
|
||||
|
|
Loading…
Reference in a new issue