Fix screen effects profile synchronization

This commit is contained in:
EnzoDLofi committed 2026-11-13 22:16:13 -04:00
1 parent 2c3c03a429
commit 5a4b9cd8bb
1 file changed
+37 -10
@@ -988,9 +988,14 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
val activeEffectsProfileId = currentScreenEffectsProfileId() val activeEffectsProfileId = currentScreenEffectsProfileId()
val effectsEditorProfileId = if (drawerOpen) activeEffectsProfileId else null val effectsEditorProfileId = if (drawerOpen) activeEffectsProfileId else null
androidx.compose.runtime.LaunchedEffect(effectsEditorProfileId) { androidx.compose.runtime.LaunchedEffect(effectsEditorProfileId) {
if (effectsEditorProfileId != null && if (effectsEditorProfileId != null) {
SessionPrefs.activeScreenEffectsProfileId(this@SessionActivity) == effectsEditorProfileId) { val activeProfileId =
effects = SessionPrefs.screenEffects(this@SessionActivity, effectsEditorProfileId) SessionPrefs.activeScreenEffectsProfileId(this@SessionActivity)
observedScreenEffectsProfileId = activeProfileId
val activeEffects =
SessionPrefs.screenEffects(this@SessionActivity, activeProfileId)
effects = activeEffects
activeEffects.push(upscaler)
} }
} }
val uiPointer = appUiOwnsPointer() val uiPointer = appUiOwnsPointer()
@@ -1360,10 +1365,27 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
}, },
onEffects = { e -> onEffects = { e ->
if ((drawerOpen || (docked && drawerPinned)) && if ((drawerOpen || (docked && drawerPinned)) &&
SessionPrefs.activeScreenEffectsProfileId(this@SessionActivity) == effectsEditorProfileId) { effectsEditorProfileId != null) {
SessionPrefs.setScreenEffects(this@SessionActivity, effectsEditorProfileId, e) val activeProfileId =
effects = e SessionPrefs.activeScreenEffectsProfileId(this@SessionActivity)
e.push(upscaler)
if (activeProfileId != null) {
if (activeProfileId != effectsEditorProfileId) {
Log.w(
TAG,
"Screen effects profile changed while editing; saving to active profile",
)
}
SessionPrefs.setScreenEffects(
this@SessionActivity,
activeProfileId,
e,
)
observedScreenEffectsProfileId = activeProfileId
effects = e
e.push(upscaler)
}
} }
}, },
onTextureAnisotropy = { value -> onTextureAnisotropy = { value ->
@@ -3781,9 +3803,14 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
val effectsEditorProfileId = val effectsEditorProfileId =
if (drawerOpen || drawerPinned) activeEffectsProfileId else null if (drawerOpen || drawerPinned) activeEffectsProfileId else null
androidx.compose.runtime.LaunchedEffect(effectsEditorProfileId) { androidx.compose.runtime.LaunchedEffect(effectsEditorProfileId) {
if (effectsEditorProfileId != null && if (effectsEditorProfileId != null) {
SessionPrefs.activeScreenEffectsProfileId(this@SessionActivity) == effectsEditorProfileId) { val activeProfileId =
effects = SessionPrefs.screenEffects(this@SessionActivity, effectsEditorProfileId) SessionPrefs.activeScreenEffectsProfileId(this@SessionActivity)
observedScreenEffectsProfileId = activeProfileId
val activeEffects =
SessionPrefs.screenEffects(this@SessionActivity, activeProfileId)
effects = activeEffects
activeEffects.push(upscaler)
} }
} }
SessionMenu(docked = true, effectsEditorProfileId = effectsEditorProfileId) SessionMenu(docked = true, effectsEditorProfileId = effectsEditorProfileId)