mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-25 19:29:54 +01:00
Fix editing custom reactions.
This commit is contained in:
committed by
Greyson Parrelli
parent
8be946e43f
commit
f65cebdada
@@ -27,9 +27,7 @@ class EditReactionsViewModel : ViewModel() {
|
||||
fun onEmojiSelected(emoji: String) {
|
||||
store.update { state ->
|
||||
if (state.selection != NO_SELECTION && state.selection in state.reactions.indices) {
|
||||
if (emoji != EmojiUtil.getCanonicalRepresentation(emoji)) {
|
||||
emojiValues.setPreferredVariation(emoji)
|
||||
}
|
||||
emojiValues.setPreferredVariation(emoji)
|
||||
val preferredEmoji: String = emojiValues.getPreferredVariation(emoji)
|
||||
val newReactions: List<String> = state.reactions.toMutableList().apply { set(state.selection, preferredEmoji) }
|
||||
state.copy(reactions = newReactions)
|
||||
@@ -40,6 +38,10 @@ class EditReactionsViewModel : ViewModel() {
|
||||
}
|
||||
|
||||
fun resetToDefaults() {
|
||||
EmojiValues.DEFAULT_REACTIONS_LIST.forEach { emoji ->
|
||||
emojiValues.removePreferredVariation(EmojiUtil.getCanonicalRepresentation(emoji))
|
||||
}
|
||||
|
||||
store.update { it.copy(reactions = EmojiValues.DEFAULT_REACTIONS_LIST) }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user