liftoff-app / liftoff

🐒 A mobile client for lemmy
GNU General Public License v2.0
528 stars 36 forks source link

Add account picker to home screen #510

Open jcgurango opened 1 year ago

jcgurango commented 1 year ago

464 turned out to not be very good in terms of maintanability and honestly is just too much refactoring work this far along. I've made this PR with a couple of commits from that branch + a different approach. Instead I decoupled AccountsStore from its saving to preferences functionality, and moved that out of the class to be handled elsewhere listening to the store for changes. I fiddled around with the concept of passing new accounts stores whenever accounts are selected, but it turns out the BuildContext passed to any routes you create is not the BuildContext you pass to Navigator.of(), it's the build context on which the Navigator itself is created (in this case within the top level MaterialApp unfortunately) so overriding the AccountsStore in the context. So now changing users just changes the "default account" which is already used all over the app. I think trying to muddle with individualizing accounts in routes (or even in the different stores) is going to be a nightmare refactoring job but at least I know that for a fact now.

zachatrocity commented 1 year ago

Looks like multiple build issues.

Could you try to build locally and see if you can fix the errors? I suspect it might be due to SDK versions

jcgurango commented 1 year ago

@zachatrocity Nope, now I can't build it. Can the builders be reverted to the older version of dart/flutter we were using? I remember Myk said something about not upgrading to the latest

zachatrocity commented 1 year ago

Yeah let me see how to do what with the GitHub actions