[Info] Notification badge unread count tips (discussion)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 18/100
- Issue 类型
- 文档
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- rust, sqlite
调研方向
No implementation file, test, or entry point is named. Start by reading matrix-rust-sdk PR 4285 and the linked Matrix discussion; this issue currently has no concrete change request or definition of done.
由索引模型根据 Issue 内容生成。
描述
Just noting this here for future use, for when Robrix supports notifications on mobile and we need to calculate the count of unread messages/notifications.
Danny from the Element X iOS team made this very helpful comment (and there is some context behind it as well) https://matrix.to/#/!qSsPTKDfMGYqhgiLPJ:flipdot.org/$_rJfoHNfV7O4oo_h7go1GA0V5ZBMkgO5DmAu9AuCa_8?via=flipdot.org&via=matrix.org&via=element.io
Relevant conversation snippets are copied here for posterity:
Danny:
I'm working on the notification badge count in a fork of Element X iOS (hopefully can push the changes upstream). I'm seeing that the notification extension isn't persisting the incoming notification that it looks up with a sliding sync to the main database. I see there is cross-process locking implemented, and I have the main app force quit when I test. Any idea why the NotificationClient isn't writing to the shared DB? Or gotchas in regard to this? Perhaps I should not be expecting it to be persisted at all and this is not implemented yet.
Ivan:
The state store isn’t cross-process “friendly”. It’s in-progress, and sadly paused due to other projects with higher priority.
Danny:
dang, it seems that's how Signal and Telegram compute a reliable badge count locally. I'll come up with some backup method for now. Or maybe look into making it cross-process friendly. I would appreciate any links to issues regarding the current status on that project if possible. Thank you
Ivan:
https://github.com/matrix-org/matrix-rust-sdk/pull/4285 and this comment especially https://github.com/matrix-org/matrix-rust-sdk/pull/4285#issuecomment-2488655073. That’s for the generalisation of the cross-process lock poison. But but but it won’t solve the badge counter. This will just allow to access the state store from different processes. To get a correct badge counter, we need to automatically back paginate. I have started to write an issue for that but it still a draft since a week.
I see, thank you for the pointers. I've decided to compute the count locally based on the rooms, messages, etc in the local database. Computing the count is smooth in the main app, and for now to compute it in the notification service extension (iOS), I've added a lightweight shared sqlite DB in the shared app group. It basically just stores all the roomID's that have live notifications (based on the settings the user selects in the app). Then the extension uses that and the information for the incoming notifications room to compute the count.
Of course the badge count currently is the number of rooms with unread messages, not the actual unread messages count. But I think we will add a toggle in the app to let the user decide.
In this way we avoid any inaccurate server side counts, as there were reports of ghost badge counts that never go away even with no unread messages in the main app.
The main issue with a solution like this is if you have multiple devices. But when registering the phone's "push id" I added the "content-available:1" flag to the default payload that will be sent with all notifications to wake up the main app, where it can perform a sliding sync, persist it, and fix up this new lightweight shared DB. Of course "content-available" is not reliable and at most may open the main app twice an hour I hear. And it doesn't open the main app if it is force quit I believe.
Ideally the extension one day will be able to write back what it has learned about the incoming notifications room to the main database and there will be no issues with multiple devices. A kludge but as elegant as possible. Since refactoring the cross process lock and getting the notification service extension to persist that data feels like a much larger fix.
Manu:
this is a very smart approach, Danny. Where do you manage this shared sqlite DB? Is it on the iOS app side or on a fork of the SDK
Danny:
Thanks Manu, I manage the shared sqlite db on the iOS app side
- 主要语言
- Rust
- 星标
- 496
- 派生
- 70
- 平均合并
- 1 小时 24 分钟
- 30 天内合并 PR
- 70
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
project-robius/robrix 的其他 Issue
-
enhancement help wanted
难度 2/5 1-3 小时 新手友好度 66/100
project-robius/robrix#1206 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 74/100
project-robius/robrix#1177 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 49/100
project-robius/robrix#1207 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 52/100
project-robius/robrix#1205 · 1 条评论 ·
维护者通常 1 天内回复
-
enhancement
难度 5/5 一周以上 新手友好度 25/100
project-robius/robrix#1204 ·
维护者通常 1 天内回复
查看 project-robius/robrix 的全部 Issue
相似的 Issue
-
area/backends bug session-analysis
难度 2/5 1-3 小时 新手友好度 69/100
维护者通常 1 天内回复
-
docs good first issue
难度 2/5 1-3 小时 新手友好度 75/100
-
crash
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 2 天内回复
-
难度 1/5 1 小时以内 新手友好度 65/100
aaif-goose/goose#13125 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复