Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions app/src/processing/app/ui/PDEPreferences.kt
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ private val LocalModifiablePreferences =
compositionLocalOf { ModifiablePreference(null, false, { }, {}) }

/**
* Composable function that provides a modifiable copy of the current preferences.
* Composable function that captures an initial copy of the current preferences.
* This allows for temporary changes to preferences that can be reset or applied later.
*
* @param content The composable content that will have access to the modifiable preferences.
Expand Down Expand Up @@ -498,13 +498,13 @@ private fun CapturePreferences(content: @Composable () -> Unit) {
}

val apply = {
modified.entries.forEach { (key, value) ->
prefs.setProperty(key as String, (value ?: "") as String)
prefs.entries.forEach { (key, value) ->
modified.setProperty(key as String, (value ?: "") as String)
}
}
val reset = {
modified.entries.forEach { (key, value) ->
modified.setProperty(key as String, prefs[key] ?: "")
prefs.setProperty(key as String, modified[key] ?: "")
}
}
val state = ModifiablePreference(
Expand All @@ -515,7 +515,6 @@ private fun CapturePreferences(content: @Composable () -> Unit) {
)

CompositionLocalProvider(
LocalPreferences provides modified,
LocalModifiablePreferences provides state
) {
content()
Expand Down