Merge pull request #2539 from vector-im/feature/bma/cleanup

Small cleanup before the release
This commit is contained in:
Benoit Marty 2020-12-15 14:11:31 +01:00 committed by GitHub
commit 45225e883e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 157 additions and 3 deletions

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Generated file, do not edit -->
<string name="verification_emoji_dog">Куче</string>
<string name="verification_emoji_cat">Котка</string>
<string name="verification_emoji_lion">Лъв</string>
<string name="verification_emoji_horse">Кон</string>
<string name="verification_emoji_unicorn">Еднорог</string>
<string name="verification_emoji_pig">Прасе</string>
<string name="verification_emoji_elephant">Слон</string>
<string name="verification_emoji_rabbit">Заек</string>
<string name="verification_emoji_panda">Панда</string>
<string name="verification_emoji_rooster">Петел</string>
<string name="verification_emoji_penguin">Пингвин</string>
<string name="verification_emoji_turtle">Костенурка</string>
<string name="verification_emoji_fish">Риба</string>
<string name="verification_emoji_octopus">Октопод</string>
<string name="verification_emoji_butterfly">Пеперуда</string>
<string name="verification_emoji_flower">Цвете</string>
<string name="verification_emoji_tree">Дърво</string>
<string name="verification_emoji_cactus">Кактус</string>
<string name="verification_emoji_mushroom">Гъба</string>
<string name="verification_emoji_globe">Глобус</string>
<string name="verification_emoji_moon">Луна</string>
<string name="verification_emoji_cloud">Облак</string>
<string name="verification_emoji_fire">Огън</string>
<string name="verification_emoji_banana">Банан</string>
<string name="verification_emoji_apple">Ябълка</string>
<string name="verification_emoji_strawberry">Ягода</string>
<string name="verification_emoji_corn">Царевица</string>
<string name="verification_emoji_pizza">Пица</string>
<string name="verification_emoji_cake">Торта</string>
<string name="verification_emoji_heart">Сърце</string>
<string name="verification_emoji_smiley">Усмивка</string>
<string name="verification_emoji_robot">Робот</string>
<string name="verification_emoji_hat">Шапка</string>
<string name="verification_emoji_glasses">Очила</string>
<string name="verification_emoji_spanner">Гаечен ключ</string>
<string name="verification_emoji_santa">Дядо Коледа</string>
<string name="verification_emoji_thumbs_up">Палец нагоре</string>
<string name="verification_emoji_umbrella">Чадър</string>
<string name="verification_emoji_hourglass">Пясъчен часовник</string>
<string name="verification_emoji_clock">Часовник</string>
<string name="verification_emoji_gift">Подарък</string>
<string name="verification_emoji_light_bulb">Лампа</string>
<string name="verification_emoji_book">Книга</string>
<string name="verification_emoji_pencil">Молив</string>
<string name="verification_emoji_paperclip">Кламер</string>
<string name="verification_emoji_scissors">Ножици</string>
<string name="verification_emoji_lock">Катинар</string>
<string name="verification_emoji_key">Ключ</string>
<string name="verification_emoji_hammer">Чук</string>
<string name="verification_emoji_telephone">Телефон</string>
<string name="verification_emoji_flag">Флаг</string>
<string name="verification_emoji_train">Влак</string>
<string name="verification_emoji_bicycle">Колело</string>
<string name="verification_emoji_aeroplane">Самолет</string>
<string name="verification_emoji_rocket">Ракета</string>
<string name="verification_emoji_trophy">Трофей</string>
<string name="verification_emoji_ball">Топка</string>
<string name="verification_emoji_guitar">Китара</string>
<string name="verification_emoji_trumpet">Тромпет</string>
<string name="verification_emoji_bell">Звънец</string>
<string name="verification_emoji_anchor">Котва</string>
<string name="verification_emoji_headphones">Слушалки</string>
<string name="verification_emoji_folder">Папка</string>
<string name="verification_emoji_pin">Кабърче</string>
</resources>

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Generated file, do not edit -->
<string name="verification_emoji_dog">Gos</string>
<string name="verification_emoji_cat">Gat</string>
<string name="verification_emoji_lion">Lleó</string>
<string name="verification_emoji_horse">Cavall</string>
<string name="verification_emoji_unicorn">Unicorn</string>
<string name="verification_emoji_pig">Porc</string>
<string name="verification_emoji_elephant">Elefant</string>
<string name="verification_emoji_rabbit">Conill</string>
<string name="verification_emoji_panda">Panda</string>
<string name="verification_emoji_rooster">Gall</string>
<string name="verification_emoji_penguin">Pingüí</string>
<string name="verification_emoji_turtle">Tortuga</string>
<string name="verification_emoji_fish">Peix</string>
<string name="verification_emoji_octopus">Pop</string>
<string name="verification_emoji_butterfly">Papallona</string>
<string name="verification_emoji_flower">Flor</string>
<string name="verification_emoji_tree">Arbre</string>
<string name="verification_emoji_cactus">Cactus</string>
<string name="verification_emoji_mushroom">Bolet</string>
<string name="verification_emoji_globe">Globus terraqüi</string>
<string name="verification_emoji_moon">Lluna</string>
<string name="verification_emoji_cloud">Núvol</string>
<string name="verification_emoji_fire">Foc</string>
<string name="verification_emoji_banana">Plàtan</string>
<string name="verification_emoji_apple">Poma</string>
<string name="verification_emoji_strawberry">Maduixa</string>
<string name="verification_emoji_corn">Blat de moro</string>
<string name="verification_emoji_pizza">Pizza</string>
<string name="verification_emoji_cake">Pastís</string>
<string name="verification_emoji_heart">Cor</string>
<string name="verification_emoji_smiley">Somrient</string>
<string name="verification_emoji_robot">Robot</string>
<string name="verification_emoji_hat">Barret</string>
<string name="verification_emoji_glasses">Ulleres</string>
<string name="verification_emoji_spanner">Clau anglesa</string>
<string name="verification_emoji_santa">Pare Noél</string>
<string name="verification_emoji_thumbs_up">Polzes amunt</string>
<string name="verification_emoji_umbrella">Paraigües</string>
<string name="verification_emoji_hourglass">Rellotge de sorra</string>
<string name="verification_emoji_clock">Rellotge</string>
<string name="verification_emoji_gift">Regal</string>
<string name="verification_emoji_light_bulb">Bombeta</string>
<string name="verification_emoji_book">Llibre</string>
<string name="verification_emoji_pencil">Llapis</string>
<string name="verification_emoji_paperclip">Clip</string>
<string name="verification_emoji_scissors">Tisores</string>
<string name="verification_emoji_lock">Cadenat</string>
<string name="verification_emoji_key">Clau</string>
<string name="verification_emoji_hammer">Martell</string>
<string name="verification_emoji_telephone">Telèfon</string>
<string name="verification_emoji_flag">Bandera</string>
<string name="verification_emoji_train">Tren</string>
<string name="verification_emoji_bicycle">Bicicleta</string>
<string name="verification_emoji_aeroplane">Avió</string>
<string name="verification_emoji_rocket">Coet</string>
<string name="verification_emoji_trophy">Trofeu</string>
<string name="verification_emoji_ball">Pilota</string>
<string name="verification_emoji_guitar">Guitarra</string>
<string name="verification_emoji_trumpet">Trompeta</string>
<string name="verification_emoji_bell">Campana</string>
<string name="verification_emoji_anchor">Àncora</string>
<string name="verification_emoji_headphones">Auriculars</string>
<string name="verification_emoji_folder">Carpeta</string>
<string name="verification_emoji_pin">Xinxeta</string>
</resources>

