mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 11:59:12 +03:00
Add support for /tableflip
command (#12)
Signed-off-by: Prat T <pt2121@users.noreply.github.com>
This commit is contained in:
parent
d0bff7495d
commit
3f9b9827bd
6 changed files with 13 additions and 1 deletions
1
changelog.d/12.misc
Normal file
1
changelog.d/12.misc
Normal file
|
@ -0,0 +1 @@
|
|||
Add support for `/tableflip` command
|
|
@ -2220,6 +2220,7 @@
|
|||
|
||||
<string name="command_description_shrug">Prepends ¯\\_(ツ)_/¯ to a plain-text message</string>
|
||||
<string name="command_description_lenny">Prepends ( ͡° ͜ʖ ͡°) to a plain-text message</string>
|
||||
<string name="command_description_table_flip">Prepends (╯°□°)╯︵ ┻━┻ to a plain-text message</string>
|
||||
|
||||
<string name="create_room_encryption_title">"Enable encryption"</string>
|
||||
<string name="create_room_encryption_description">"Once enabled, encryption cannot be disabled."</string>
|
||||
|
|
|
@ -66,7 +66,8 @@ enum class Command(
|
|||
ADD_TO_SPACE("/addToSpace", null, "spaceId", R.string.command_description_add_to_space, true, false),
|
||||
JOIN_SPACE("/joinSpace", null, "spaceId", R.string.command_description_join_space, true, false),
|
||||
LEAVE_ROOM("/leave", null, "<roomId?>", R.string.command_description_leave_room, true, false),
|
||||
UPGRADE_ROOM("/upgraderoom", null, "newVersion", R.string.command_description_upgrade_room, true, false);
|
||||
UPGRADE_ROOM("/upgraderoom", null, "newVersion", R.string.command_description_upgrade_room, true, false),
|
||||
TABLE_FLIP("/tableflip", null, "<message>", R.string.command_description_table_flip, false, true);
|
||||
|
||||
val allAliases = arrayOf(command, *aliases.orEmpty())
|
||||
|
||||
|
|
|
@ -344,6 +344,9 @@ class CommandParser @Inject constructor() {
|
|||
Command.LENNY.matches(slashCommand) -> {
|
||||
ParsedCommand.SendLenny(message)
|
||||
}
|
||||
Command.TABLE_FLIP.matches(slashCommand) -> {
|
||||
ParsedCommand.SendTableFlip(message)
|
||||
}
|
||||
Command.DISCARD_SESSION.matches(slashCommand) -> {
|
||||
if (messageParts.size == 1) {
|
||||
ParsedCommand.DiscardSession
|
||||
|
|
|
@ -63,6 +63,7 @@ sealed interface ParsedCommand {
|
|||
object DevTools : ParsedCommand
|
||||
data class SendSpoiler(val message: String) : ParsedCommand
|
||||
data class SendShrug(val message: CharSequence) : ParsedCommand
|
||||
data class SendTableFlip(val message: CharSequence) : ParsedCommand
|
||||
data class SendLenny(val message: CharSequence) : ParsedCommand
|
||||
object DiscardSession : ParsedCommand
|
||||
data class ShowUser(val userId: String) : ParsedCommand
|
||||
|
|
|
@ -366,6 +366,11 @@ class MessageComposerViewModel @AssistedInject constructor(
|
|||
_viewEvents.post(MessageComposerViewEvents.SlashCommandResultOk(parsedCommand))
|
||||
popDraft()
|
||||
}
|
||||
is ParsedCommand.SendTableFlip -> {
|
||||
sendPrefixedMessage("(╯°□°)╯︵ ┻━┻", parsedCommand.message, state.rootThreadEventId)
|
||||
_viewEvents.post(MessageComposerViewEvents.SlashCommandResultOk(parsedCommand))
|
||||
popDraft()
|
||||
}
|
||||
is ParsedCommand.SendChatEffect -> {
|
||||
sendChatEffect(parsedCommand)
|
||||
_viewEvents.post(MessageComposerViewEvents.SlashCommandResultOk(parsedCommand))
|
||||
|
|
Loading…
Reference in a new issue