From 5841ca652ca213e96c70028d973896116af7ce59 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 20 May 2026 14:13:03 +0000 Subject: [PATCH] fix: surface Pay row in Reaction Settings for existing accounts Accounts whose reactionRowItems were persisted before ReactionRowAction.Pay existed still load a 5-item list, so Pay never appears in Reaction Settings. Add mergeWithDefaultReactionRowItems mirroring mergeWithDefaultVideoPlayerButtons and apply it where reaction rows enter the StateFlow (constructor + updateFrom), appending any default actions missing from the saved list while preserving the user's existing order and toggles. --- .../amethyst/model/AccountSyncedSettings.kt | 5 +++-- .../amethyst/model/AccountSyncedSettingsInternal.kt | 10 ++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSyncedSettings.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSyncedSettings.kt index ceafd6bcaf..ca5b08b360 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSyncedSettings.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSyncedSettings.kt @@ -35,7 +35,7 @@ class AccountSyncedSettings( val reactions = AccountReactionPreferences( MutableStateFlow(internalSettings.reactions.reactionChoices.toImmutableList()), - MutableStateFlow(internalSettings.reactions.reactionRowItems.toImmutableList()), + MutableStateFlow(mergeWithDefaultReactionRowItems(internalSettings.reactions.reactionRowItems).toImmutableList()), ) val zaps = AccountZapPreferences( @@ -96,7 +96,8 @@ class AccountSyncedSettings( reactions.reactionChoices.tryEmit(newReactionChoices) } - val newReactionRowItems = syncedSettingsInternal.reactions.reactionRowItems.toImmutableList() + val newReactionRowItems = + mergeWithDefaultReactionRowItems(syncedSettingsInternal.reactions.reactionRowItems).toImmutableList() if (!equalImmutableLists(reactions.reactionRowItems.value, newReactionRowItems)) { reactions.reactionRowItems.tryEmit(newReactionRowItems) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSyncedSettingsInternal.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSyncedSettingsInternal.kt index 43ff7059dc..29ebf1bbc4 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSyncedSettingsInternal.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSyncedSettingsInternal.kt @@ -67,6 +67,16 @@ val DefaultReactionRowItems = ReactionRowItem(ReactionRowAction.Share, showCounter = false), ) +// Existing accounts have a reaction-row list serialized before some actions +// existed (e.g. Pay was added later). Append any default items the saved list +// is missing so new actions surface without forcing a settings reset — the +// user's existing order/toggles for actions they already have are preserved. +fun mergeWithDefaultReactionRowItems(saved: List): List { + val knownActions = saved.mapTo(mutableSetOf()) { it.action } + val missing = DefaultReactionRowItems.filter { it.action !in knownActions } + return if (missing.isEmpty()) saved else saved + missing +} + @Serializable enum class VideoPlayerAction { Fullscreen,