Skip to content

Reload accounts from the Keychain when the app becomes active - #2532

Open
meet4731 wants to merge 1 commit into
Dimillian:mainfrom
meet4731:fix/2530-logged-out-after-update
Open

meet4731 wants to merge 1 commit into
Dimillian:mainfrom
meet4731:fix/2530-logged-out-after-update

Conversation

@meet4731

@meet4731 meet4731 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Related to #2530

AppAccountsManager reads the saved accounts from the Keychain once, when the shared instance is created at launch, and never reads them again. If that single read returns nothing, for example when the process is started in the background before the device is unlocked after a reboot, the app shows the logged out layout (two tabs, the Add account sheet and the Trending timeline) until it is force quit, even though the account is still in the Keychain.

This change reads the Keychain again when the scene becomes active, but only if no account was found before. When accounts are found, the last used account is restored and the client is rebuilt through the existing path.

Testing, on an iPhone SE (2nd generation) simulator running iOS 27.0: installed this build over a signed in 2.1.4 build with the same bundle identifier, the login carried over. Force quit and relaunch, the login survived. Removed the account items from the simulator Keychain and relaunched, which reproduced the report exactly. Put the items back while the app was running, sent it to the background and back, and the app signed in again without a restart. The same steps on 2.1.4 left the app logged out. Simulator builds use a different Keychain setup from the App Store build (the Keychain access group is only set in Release builds on a device), so the locked device case itself cannot be reproduced in the simulator.

AppAccountsManager read the saved accounts once at launch and never
again, so a single failed read left the app logged out until it was
force quit. Read the Keychain again when the scene becomes active if
no account was found before.

Related to Dimillian#2530
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant