Clear album selections when toggling home or lock screens
When user changes which screens are enabled (homeEnabled/lockEnabled), clear all album selections to ensure clean state: **Scenarios where albums are cleared:** - Lock only → Both screens enabled - Home only → Both screens enabled - Both screens → Lock only - Both screens → Home only - Lock only → Home only (both toggles change) **Why this is needed:** - Album requirements change when switching between single/dual screen modes - Both screens enabled requires TWO albums selected - Single screen requires ONE album selected - Clearing prevents invalid state where old selections don't match new requirements **Implementation:** - Detect when homeEnabled or lockEnabled changes in updateScheduleSettings() - If screen toggles changed, clear both homeAlbumId and lockAlbumId - Apply validation to cleared settings - Auto-toggle logic will disable changer (no albums selected) - User must select appropriate albums for new screen configuration **User flow:** 1. User toggles screen on/off 2. Albums automatically cleared 3. Changer disabled (no albums) 4. User selects new albums 5. Changer re-enabled with correct albums This ensures users always have the correct album setup for their chosen screen configuration. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
1006902d07
commit
894b86cd14
2 files changed
+608
-2
No files matched your search
+16
-2
@@ -262,11 +262,25 @@ class HomeViewModel @Inject constructor(
|
||||
|
||||
fun updateScheduleSettings(settings: ScheduleSettings) {
|
||||
viewModelScope.launch {
|
||||
// Check if shuffle setting has changed before validation
|
||||
// Check if settings have changed before validation
|
||||
val currentSettings = settingsRepository.getScheduleSettings()
|
||||
val shuffleChanged = currentSettings.shuffleEnabled != settings.shuffleEnabled
|
||||
|
||||
val validated = settings.validate()
|
||||
// Check if screen toggles (homeEnabled/lockEnabled) have changed
|
||||
val screenToggleChanged = currentSettings.homeEnabled != settings.homeEnabled ||
|
||||
currentSettings.lockEnabled != settings.lockEnabled
|
||||
|
||||
// If screen toggles changed, clear all album selections
|
||||
val settingsWithClearedAlbums = if (screenToggleChanged) {
|
||||
settings.copy(
|
||||
homeAlbumId = null,
|
||||
lockAlbumId = null
|
||||
)
|
||||
} else {
|
||||
settings
|
||||
}
|
||||
|
||||
val validated = settingsWithClearedAlbums.validate()
|
||||
|
||||
// Check what changed
|
||||
val schedulingChanged = validated.hasSchedulingChanges(currentSettings)
|
||||
|
||||
Reference in new issue
Block a user