mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-04-29 22:24:35 +02:00
feat(core): double tap custom emoji reaction
Signed-off-by: rhunk <101876869+rhunk@users.noreply.github.com>
This commit is contained in:
parent
5fc415d56c
commit
7ded784d8c
@ -746,6 +746,10 @@
|
||||
"double_tap_chat_action": {
|
||||
"name": "Double Tap Chat Action",
|
||||
"description": "Performs a custom action when double tapping a message in chat"
|
||||
},
|
||||
"double_tap_chat_action_custom_emoji": {
|
||||
"name": "Double Tap Chat Action Custom Emoji Reaction",
|
||||
"description": "Sets a custom emoji reaction for the double tap chat action"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -1393,7 +1397,8 @@
|
||||
"like_message": "Like Message",
|
||||
"copy_text": "Copy Text to Clipboard",
|
||||
"delete_message": "Delete Message",
|
||||
"mark_as_read": "Mark as Read"
|
||||
"mark_as_read": "Mark as Read",
|
||||
"custom_emoji_reaction": "Custom Emoji Reaction"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -98,5 +98,7 @@ class MessagingTweaks : ConfigContainer() {
|
||||
val bypassMessageRetentionPolicy = boolean("bypass_message_retention_policy") { addNotices(FeatureNotice.UNSTABLE); requireRestart() }
|
||||
val bypassMessageActionRestrictions = boolean("bypass_message_action_restrictions") { requireRestart() }
|
||||
val removeGroupsLockedStatus = boolean("remove_groups_locked_status") { requireRestart() }
|
||||
val doubleTapChatAction = unique("double_tap_chat_action", "like_message", "copy_text", "delete_message", "mark_as_read") { requireRestart() }
|
||||
val doubleTapChatAction = unique("double_tap_chat_action", "like_message", "copy_text", "delete_message", "mark_as_read", "custom_emoji_reaction") { requireRestart() }
|
||||
val doubleTapChatActionCustomEmoji = string("double_tap_chat_action_custom_emoji") {
|
||||
inputCheck = { it.length == 2 && it.toByteArray(Charsets.UTF_8).size >= 4 } }
|
||||
}
|
@ -50,6 +50,16 @@ class DoubleTapChatAction: Feature("Double Tap Chat Action") {
|
||||
onResult = {}
|
||||
)
|
||||
}
|
||||
|
||||
if (action == "custom_emoji_reaction") {
|
||||
context.feature(Messaging::class).conversationManager?.reactToMessage(
|
||||
conversationId,
|
||||
messageId,
|
||||
emoji = context.config.messaging.doubleTapChatActionCustomEmoji.getNullable()?.takeIf { it.isNotEmpty() } ?: "\uD83D\uDC4D",
|
||||
onError = {},
|
||||
onSuccess = {}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user