Skip to content

Commit f56cc4c

Browse files
committed
reset view config when matched the default one
1 parent 6b313fc commit f56cc4c

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

app/src/main/java/com/raival/compose/file/explorer/screen/preferences/PreferencesManager.kt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,18 @@ class PreferencesManager {
266266
}
267267

268268
fun setViewConfigPrefsFor(content: ContentHolder, prefs: ViewConfigs) {
269-
runBlocking {
270-
globalClass.prefDataStore.edit {
271-
it[stringPreferencesKey("viewConfigPrefs_${content.uniquePath}")] =
272-
prefs.toJson()
269+
if (prefs == getDefaultViewConfigPrefs()) {
270+
runBlocking {
271+
globalClass.prefDataStore.edit {
272+
it.remove(stringPreferencesKey("viewConfigPrefs_${content.uniquePath}"))
273+
}
274+
}
275+
} else {
276+
runBlocking {
277+
globalClass.prefDataStore.edit {
278+
it[stringPreferencesKey("viewConfigPrefs_${content.uniquePath}")] =
279+
prefs.toJson()
280+
}
273281
}
274282
}
275283
}

0 commit comments

Comments
 (0)