diff --git a/library/ui-strings/src/main/res/values/donottranslate.xml b/library/ui-strings/src/main/res/values/donottranslate.xml
index bfe751ef5a..910ce31c41 100755
--- a/library/ui-strings/src/main/res/values/donottranslate.xml
+++ b/library/ui-strings/src/main/res/values/donottranslate.xml
@@ -10,6 +10,8 @@
Cut the slack from teams.
+ Crash the application.
+
© MapTiler © OpenStreetMap contributors
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 324029c45b..b112751f68 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
@@ -32,6 +32,7 @@ enum class Command(
val isDevCommand: Boolean,
val isThreadCommand: Boolean
) {
+ CRASH_APP("/crash", null, "", R.string.command_description_crash_application, true, true),
EMOTE("/me", null, "", R.string.command_description_emote, false, true),
BAN_USER("/ban", null, " [reason]", R.string.command_description_ban_user, false, false),
UNBAN_USER("/unban", null, " [reason]", R.string.command_description_unban_user, false, false),
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 e08bc9fb64..298387c324 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
@@ -20,13 +20,16 @@ import im.vector.app.core.extensions.isEmail
import im.vector.app.core.extensions.isMsisdn
import im.vector.app.core.extensions.orEmpty
import im.vector.app.features.home.room.detail.ChatEffect
+import im.vector.app.features.settings.VectorPreferences
import org.matrix.android.sdk.api.MatrixPatterns
import org.matrix.android.sdk.api.MatrixUrls.isMxcUrl
import org.matrix.android.sdk.api.session.identity.ThreePid
import timber.log.Timber
import javax.inject.Inject
-class CommandParser @Inject constructor() {
+class CommandParser @Inject constructor(
+ private val vectorPreferences: VectorPreferences
+) {
/**
* Convert the text message into a Slash command.
@@ -404,6 +407,9 @@ class CommandParser @Inject constructor() {
ParsedCommand.ErrorSyntax(Command.UPGRADE_ROOM)
}
}
+ Command.CRASH_APP.matches(slashCommand) && vectorPreferences.developerMode() -> {
+ throw RuntimeException("Application crashed from user demand")
+ }
else -> {
// Unknown command
ParsedCommand.ErrorUnknownSlashCommand(slashCommand)