thunder-app / thunder

Thunder - An open-source cross-platform Lemmy client for iOS and Android built with Flutter
https://thunderapp.dev
GNU Affero General Public License v3.0
732 stars 62 forks source link

Account page and management improvements #1354

Closed CTalvio closed 2 weeks ago

CTalvio commented 3 weeks ago

Pull Request Description

Issue Being Fixed

Various inconsistencies on the account page, alleviates confusion about where to find what and what the state of the account page is. Makes common actions available where one would think to look, especially when looking for account management via the settings tab. (before, you would never have found a way to log out from here, or add/remove accounts)

Screenshots / Recordings

image

image

Here's what switching accounts looked like before: Screen_recording_20240506_224508.webm

After: Screen_recording_20240506_224542.webm

Checklist

CTalvio commented 3 weeks ago

If I remove all accounts and then navigate to Settings > Account, I get an infinite spinner.

Good catch. And agreed on using a user indicator, the switchers are a bit redundant but I didn't bother figuring out something better, and what a timesave that was, as you now reveal the perfect widget exists already :D

This is super nit-picky, but do you want to match the horizontal rule in the account settings page with the ones on the Debug and Appearance page (or vice versa) just for consistency?

Yes. This would absolutely have bothered me the second I noticed.

micahmo commented 3 weeks ago

Hi @CTalvio, sorry for being annoying! Your latest commit does fix the account settings page from settings! But now there seems to be an issue with the profile page.

  1. If I log out of the last account, it leaves my account info there.
  2. If I refresh, it gets stuck spinning forever.

https://github.com/thunder-app/thunder/assets/7417301/51ceceba-a71c-4b88-85e5-3b0b28f453b5

CTalvio commented 3 weeks ago

That seems to do the trick.

I'm not sure what the returns in those listeners were there to do?

micahmo commented 3 weeks ago

Oh, we can't take those out! Those returns are what supports the temporary account feature (where you can post or comment as a different user). It allows us to switch the account without reloading the whole app. When reload is false, we shouldn't rebuild parts of the app like the user page or the feed. Sorry if that makes your feature more complicated (although I'm not sure why reload is false in your case).

CTalvio commented 3 weeks ago

Yeah I figured they were there for a reason... Hence my commenting on it.

The account page is leaving the old account page up because it doesn't update on changes elsewhere.

micahmo commented 3 weeks ago

Would it help to do just the UI changes in this PR (moving the manage button the left, removing the log out button, allowing log out of last account, allow management of account from account settings page) and worry about the bloc/reloading issues separately? I know @hjiangsu has talked about combining AuthBloc and AccountBloc which I think could help us here too!

CTalvio commented 3 weeks ago

I'll poke at it some more, but if nothing else I'll obviously reverse removing those returns.

CTalvio commented 3 weeks ago

It's behaving weird in general. Switching the account while in account settings doesn't stick, but doing so from the account page, does. Removing the returns doesn't fix that.

micahmo commented 3 weeks ago

This is super nit-picky, but do you want to match the horizontal rule in the account settings page with the ones on the Debug and Appearance page (or vice versa) just for consistency?

Just a note, I'm refactoring this divider widget (since we're using it a bunch now) in #1359, so whichever one of us goes first can pick up the changes from the other. 😊

hjiangsu commented 3 weeks ago

I was playing around with this a bit, and noticed that if you manage accounts from the account settings, it changes your entire profile (until you refresh again?). Previously, switching users in the account settings would only temporarily switch users.

Here's what I mean:

https://github.com/thunder-app/thunder/assets/30667958/a488eec1-7f74-409c-ad77-369efe1f13b7

https://github.com/thunder-app/thunder/assets/30667958/81123bb0-5704-4c7d-b4c6-24e0db57eda0

CTalvio commented 2 weeks ago

It's behaving weird in general. Switching the account while in account settings doesn't stick, but doing so from the account page, does. Removing the returns doesn't fix that.

It's supposed to actually change the account, unlike working the same way as posting/commenting as a different user like it did before. But it doesn't stick for some reason, as you point out.

This is because you can now remove/add accounts from account settings.

CTalvio commented 2 weeks ago

Mystery solved, I didn't remove the code that restores previous account upon popping out of the account settings.

As for the profile sticking around when going from logged-in to accounts removed/anonymous, due to the reload not happening for some reason, adding a logged-in check to the reload returns works around that oddity.