zulip-flutter
zulip-flutter copied to clipboard
On launch go to last account used, not just first in list
In my initial implementation of #516, when you launch the app, we'll navigate to the inbox for the first account in your list of accounts. For most users, this will be their only account.
But for those of us who do have more than one account we're logged in as, the first one in the list might not be the one we most often want to use; it's just the first one the user logged in as after installing the app. So it'd be more convenient to instead go to the account most recently used, which is much more likely to be the one the user is interested in seeing now.
Doing this probably means adding a bit more data to our local database: probably a small new table, named perhaps like "navigation", always with just one row, and perhaps at first just one column which is an account ID. Then GlobalStore
will have a corresponding field, and LiveGlobalStore.load
will read the table at startup, just like the accounts table.
To update the data… perhaps supply a NavigatorObserver
that looks for newly-pushed routes that are instances of AccountPageRouteMixin
, so therefore carry an account ID, and when the NavigatorObserver
sees such a route, the observer causes that account ID value to get written if it's different from the existing value.
We don't have a lot of examples yet of using the database, so this is an issue that will call for some experimenting with the API and finding the style we want to use. It's therefore not a suitable issue for a new contributor.