diff --git a/changelog.d/12.misc b/changelog.d/12.misc new file mode 100644 index 0000000000..392d7b1122 --- /dev/null +++ b/changelog.d/12.misc @@ -0,0 +1 @@ +Add support for `/tableflip` command \ No newline at end of file diff --git a/library/ui-strings/src/main/res/values/strings.xml b/library/ui-strings/src/main/res/values/strings.xml index d8f6222acf..0d8b996645 100644 --- a/library/ui-strings/src/main/res/values/strings.xml +++ b/library/ui-strings/src/main/res/values/strings.xml @@ -2220,6 +2220,7 @@ Prepends ¯\\_(ツ)_/¯ to a plain-text message Prepends ( ͡° ͜ʖ ͡°) to a plain-text message + Prepends (╯°□°)╯︵ ┻━┻ to a plain-text message "Enable encryption" "Once enabled, encryption cannot be disabled." diff --git a/vector/src/main/java/im/vector/app/features/command/Command.kt b/vector/src/main/java/im/vector/app/features/command/Command.kt index 433ee32eeb..324029c45b 100644 --- a/vector/src/main/java/im/vector/app/features/command/Command.kt +++ b/vector/src/main/java/im/vector/app/features/command/Command.kt @@ -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, "", 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, "", R.string.command_description_table_flip, false, true); val allAliases = arrayOf(command, *aliases.orEmpty()) diff --git a/vector/src/main/java/im/vector/app/features/command/CommandParser.kt b/vector/src/main/java/im/vector/app/features/command/CommandParser.kt index 9cbb6c7978..81950fe86c 100644 --- a/vector/src/main/java/im/vector/app/features/command/CommandParser.kt +++ b/vector/src/main/java/im/vector/app/features/command/CommandParser.kt @@ -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 diff --git a/vector/src/main/java/im/vector/app/features/command/ParsedCommand.kt b/vector/src/main/java/im/vector/app/features/command/ParsedCommand.kt index eba9994218..eee786253b 100644 --- a/vector/src/main/java/im/vector/app/features/command/ParsedCommand.kt +++ b/vector/src/main/java/im/vector/app/features/command/ParsedCommand.kt @@ -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 diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerViewModel.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerViewModel.kt index 30e45bd40b..f9bf244eb1 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerViewModel.kt @@ -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))