Skip to content

Use new unreadCountStore for setting appIcon Badge #1174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/talk/renderer/TalkWrapper/TalkWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { onTalkHashDirty, onTalkHashUpdate, openConversation, setTalkHash } from
import { registerTalkDesktopSettingsSection } from '../Settings/index.ts'
import { subscribeBroadcast } from '../../../shared/broadcast.service.ts'
import { appData } from '../../../app/AppData.js'
import { subscribe } from '@nextcloud/event-bus'

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

subscribe('talk:unread:updated', ( eventData ) => {
window.TALK_DESKTOP.setBadgeCount(eventData.messages)
})

// Ready
emit('ready')
})
Expand Down
2 changes: 0 additions & 2 deletions src/talk/renderer/notifications/notifications.store.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ export function createNotificationStore() {
if (notifications.length > _oldcount) {
_oldcount = notifications.length
if (state.backgroundFetching && document.hidden) {
window.TALK_DESKTOP.setBadgeCount()
window.TALK_DESKTOP.flashAppIcon(true)
// If we didn't already highlight, store the title so we can restore on tab-view
if (!document.title.startsWith('* ')) {
Expand All @@ -110,7 +109,6 @@ export function createNotificationStore() {
* the Talk might have altered it.
*/
function _restoreTitle() {
window.TALK_DESKTOP.setBadgeCount(0)
window.TALK_DESKTOP.flashAppIcon(false)
if (document.title.startsWith('* ')) {
document.title = document.title.substring(2)
Expand Down