File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
app/src/main/java/com/phpbg/easysync/ui Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -79,11 +79,22 @@ class AdvancedSyncSettingsViewModel(application: Application) : AndroidViewModel
7979 viewModelScope.launch {
8080 _advancedSyncSettingsUiState .value?.let { uiState ->
8181 val updatedList = uiState.paths.map {
82- it.takeIf { it.relativePath != relativePath }
83- ? : SyncPath (relativePath = it.relativePath, enabled = activated)
82+ // Update enabled status for path and sub-paths
83+ if (it.relativePath.startsWith(relativePath)) {
84+ it.copy(enabled = activated)
85+ } else {
86+ it
87+ }
8488 }
8589 _advancedSyncSettingsUiState .postValue(uiState.copy(paths = updatedList))
86- settingsDataStore.updateExclusionPath(relativePath, ! activated)
90+
91+ // Update settings.exclusionPath
92+ uiState.paths.filter { it.relativePath.startsWith(relativePath) }
93+ .forEach { subPath ->
94+ settingsDataStore.updateExclusionPath(
95+ subPath.relativePath, ! activated
96+ )
97+ }
8798 }
8899 }
89100 }
You can’t perform that action at this time.
0 commit comments