Indicator for unsynced local changes and manual sync button
As a user I should know when the app (while offline) is holding unsynced changes that my colleagues will not see on their devices yet.
Objective It is not obvious whether the changes are already synced and distributed or only local at the moment. Also, we don't have an indicator when the app is offline. The user should be able to tell and (especially if urgent) have the chance to maybe explicitly establish an internet connection to sync his/her changes before closing the app.
- display an "offline" icon in its place with a helpful tooltip whenever the app is in offline mode
- display an indicator dot with the icon (both when offline + online) when there are local, unsynced changes and display a tooltip stating something like "4 unsynced records"
- allow the user to click on the icon (regardless of whether there are unsynced changes or not) to
- when online: trigger an immediate sync to upload local changes (if any) and download changes from server
- when offline: re-check the connection and login, show the login screen (if accessible and necessary) and then trigger a sync (or otherwise show an appropriate message to the user explaining why online/sync is not possible)
Proposed Solutions & Alternatives We already have an indicator symbol that is displayed while a sync is in progress. This can be extended with more functionality.
Additional context
- see
SessionManagerService(and its state observables likeLoginStateSubject) - see
SyncService(and its state observables likeSyncStateSubject)
There is a plugin for the registration of unsynced changes: https://github.com/zoepage/pouchdb-hoodie-unsynced-local-docs
What do you think about using this? In my opinion, we shouldnt use many more 3rd party libraries and think about implementing our own service. But we should consider bypass the time until our feature is finished...
I am a big fan of using existing libraries. Why reinvent the wheel? This looks quite old (last update in 2015) but if it does the job that's great.
Our use case here however is to inform the user while the app is offline. pouchdb-hoodie-unsynced-local-docs looks like it does online comparison with a remote db which wouldn't help us to determine the state while offline (and when back online our live sync kicks in automatically anyway).
also see
#2100