Skip to content

Commit da37046

Browse files
committed
feat: set appIcon badge count from new event "talk:unread:updated"
Signed-off-by: Markus Stoll <[email protected]>
1 parent 9f4342c commit da37046

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/talk/renderer/TalkWrapper/TalkWrapper.vue

+5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { onTalkHashDirty, onTalkHashUpdate, openConversation, setTalkHash } from
99
import { registerTalkDesktopSettingsSection } from '../Settings/index.ts'
1010
import { subscribeBroadcast } from '../../../shared/broadcast.service.ts'
1111
import { appData } from '../../../app/AppData.js'
12+
import { subscribe } from '@nextcloud/event-bus'
1213

1314
const emit = defineEmits<{
1415
(event: 'ready'): void
@@ -34,6 +35,10 @@ onMounted(async () => {
3435
appData.setTalkHashDirty(true).persist()
3536
})
3637

38+
subscribe('talk:unread:updated', ( eventData ) => {
39+
window.TALK_DESKTOP.setBadgeCount(eventData.messages)
40+
})
41+
3742
// Ready
3843
emit('ready')
3944
})

src/talk/renderer/notifications/notifications.store.js

-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ export function createNotificationStore() {
9494
if (notifications.length > _oldcount) {
9595
_oldcount = notifications.length
9696
if (state.backgroundFetching && document.hidden) {
97-
window.TALK_DESKTOP.setBadgeCount()
9897
window.TALK_DESKTOP.flashAppIcon(true)
9998
// If we didn't already highlight, store the title so we can restore on tab-view
10099
if (!document.title.startsWith('* ')) {
@@ -110,7 +109,6 @@ export function createNotificationStore() {
110109
* the Talk might have altered it.
111110
*/
112111
function _restoreTitle() {
113-
window.TALK_DESKTOP.setBadgeCount(0)
114112
window.TALK_DESKTOP.flashAppIcon(false)
115113
if (document.title.startsWith('* ')) {
116114
document.title = document.title.substring(2)

0 commit comments

Comments
 (0)