| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent aaa3f75 commit 1af2eb7
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -443,7 +443,7 @@ private val LocalModifiablePreferences = | |||
| 443 | 443 | compositionLocalOf { ModifiablePreference(null, false, { }, {}) } | |
| 444 | 444 | ||
| 445 | 445 | /** | |
| 446 | - * Composable function that provides a modifiable copy of the current preferences. | ||
| 446 | + * Composable function that captures an initial copy of the current preferences. | ||
| 447 | 447 | * This allows for temporary changes to preferences that can be reset or applied later. | |
| 448 | 448 | * | |
| 449 | 449 | * @param content The composable content that will have access to the modifiable preferences. | |
@@ -500,13 +500,13 @@ private fun CapturePreferences(content: @Composable () -> Unit) { | |||
| 500 | 500 | } | |
| 501 | 501 | ||
| 502 | 502 | val apply = { | |
| 503 | - modified.entries.forEach { (key, value) -> | ||
| 504 | - prefs.setProperty(key as String, (value ?: "") as String) | ||
| 503 | + prefs.entries.forEach { (key, value) -> | ||
| 504 | + modified.setProperty(key as String, (value ?: "") as String) | ||
| 505 | 505 | } | |
| 506 | 506 | } | |
| 507 | 507 | val reset = { | |
| 508 | 508 | modified.entries.forEach { (key, value) -> | |
| 509 | - modified.setProperty(key as String, prefs[key] ?: "") | ||
| 509 | + prefs.setProperty(key as String, modified[key] ?: "") | ||
| 510 | 510 | } | |
| 511 | 511 | } | |
| 512 | 512 | val state = ModifiablePreference( | |
@@ -517,7 +517,6 @@ private fun CapturePreferences(content: @Composable () -> Unit) { | |||
| 517 | 517 | ) | |
| 518 | 518 | ||
| 519 | 519 | CompositionLocalProvider( | |
| 520 | - LocalPreferences provides modified, | ||
| 521 | 520 | LocalModifiablePreferences provides state | |
| 522 | 521 | ) { | |
| 523 | 522 | content() | |
| Back | FazBrowse Home | New Git URL |
0 commit comments