[Info] Notification badge unread count tips (discussion)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 18/100
- Tipo di issue
- Documentazione
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- rust, sqlite
- Ambito
- databases, distributed-systems, mobile-dev
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Rust
- Stelle
- 489
- Fork
- 71
- Merge medio
- 1h 27m
- PR unite (30g)
- 72
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di project-robius/robrix
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
project-robius/robrix#1154 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
project-robius/robrix#1155 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 Mezza giornata Idoneità per principianti 12/100
project-robius/robrix#1153 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue help wanted
Difficoltà 3/5 1-2 giorni Idoneità per principianti 38/100
project-robius/robrix#1152 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 15/100
project-robius/robrix#1151 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di project-robius/robrix
Issue simili
-
build: Update rust versionForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertadependencies
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
ibm-granite-community/granite-cli#229 ·
I maintainer di solito rispondono entro 1 giorno
-
setTargetAtTime booked ahead of time starts its curve early (values blow up before start_time)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
orottier/web-audio-api-rs#658 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
aosama/astronomical#1318 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
shep-pm/shep-kelpie#980 ·
I maintainer di solito rispondono entro 1 giorno