fix(sync): exclude device-local UI preferences from cloud settings sync

This commit is contained in:
Murilo Scolari 2026-10-24 23:49:46 -03:00
parent e3ce0b331e
commit 11d9aa5c6b

View file

@ -381,8 +381,8 @@ internal class SyncPayloadStore(
private suspend fun collectCurrentSnapshot(): Map<String, String> {
val snapshot = linkedMapOf<String, String>()
// Settings
val settingsBundle = loginSyncStore.bundleSettings(SettingsCategory.entries.toSet())
// Settings (excluding device-specific UI preferences: nowPlayingStyle, lyricsStyle, liquidGlassEnabled)
val settingsBundle = loginSyncStore.bundleSettings(SettingsCategory.entries.toSet()).stripDeviceLocalAppearance()
snapshot["$TYPE_SETTINGS:$ID_SETTINGS"] = loginSyncJson.encodeToString(settingsBundle)
// Accounts
@ -536,9 +536,9 @@ internal class SyncPayloadStore(
): String? {
return when (entityType) {
TYPE_SETTINGS -> {
val bundle = loginSyncJson.decodeFromString<SettingsBundle>(payloadText)
val bundle = loginSyncJson.decodeFromString<SettingsBundle>(payloadText).stripDeviceLocalAppearance()
loginSyncStore.restoreSettings(bundle)
val current = loginSyncStore.bundleSettings(SettingsCategory.entries.toSet())
val current = loginSyncStore.bundleSettings(SettingsCategory.entries.toSet()).stripDeviceLocalAppearance()
loginSyncJson.encodeToString(current)
}
TYPE_ACCOUNTS -> {
@ -828,3 +828,16 @@ private fun SyncSongWire.toEntity(existing: SongEntity?, mergedPlayTime: Long) =
canvasUrl = canvasUrl ?: existing?.canvasUrl,
canvasThumbUrl = canvasThumbUrl ?: existing?.canvasThumbUrl,
)
/**
* Strips device-local UI preferences (`nowPlayingStyle`, `lyricsStyle`, `liquidGlassEnabled`)
* so each device keeps its own player layout and visual effects.
*/
private fun SettingsBundle.stripDeviceLocalAppearance(): SettingsBundle =
copy(
appearance = appearance?.copy(
nowPlayingStyle = null,
lyricsStyle = null,
liquidGlassEnabled = null,
),
)