feat(settings): wire "Use wallpaper colors" switch to AppPreferences#117
Merged
Conversation
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Replaces the local-only `materialYou` placeholder in the Appearance section with a VM-backed, SDK-gated row that mirrors and writes `AppPreferences.useWallpaperColors`. On Android < 12 the switch is disabled with helper text "Requires Android 12 or newer"; on Android 12+ toggling persists through DataStore and the composition root's existing collector re-renders `PyrycodeMobileTheme(dynamicColor=...)` live. Closes #89 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
Author
Code Review: #89Decision: PASS FindingsNo MUST FIX or SHOULD FIX issues.
SummaryImplementation matches the architecture spec exactly. The row is properly VM-driven, the SDK gate uses the M3 |
Documents the VM-backed, SDK-gated Material You switch added to Settings → Appearance. New per-ticket file at codebase/89.md; updates the Settings screen, Settings ViewModel, and App preferences feature docs plus their INDEX summaries to reflect the second persisted preference pair on SettingsViewModel and the second sibling collector on appPreferences.useWallpaperColors. Also fixes the instrumented SettingsScreenTest's two setContent blocks that the developer commit (4089bd2) left calling SettingsScreen without the new required useWallpaperColors / onToggleUseWallpaperColors parameters — compileDebugAndroidTestKotlin was failing. Lesson captured in codebase/89.md. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
materialYouplaceholder row in Settings → Appearance with a VM-backed, SDK-gated switch row bound toAppPreferences.useWallpaperColors.SettingsViewModelwithuseWallpaperColors: StateFlow<Boolean>andonToggleUseWallpaperColors(enabled), mirroring the existingthemeMode/onSelectThemepair line-for-line.17-2per the spec's documented decision: ticket body says "Use wallpaper colors"; Figma still shows the older "Use Material You dynamic color" copy.Issue
Closes #89
Testing
./gradlew :app:testDebugUnitTest— pass. Three new tests inSettingsViewModelTestcovering: initial state when no stored value, initial state mirrors persistedtrue, and a single round-trip test asserting both persistence and flow re-emission on toggle (true then false)../gradlew :app:lintDebug— pass../gradlew :app:assembleDebug— pass../gradlew connectedAndroidTest— not run (no device/emulator connected in this worktree)../gradlew spotlessCheck— pre-existing failures inThemePickerDialog.ktandTheme.kt(both unchanged on this branch and failing onmainalready); my five modified files are clean. Out of scope per CLAUDE.md ("don't refactor adjacent code").Architecture compliance
Implements the spec at
docs/specs/architecture/89-settings-use-wallpaper-colors-switch-row.mdverbatim:StateFlow+ event method withWhileSubscribed(STOP_TIMEOUT_MILLIS)andinitialValue = false.SettingsScreensignature addsuseWallpaperColors: BooleanandonToggleUseWallpaperColors: (Boolean) -> Unitin the order specified (state values, event callbacks, nav callbacks, modifier).Build.VERSION.SDK_INT >= Build.VERSION_CODES.S— noremember.MainActivitysettings route adds the secondcollectAsStateWithLifecycle()and wires both new params; the root-leveldynamicColorcollector at lines 62-63 is untouched.strings.xml; no fakeAppPreferencesintroduced (real DataStore viaTemporaryFolder).SettingsState/SettingsEvent— deferred per the spec's premature-abstraction note.🤖 Generated with Claude Code