:library:feature:advanced
Purpose
Owns the advanced settings page: the bug report entry, clearing the app's cache, and the developer options entry once it is unlocked.
Owns
Feature event builders and their bounded keys in
ui/analytics; screens only report events.AdvancedSettingsScreen, which wires the ViewModel, tracking, messages, the issue reporter sheet and navigation, andAdvancedSettingsScreenContent, the stateless list of rows.AdvancedSettingsViewModel,AdvancedSettingsUiState,CacheClearStatusandAdvancedSettingsEvent.CacheRepositoryandDefaultCacheRepository, which delete the app's cache directories.advancedSettingsPage(), the registration ofAdvancedSettingsRouteas a detail of the settings list, andadvancedSettingsModule.Its clear cache row in the settings search, a
settingsSearchProviderbound asadvanced.The page's localized strings, including the cache confirmation and failure texts.
Does not own
The issue reporter sheet. It is the
IssueReporterSheetcontract of:library:core:ui, bound by:library:feature:issuereporter.The developer options page, owned by
:library:feature:developer. This page opensDeveloperOptionsRouteby key.The easter egg unlock, stored by
SeasonalThemeRepositoryin:library:core:datastoreand recorded by:library:feature:about.The settings list whose row opens this page, owned by
:library:feature:settings.
Depends on
:library:core:commonand:library:core:ui, and through:library:core:uithe keys of:library:navigationandstorageCallandSeasonalThemeRepositoryof:library:core:datastore.No other feature module. The feature asks nothing of its host: the removed
AdvancedSettingsProviderexisted only to supply a bug-report URL, which the list stopped using once the issue reporter began submitting reports itself.
Used by
:library:apptoolkit, which callsadvancedSettingsPage()fromtoolkitPages()and assemblesadvancedSettingsModule.
Flow chart
flowchart TD
Page[advancedSettingsPage: AdvancedSettingsRoute] --> Screen[AdvancedSettingsScreen]
Screen --> Content[AdvancedSettingsScreenContent]
Content -->|bug report row| Sheet[IssueReporterSheet from Koin]
Content -->|clear cache row| Clear[AdvancedSettingsEvent.ClearCache]
Clear --> VM[AdvancedSettingsViewModel]
VM --> Repo[CacheRepository: delete cache directories on IO]
Repo -->|done or StorageException| VM
VM --> Message[UiMessage: cleared, or the failure text]
Message --> Host[MessageHost]
Unlock[SeasonalThemeRepository unlock] --> VM
Content -->|developer options row| Developer[navigator.navigate: DeveloperOptionsRoute]Architectural decisions
The page is on
core.ui.screen. Its rows are there from the start, so nothing inAdvancedSettingsUiStateis aLoadable.cacheClearis aCacheClearStatus, aTrackedStatuswhose labels are the ones the page has always reported inscreen_state:successwhile idle,loadingwhile clearing anderrorafter a failed clear.A clear confirms with a snackbar, and a failure shows an error snackbar while the rows stay. The failure text comes from
toErrorMessage, so full or busy storage shows its own text and anything else shows "Cache cleared with some errors".CacheRepository.clearCache()is a main-safe suspend function that throws aStorageException:FAILEDwhen a directory was not fully deleted,UNAVAILABLEwhen the system refused access to one.DefaultCacheRepositoryruns the blocking recursive delete on the injected IO dispatcher, so the ViewModel takes no dispatcher. It logs an incomplete delete as a breadcrumb, since only it can see how many directories were left.The bug report row shows the
IssueReporterSheetresolved from Koin withgetOrNull. When no module binds one, the error reporting category is left out. The sheet's visibility is saved, so a rotation does not close it.The developer options row is hidden until the About screen's version easter egg is found. The ViewModel takes that as a
Flow<Boolean>(developerOptionsUnlocked), which the Koin module maps fromSeasonalThemeRepository's unlock, the same flag that keeps the seasonal themes all year, so one discovery unlocks both.There is no domain layer: the ViewModel calls one repository and holds no reusable business rule.
Public contracts
AdvancedSettingsScreen,advancedSettingsPage(),AdvancedSettingsViewModel,AdvancedSettingsUiState,CacheClearStatus,AdvancedSettingsEvent,CacheRepository,DefaultCacheRepositoryandadvancedSettingsModule.AdvancedSettingsScreenContentis internal.
Current risks
Cache deletion is restricted to the app's cache locations (cacheDir, codeCacheDir and externalCacheDir). Changes must keep that scope and keep the file work off the main thread. AdvancedSettingsViewModelTest and DefaultCacheRepositoryTest cover the state and data behavior.