mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-08 23:54:39 +00:00
Merge pull request #3009 from greenart7c3/claude/fix-reaction-payment-targets-UhsYP
fix: surface Pay row in Reaction Settings for existing accounts
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
+10
@@ -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<ReactionRowItem>): List<ReactionRowItem> {
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user