From 88a4dfd094a0eeaf793dbadafcee883ebecda996 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 11 Dec 2020 15:31:28 +0100 Subject: [PATCH 1/3] Ensure the message is understood as a debug indication (#2509) --- .../home/room/detail/timeline/format/NoticeEventFormatter.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/format/NoticeEventFormatter.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/format/NoticeEventFormatter.kt index 9b828e9410..c725f5b7dc 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/format/NoticeEventFormatter.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/format/NoticeEventFormatter.kt @@ -182,8 +182,8 @@ class NoticeEventFormatter @Inject constructor( } } - private fun formatDebug(event: Event): CharSequence? { - return "{ \"type\": ${event.getClearType()} }" + private fun formatDebug(event: Event): CharSequence { + return "Debug: event type \"${event.getClearType()}\"" } private fun formatRoomCreateEvent(event: Event, rs: RoomSummary?): CharSequence? { From 6ddcd046d4f0ece7c0a4771388f344cbda9e526b Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 14 Dec 2020 16:48:06 +0100 Subject: [PATCH 2/3] Import SAS strings --- .../src/main/res/values-bg/strings_sas.xml | 68 +++++++++++++++++++ .../src/main/res/values-ca/strings_sas.xml | 68 +++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 matrix-sdk-android/src/main/res/values-bg/strings_sas.xml create mode 100644 matrix-sdk-android/src/main/res/values-ca/strings_sas.xml diff --git a/matrix-sdk-android/src/main/res/values-bg/strings_sas.xml b/matrix-sdk-android/src/main/res/values-bg/strings_sas.xml new file mode 100644 index 0000000000..e2ee9faefc --- /dev/null +++ b/matrix-sdk-android/src/main/res/values-bg/strings_sas.xml @@ -0,0 +1,68 @@ + + + + Куче + Котка + Лъв + Кон + Еднорог + Прасе + Слон + Заек + Панда + Петел + Пингвин + Костенурка + Риба + Октопод + Пеперуда + Цвете + Дърво + Кактус + Гъба + Глобус + Луна + Облак + Огън + Банан + Ябълка + Ягода + Царевица + Пица + Торта + Сърце + Усмивка + Робот + Шапка + Очила + Гаечен ключ + Дядо Коледа + Палец нагоре + Чадър + Пясъчен часовник + Часовник + Подарък + Лампа + Книга + Молив + Кламер + Ножици + Катинар + Ключ + Чук + Телефон + Флаг + Влак + Колело + Самолет + Ракета + Трофей + Топка + Китара + Тромпет + Звънец + Котва + Слушалки + Папка + Кабърче + diff --git a/matrix-sdk-android/src/main/res/values-ca/strings_sas.xml b/matrix-sdk-android/src/main/res/values-ca/strings_sas.xml new file mode 100644 index 0000000000..acc0dcbc72 --- /dev/null +++ b/matrix-sdk-android/src/main/res/values-ca/strings_sas.xml @@ -0,0 +1,68 @@ + + + + Gos + Gat + Lleó + Cavall + Unicorn + Porc + Elefant + Conill + Panda + Gall + Pingüí + Tortuga + Peix + Pop + Papallona + Flor + Arbre + Cactus + Bolet + Globus terraqüi + Lluna + Núvol + Foc + Plàtan + Poma + Maduixa + Blat de moro + Pizza + Pastís + Cor + Somrient + Robot + Barret + Ulleres + Clau anglesa + Pare Noél + Polzes amunt + Paraigües + Rellotge de sorra + Rellotge + Regal + Bombeta + Llibre + Llapis + Clip + Tisores + Cadenat + Clau + Martell + Telèfon + Bandera + Tren + Bicicleta + Avió + Coet + Trofeu + Pilota + Guitarra + Trompeta + Campana + Àncora + Auriculars + Carpeta + Xinxeta + From bb9a08d4296c4303f74b3f54e4793cc6e9f03161 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 15 Dec 2020 12:18:41 +0100 Subject: [PATCH 3/3] /confetti /snow commands: send emote if text is blank (iso Element Web) --- .../home/room/detail/ChatEffectManager.kt | 1 + .../home/room/detail/RoomDetailViewModel.kt | 15 ++++++++++++++- vector/src/main/res/values/strings.xml | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/ChatEffectManager.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/ChatEffectManager.kt index ee663b9bbd..e7136762d5 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/ChatEffectManager.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/ChatEffectManager.kt @@ -113,6 +113,7 @@ class ChatEffectManager @Inject constructor() { return when (content.msgType) { MessageType.MSGTYPE_CONFETTI -> ChatEffect.CONFETTI MessageType.MSGTYPE_SNOW -> ChatEffect.SNOW + MessageType.MSGTYPE_EMOTE, MessageType.MSGTYPE_TEXT -> { event.root.getClearContent().toModel()?.body ?.let { text -> diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt index d34d01080e..e4e7177e4f 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt @@ -716,7 +716,7 @@ class RoomDetailViewModel @AssistedInject constructor( popDraft() } is ParsedCommand.SendChatEffect -> { - room.sendTextMessage(slashCommandResult.message, slashCommandResult.chatEffect.toMessageType()) + sendChatEffect(slashCommandResult) _viewEvents.post(RoomDetailViewEvents.SlashCommandHandled()) popDraft() } @@ -808,6 +808,19 @@ class RoomDetailViewModel @AssistedInject constructor( } } + private fun sendChatEffect(sendChatEffect: ParsedCommand.SendChatEffect) { + // If message is blank, convert to an emote, with default message + if (sendChatEffect.message.isBlank()) { + val defaultMessage = stringProvider.getString(when (sendChatEffect.chatEffect) { + ChatEffect.CONFETTI -> R.string.default_message_emote_confetti + ChatEffect.SNOW -> R.string.default_message_emote_snow + }) + room.sendTextMessage(defaultMessage, MessageType.MSGTYPE_EMOTE) + } else { + room.sendTextMessage(sendChatEffect.message, sendChatEffect.chatEffect.toMessageType()) + } + } + private fun popDraft() = withState { if (it.sendMode is SendMode.REGULAR && it.sendMode.fromSharing) { // If we were sharing, we want to get back our last value from draft diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index 8376e9e9dd..76541460d2 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -2572,6 +2572,10 @@ Sends the given message with confetti Sends the given message with snow + + sends confetti 🎉 + + sends snow ❄️ Unencrypted Encrypted by an unverified device