From 90a16ebbafb7360620355c5bed66152e1a712397 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 31 May 2021 10:53:04 +0200 Subject: [PATCH] /snow -> /snowfall and update wording (iso Element Web) (#3430) --- .../sdk/api/session/room/model/message/MessageType.kt | 2 +- newsfragment/3430.feature | 1 + .../java/im/vector/app/features/command/Command.kt | 2 +- .../im/vector/app/features/command/CommandParser.kt | 6 +++--- .../app/features/home/room/detail/ChatEffectManager.kt | 10 +++++----- .../features/home/room/detail/RoomDetailFragment.kt | 2 +- .../features/home/room/detail/RoomDetailViewModel.kt | 2 +- vector/src/main/res/values/strings.xml | 4 ++-- 8 files changed, 15 insertions(+), 14 deletions(-) create mode 100644 newsfragment/3430.feature diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/MessageType.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/MessageType.kt index c96a800ee5..1e8959afc3 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/MessageType.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/MessageType.kt @@ -35,5 +35,5 @@ object MessageType { const val MSGTYPE_STICKER_LOCAL = "org.matrix.android.sdk.sticker" const val MSGTYPE_CONFETTI = "nic.custom.confetti" - const val MSGTYPE_SNOW = "io.element.effect.snowfall" + const val MSGTYPE_SNOWFALL = "io.element.effect.snowfall" } diff --git a/newsfragment/3430.feature b/newsfragment/3430.feature new file mode 100644 index 0000000000..ee9c269bcd --- /dev/null +++ b/newsfragment/3430.feature @@ -0,0 +1 @@ +/snow -> /snowfall and update wording (iso Element Web) \ No newline at end of file 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 0b210cf298..61d39857cc 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 @@ -46,7 +46,7 @@ enum class Command(val command: String, val parameters: String, @StringRes val d PLAIN("/plain", "", R.string.command_description_plain, false), DISCARD_SESSION("/discardsession", "", R.string.command_description_discard_session, false), CONFETTI("/confetti", "", R.string.command_confetti, false), - SNOW("/snow", "", R.string.command_snow, false), + SNOWFALL("/snowfall", "", R.string.command_snow, false), CREATE_SPACE("/createspace", " *", R.string.command_description_create_space, true), ADD_TO_SPACE("/addToSpace", "spaceId", R.string.command_description_create_space, true), JOIN_SPACE("/joinSpace", "spaceId", R.string.command_description_join_space, true), 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 9b190d64fe..3de00f4d0c 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 @@ -296,9 +296,9 @@ object CommandParser { val message = textMessage.substring(Command.CONFETTI.command.length).trim() ParsedCommand.SendChatEffect(ChatEffect.CONFETTI, message) } - Command.SNOW.command -> { - val message = textMessage.substring(Command.SNOW.command.length).trim() - ParsedCommand.SendChatEffect(ChatEffect.SNOW, message) + Command.SNOWFALL.command -> { + val message = textMessage.substring(Command.SNOWFALL.command.length).trim() + ParsedCommand.SendChatEffect(ChatEffect.SNOWFALL, message) } Command.CREATE_SPACE.command -> { val rawCommand = textMessage.substring(Command.CREATE_SPACE.command.length).trim() 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 e7136762d5..24151c5c10 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 @@ -26,13 +26,13 @@ import javax.inject.Inject enum class ChatEffect { CONFETTI, - SNOW + SNOWFALL } fun ChatEffect.toMessageType(): String { return when (this) { ChatEffect.CONFETTI -> MessageType.MSGTYPE_CONFETTI - ChatEffect.SNOW -> MessageType.MSGTYPE_SNOW + ChatEffect.SNOWFALL -> MessageType.MSGTYPE_SNOWFALL } } @@ -112,14 +112,14 @@ class ChatEffectManager @Inject constructor() { private fun findEffect(content: MessageContent, event: TimelineEvent): ChatEffect? { return when (content.msgType) { MessageType.MSGTYPE_CONFETTI -> ChatEffect.CONFETTI - MessageType.MSGTYPE_SNOW -> ChatEffect.SNOW + MessageType.MSGTYPE_SNOWFALL -> ChatEffect.SNOWFALL MessageType.MSGTYPE_EMOTE, MessageType.MSGTYPE_TEXT -> { event.root.getClearContent().toModel()?.body ?.let { text -> when { EMOJIS_FOR_CONFETTI.any { text.contains(it) } -> ChatEffect.CONFETTI - EMOJIS_FOR_SNOW.any { text.contains(it) } -> ChatEffect.SNOW + EMOJIS_FOR_SNOWFALL.any { text.contains(it) } -> ChatEffect.SNOWFALL else -> null } } @@ -133,7 +133,7 @@ class ChatEffectManager @Inject constructor() { "🎉", "🎊" ) - private val EMOJIS_FOR_SNOW = listOf( + private val EMOJIS_FOR_SNOWFALL = listOf( "⛄️", "☃️", "❄️" diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt index f13f9dba60..7fa36a39d7 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt @@ -438,7 +438,7 @@ class RoomDetailFragment @Inject constructor( .setPosition(-50f, views.viewKonfetti.width + 50f, -50f, -50f) .streamFor(150, 3000L) } - ChatEffect.SNOW -> { + ChatEffect.SNOWFALL -> { views.viewSnowFall.isVisible = true views.viewSnowFall.restartFalling() } 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 205ccf7fca..a2041c0a80 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 @@ -893,7 +893,7 @@ class RoomDetailViewModel @AssistedInject constructor( 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 + ChatEffect.SNOWFALL -> R.string.default_message_emote_snow }) room.sendTextMessage(defaultMessage, MessageType.MSGTYPE_EMOTE) } else { diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index e151930efb..80120b51bf 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -3010,11 +3010,11 @@ Sends the given message with confetti - Sends the given message with snow + Sends the given message with snowfall sends confetti 🎉 - sends snow ❄️ + sends snowfall ❄️ Unencrypted Encrypted by an unverified device