Repository navigation
Commit 8a5fd5a
committed
fix(ui): keep screens up when their data can't be read
Every screen's state came from stateIn on viewModelScope, which has no
exception handler. A Room or DataStore flow that threw while a screen
collected it (a dropped table, an unreadable settings file) ended there
and closed the app.
All 90 of them now go through one screenState helper that logs the
error and keeps what the screen last showed, or its initial value when
the first read fails. onboardingDone can't stay on its null, which
draws a blank surface until settings load, so a failed read there shows
the app instead.
Two tests added to ViewModelActionFailureTest: a dropped call_log table
under totalBlocked, and an unreadable settings file under
onboardingDone. IsolatedRepositoryFixture gains an unreadableSettings
option for the second one. No existing test was wrong. Both new tests
fail without the catches, and a catch that logs and rethrows fails the
trailing runTest with UncaughtExceptionsBeforeTest.1 parent 2dd8969 commit 8a5fd5a
5 files changed
Lines changed: 184 additions & 111 deletions
File tree
- app/src
- main/java/com/sysadmindoc/callshield/ui
- test/java/com/sysadmindoc/callshield
- data
- ui
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
592 | 592 | | |
593 | 593 | | |
594 | 594 | | |
595 | | - | |
| 595 | + | |
596 | 596 | | |
597 | 597 | | |
598 | 598 | | |
599 | 599 | | |
600 | | - | |
| 600 | + | |
601 | 601 | | |
602 | 602 | | |
603 | 603 | | |
| |||
634 | 634 | | |
635 | 635 | | |
636 | 636 | | |
637 | | - | |
| 637 | + | |
638 | 638 | | |
639 | 639 | | |
640 | 640 | | |
| |||
0 commit comments