Commit 23c2f7b
committed
fix(ios): retry app startup on lifecycle resume after keychain-locked failure
Production logs showed users hitting the "App Startup Error" / "Contact
support" screen on iOS pre-warmed app spawns. Root cause: AppStartupBloc
fired AppStartupStarted during pre-warm (before first-unlock-since-boot),
CheckForExistingDefaultWalletsUsecase tried to read wallet seeds from
the keychain, the typed KeychainLockedException propagated up to the
bloc's generic catch, and the bloc emitted AppStartupState.failure(...).
That state is sticky — the pre-warmed Flutter engine is reused when the
user finally opens the app post-unlock, so the failure screen persists
until the next cold launch.
Fix: AppStartupBloc now registers as a WidgetsBindingObserver and
catches KeychainLockedException specifically. On that exception it
stays in AppStartupState.loadingInProgress (OnboardingSplash) and sets
_awaitingKeychainUnlock = true. The observer's
didChangeAppLifecycleState(resumed) then re-dispatches AppStartupStarted
— which only fires after the user has unlocked the device since boot,
so the retry's keychain reads succeed and the bloc transitions to
AppStartupSuccess cleanly. Net effect: pre-warmed launches that hit
the locked keychain at boot are invisible to the user; they see the
splash transition straight to the unlock/home flow on first open.
The bloc removes itself as an observer in close() to keep the lifecycle
contract correct if the bloc is ever torn down.1 parent 3340a33 commit 23c2f7b
3 files changed
Lines changed: 52 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
Lines changed: 44 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| |||
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
22 | | - | |
| 25 | + | |
| 26 | + | |
23 | 27 | | |
24 | 28 | | |
25 | 29 | | |
| |||
43 | 47 | | |
44 | 48 | | |
45 | 49 | | |
| 50 | + | |
46 | 51 | | |
47 | 52 | | |
48 | 53 | | |
| |||
56 | 61 | | |
57 | 62 | | |
58 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
59 | 85 | | |
60 | 86 | | |
61 | 87 | | |
| |||
146 | 172 | | |
147 | 173 | | |
148 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
149 | 192 | | |
150 | 193 | | |
151 | 194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
333 | 340 | | |
334 | 341 | | |
335 | 342 | | |
| |||
0 commit comments