feat: Add unread message badge to system tray icon#1605
Conversation
fe957d7 to
06f6a62
Compare
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
06f6a62 to
590ed01
Compare
Shows numbered badge (1, 2, 15, 99+) on tray icon when there are unread conversations, respecting notification settings. Features: - Canvas-based badge rendering using offscreen BrowserWindow - Respects notification settings per conversation - Event-driven updates via store.subscribe() (no polling!) (Pertially?) resolves nextcloud#391 Signed-off-by: Marc Kupietz <kupietz@ids-mannheim.de>
590ed01 to
693f19b
Compare
|
Successfully rebased on v2.2.0 |
|
Could someone please review this merge request? I’ve tested it successfully and it works perfectly. This is a must-have feature for my colleagues and me. We frequently overlook notifications because we don't want to keep the window open all the time—plus, the current setup doesn't work well when using multiple workspaces. |
| // Wait for store to be available, then subscribe to mutations | ||
| const checkAndSubscribe = () => { | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| const store = (window as any).OCA?.Talk?.instance?.$store |
There was a problem hiding this comment.
First of all, thanks for the contribution!
I'm concerned, that this would not survive a planned migration to a different state manager.
There is already a public event introduced to provide these computations on web:
emit('talk:unread:updated', {
conversations: number,
messages: number,
mentions: number,
mentionsDirect: number,
})
There was a problem hiding this comment.
First of all, thanks for the contribution!
I'm concerned, that this would not survive a planned migration to a different state manager.
There is already a public event introduced to provide these computations on web:
emit('talk:unread:updated', { conversations: number, messages: number, mentions: number, mentionsDirect: number, })
Thanks for the helpful hint and the review! Good point. I'll rework the integration to use the public talk:unread:updated (and rebase onto current main and fix the lint error while at it).
One small issue with the public event: unlike in my original PR, the public event's counters don't take per-conversation notification settings into account, so muted conversations will count as well. This is not nice, but no big issue for me. I hope for everybody else, too (opinions welcome!).
That said, maybe we can extend the event's payload in a follow-up PR to spreed with an additional counter that respects notification settings.
There was a problem hiding this comment.
Sure, we can adjust payload upstream as well to respect notification settings / count additionally.
But I would wait for @ShGKme to give a general opinion on the code change before implementation, so we and you don't spend more time going back and forth with reviews and adjustments =)
There was a problem hiding this comment.
Sounds good! Waiting for @ShGKme is fine, I've had some practice since December =)
The rework for using the public event is no big deal, it's mostly done already anyway.
Shows numbered badge (1, 2, 15, 99+) on tray icon when there are unread conversations, respecting notification settings.
Features:
☑️ Resolves
🖼️ Screenshots