From 8be0c590f9627ef349c89e56b64b47e03bb0f3bf Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Mon, 11 Oct 2021 19:48:01 +0300 Subject: [PATCH] PWA: Update unread counter badge on sync (#1488) --- src/modules/actions/api/sync.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/modules/actions/api/sync.ts b/src/modules/actions/api/sync.ts index b66120cec..1d0568fb5 100644 --- a/src/modules/actions/api/sync.ts +++ b/src/modules/actions/api/sync.ts @@ -12,6 +12,7 @@ import { } from '../../../config'; import { callApi } from '../../../api/gramjs'; import { buildCollectionByKey } from '../../../util/iteratees'; +import { updateAppBadge } from '../../../util/appBadge'; import { replaceChatListIds, replaceChats, @@ -23,7 +24,13 @@ import { replaceThreadParam, } from '../../reducers'; import { - selectUser, selectChat, selectCurrentMessageList, selectDraft, selectChatMessage, selectThreadInfo, + selectUser, + selectChat, + selectCurrentMessageList, + selectDraft, + selectChatMessage, + selectThreadInfo, + selectCountNotMutedUnread, } from '../../selectors'; import { isChatPrivate } from '../../helpers'; @@ -75,6 +82,8 @@ async function afterSync(actions: GlobalActions) { await callApi('fetchCurrentUser'); + updateAppBadge(selectCountNotMutedUnread(getGlobal())); + if (DEBUG) { // eslint-disable-next-line no-console console.log('>>> FINISH AFTER-SYNC');