Persists a user-chosen defaultAccountId: String? preference in SettingsRepository/AppSettings, following the existing key/field/setter pattern used for the other settings there.
Adds a "Default account" switch to AccountSettingsScreen.kt (per-account screen) — deliberately not SettingsScreen.kt, which was just restructured and is the target of a separate in-flight ticket (#162), to avoid merge conflicts.
ComposeViewModel's from-account fallback now prefers, in order: an explicit fromAccountId -> the persisted default (only if it still names an existing account) -> the previous incidental available.first() behavior.
Deleting the default account clears the preference (SettingsRepository.clearDefaultAccountId, wired from AccountSettingsViewModel.removeAccount), and the compose fallback independently validates the persisted id against the live account list, so a stale id (e.g. from a Backup restore onto a device that never had that account) can never crash or select a nonexistent account.
New unit tests: SettingsRepositoryTest (default-account persists/clears at the toAppSettings() mapping layer), plus four new ComposeViewModelTest cases covering default-present, stale-default, no-default, and explicit-from-account-wins-over-default.
## Summary
- Persists a user-chosen `defaultAccountId: String?` preference in `SettingsRepository`/`AppSettings`, following the existing key/field/setter pattern used for the other settings there.
- Adds a "Default account" switch to `AccountSettingsScreen.kt` (per-account screen) — deliberately not `SettingsScreen.kt`, which was just restructured and is the target of a separate in-flight ticket (#162), to avoid merge conflicts.
- `ComposeViewModel`'s from-account fallback now prefers, in order: an explicit `fromAccountId` -> the persisted default (only if it still names an existing account) -> the previous incidental `available.first()` behavior.
- Deleting the default account clears the preference (`SettingsRepository.clearDefaultAccountId`, wired from `AccountSettingsViewModel.removeAccount`), and the compose fallback independently validates the persisted id against the live account list, so a stale id (e.g. from a Backup restore onto a device that never had that account) can never crash or select a nonexistent account.
## Test plan
- [x] `assembleDebug`, `testDebugUnitTest`, `lintDebug`, `ktlintCheck`, `detekt`, `compileDebugAndroidTestKotlin` all pass locally (JDK 21).
- [x] New unit tests: `SettingsRepositoryTest` (default-account persists/clears at the `toAppSettings()` mapping layer), plus four new `ComposeViewModelTest` cases covering default-present, stale-default, no-default, and explicit-from-account-wins-over-default.
- [ ] Emulator E2E (left to CI).
Closes #163
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
defaultAccountId: String?preference inSettingsRepository/AppSettings, following the existing key/field/setter pattern used for the other settings there.AccountSettingsScreen.kt(per-account screen) — deliberately notSettingsScreen.kt, which was just restructured and is the target of a separate in-flight ticket (#162), to avoid merge conflicts.ComposeViewModel's from-account fallback now prefers, in order: an explicitfromAccountId-> the persisted default (only if it still names an existing account) -> the previous incidentalavailable.first()behavior.SettingsRepository.clearDefaultAccountId, wired fromAccountSettingsViewModel.removeAccount), and the compose fallback independently validates the persisted id against the live account list, so a stale id (e.g. from a Backup restore onto a device that never had that account) can never crash or select a nonexistent account.Test plan
assembleDebug,testDebugUnitTest,lintDebug,ktlintCheck,detekt,compileDebugAndroidTestKotlinall pass locally (JDK 21).SettingsRepositoryTest(default-account persists/clears at thetoAppSettings()mapping layer), plus four newComposeViewModelTestcases covering default-present, stale-default, no-default, and explicit-from-account-wins-over-default.Closes #163
🤖 Generated with Claude Code