mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 15:50:16 +02:00
Ensure changes are reflected when going back to home page
This commit is contained in:
parent
f592f3081b
commit
9ea407f7f9
2 changed files with 12 additions and 0 deletions
|
|
@ -239,6 +239,15 @@ class HomeSettingsService
|
||||||
currentSettings.update { resolvedSettings }
|
currentSettings.update { resolvedSettings }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun updateCurrent(settings: HomePageSettings) {
|
||||||
|
val resolvedRows =
|
||||||
|
settings.rows.mapIndexed { index, config ->
|
||||||
|
resolve(index, config)
|
||||||
|
}
|
||||||
|
val resolvedSettings = HomePageResolvedSettings(resolvedRows)
|
||||||
|
currentSettings.update { resolvedSettings }
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a default [HomePageResolvedSettings] using the available libraries
|
* Create a default [HomePageResolvedSettings] using the available libraries
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -475,7 +475,10 @@ class HomeSettingsViewModel
|
||||||
// Only save if there are changes
|
// Only save if there are changes
|
||||||
if (local != settings) {
|
if (local != settings) {
|
||||||
homeSettingsService.saveToLocal(user.id, settings)
|
homeSettingsService.saveToLocal(user.id, settings)
|
||||||
|
homeSettingsService.updateCurrent(settings)
|
||||||
showSaveToast()
|
showSaveToast()
|
||||||
|
} else {
|
||||||
|
Timber.d("No changes")
|
||||||
}
|
}
|
||||||
} catch (ex: UnsupportedHomeSettingsVersionException) {
|
} catch (ex: UnsupportedHomeSettingsVersionException) {
|
||||||
Timber.w(ex, "Overwriting local settings")
|
Timber.w(ex, "Overwriting local settings")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue