Fix app badge count not getting updated
This commit is contained in:
parent
3114cd497b
commit
860bec5534
2 changed files with 17 additions and 2 deletions
|
@ -35,6 +35,7 @@ import { getServiceIdsForE164s } from './util/getServiceIdsForE164s';
|
||||||
import { SIGNAL_ACI, SIGNAL_AVATAR_PATH } from './types/SignalConversation';
|
import { SIGNAL_ACI, SIGNAL_AVATAR_PATH } from './types/SignalConversation';
|
||||||
import { getTitleNoDefault } from './util/getTitle';
|
import { getTitleNoDefault } from './util/getTitle';
|
||||||
import * as StorageService from './services/storage';
|
import * as StorageService from './services/storage';
|
||||||
|
import type { ConversationPropsForUnreadStats } from './util/countUnreadStats';
|
||||||
import { countAllConversationsUnreadStats } from './util/countUnreadStats';
|
import { countAllConversationsUnreadStats } from './util/countUnreadStats';
|
||||||
|
|
||||||
type ConvoMatchType =
|
type ConvoMatchType =
|
||||||
|
@ -189,7 +190,21 @@ export class ConversationController {
|
||||||
window.storage.get('badge-count-muted-conversations') || false;
|
window.storage.get('badge-count-muted-conversations') || false;
|
||||||
|
|
||||||
const unreadStats = countAllConversationsUnreadStats(
|
const unreadStats = countAllConversationsUnreadStats(
|
||||||
this._conversations.map(conversation => conversation.format()),
|
this._conversations.map(
|
||||||
|
(conversation): ConversationPropsForUnreadStats => {
|
||||||
|
// Need to pull this out manually into the Redux shape
|
||||||
|
// because `conversation.format()` can return cached props by the
|
||||||
|
// time this runs
|
||||||
|
return {
|
||||||
|
activeAt: conversation.get('active_at') ?? undefined,
|
||||||
|
isArchived: conversation.get('isArchived'),
|
||||||
|
markedUnread: conversation.get('markedUnread'),
|
||||||
|
muteExpiresAt: conversation.get('muteExpiresAt'),
|
||||||
|
unreadCount: conversation.get('unreadCount'),
|
||||||
|
unreadMentionsCount: conversation.get('unreadMentionsCount'),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
),
|
||||||
{ includeMuted }
|
{ includeMuted }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ export type UnreadStatsOptions = Readonly<{
|
||||||
includeMuted: boolean;
|
includeMuted: boolean;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
type ConversationPropsForUnreadStats = Readonly<
|
export type ConversationPropsForUnreadStats = Readonly<
|
||||||
Pick<
|
Pick<
|
||||||
ConversationType,
|
ConversationType,
|
||||||
| 'activeAt'
|
| 'activeAt'
|
||||||
|
|
Loading…
Add table
Reference in a new issue