View File

@ -113,6 +113,7 @@ class ChatEffectManager @Inject constructor() {
return when (content.msgType) { return when (content.msgType) {
MessageType.MSGTYPE_CONFETTI -> ChatEffect.CONFETTI MessageType.MSGTYPE_CONFETTI -> ChatEffect.CONFETTI
MessageType.MSGTYPE_SNOW -> ChatEffect.SNOW MessageType.MSGTYPE_SNOW -> ChatEffect.SNOW
MessageType.MSGTYPE_EMOTE,
MessageType.MSGTYPE_TEXT -> { MessageType.MSGTYPE_TEXT -> {
event.root.getClearContent().toModel<MessageContent>()?.body event.root.getClearContent().toModel<MessageContent>()?.body
?.let { text -> ?.let { text ->

View File

@ -716,7 +716,7 @@ class RoomDetailViewModel @AssistedInject constructor(
popDraft() popDraft()
} }
is ParsedCommand.SendChatEffect -> { is ParsedCommand.SendChatEffect -> {
room.sendTextMessage(slashCommandResult.message, slashCommandResult.chatEffect.toMessageType()) sendChatEffect(slashCommandResult)
_viewEvents.post(RoomDetailViewEvents.SlashCommandHandled()) _viewEvents.post(RoomDetailViewEvents.SlashCommandHandled())
popDraft() 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 { private fun popDraft() = withState {
if (it.sendMode is SendMode.REGULAR && it.sendMode.fromSharing) { if (it.sendMode is SendMode.REGULAR && it.sendMode.fromSharing) {
// If we were sharing, we want to get back our last value from draft // If we were sharing, we want to get back our last value from draft

View File

@ -182,8 +182,8 @@ class NoticeEventFormatter @Inject constructor(
} }
} }
private fun formatDebug(event: Event): CharSequence? { private fun formatDebug(event: Event): CharSequence {
return "{ \"type\": ${event.getClearType()} }" return "Debug: event type \"${event.getClearType()}\""
} }
private fun formatRoomCreateEvent(event: Event, rs: RoomSummary?): CharSequence? { private fun formatRoomCreateEvent(event: Event, rs: RoomSummary?): CharSequence? {

View File

@ -2572,6 +2572,10 @@
<string name="command_confetti">Sends the given message with confetti</string> <string name="command_confetti">Sends the given message with confetti</string>
<string name="command_snow">Sends the given message with snow</string> <string name="command_snow">Sends the given message with snow</string>
<!-- Note to translator: please use the same emoji 🎉 in your translation -->
<string name="default_message_emote_confetti">sends confetti 🎉</string>
<!-- Note to translator: please use the same emoji ❄️ in your translation -->
<string name="default_message_emote_snow">sends snow ❄️</string>
<string name="unencrypted">Unencrypted</string> <string name="unencrypted">Unencrypted</string>
<string name="encrypted_unverified">Encrypted by an unverified device</string> <string name="encrypted_unverified">Encrypted by an unverified device</string>