diff --git a/CHANGES.md b/CHANGES.md index 0df276fc2f..16b39cc6b1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -16,6 +16,7 @@ Improvements 🙌: - Show room encryption status as a bubble tile (#1078) - Cross-Signing | Restore history after recover from passphrase (#1214) - Cross-Sign | QR code scan confirmation screens design update (#1187) + - Emoji Verification | It's not the same butterfly! (#1220) Bugfix 🐛: - Missing avatar/displayname after verification request message (#841) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/verification/EmojiRepresentation.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/verification/EmojiRepresentation.kt index 9ee7c92788..7d18d9bd70 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/verification/EmojiRepresentation.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/verification/EmojiRepresentation.kt @@ -16,7 +16,10 @@ package im.vector.matrix.android.api.session.crypto.verification +import androidx.annotation.DrawableRes import androidx.annotation.StringRes data class EmojiRepresentation(val emoji: String, - @StringRes val nameResId: Int) + @StringRes val nameResId: Int, + @DrawableRes val drawableRes: Int? = null +) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/SASDefaultVerificationTransaction.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/SASDefaultVerificationTransaction.kt index a878ad06eb..2a502730fa 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/SASDefaultVerificationTransaction.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/SASDefaultVerificationTransaction.kt @@ -15,7 +15,6 @@ */ package im.vector.matrix.android.internal.crypto.verification -import android.os.Build import im.vector.matrix.android.api.extensions.orFalse import im.vector.matrix.android.api.session.crypto.crosssigning.CrossSigningService import im.vector.matrix.android.api.session.crypto.verification.CancelCode @@ -74,13 +73,9 @@ internal abstract class SASDefaultVerificationTransaction( // ordered by preferred order val KNOWN_MACS = listOf(SAS_MAC_SHA256, SAS_MAC_SHA256_LONGKDF) - // older devices have limited support of emoji, so reply with decimal - val KNOWN_SHORT_CODES = - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - listOf(SasMode.EMOJI, SasMode.DECIMAL) - } else { - listOf(SasMode.DECIMAL) - } + // older devices have limited support of emoji but SDK offers images for the 64 verification emojis + // so always send that we support EMOJI + val KNOWN_SHORT_CODES = listOf(SasMode.EMOJI, SasMode.DECIMAL) } override var state: VerificationTxState = VerificationTxState.None diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationEmoji.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationEmoji.kt index eb9acd045a..396b609f41 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationEmoji.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationEmoji.kt @@ -20,69 +20,69 @@ import im.vector.matrix.android.api.session.crypto.verification.EmojiRepresentat internal fun getEmojiForCode(code: Int): EmojiRepresentation { return when (code % 64) { - 0 -> EmojiRepresentation("🐶", R.string.verification_emoji_dog) - 1 -> EmojiRepresentation("🐱", R.string.verification_emoji_cat) - 2 -> EmojiRepresentation("🦁", R.string.verification_emoji_lion) - 3 -> EmojiRepresentation("🐎", R.string.verification_emoji_horse) - 4 -> EmojiRepresentation("🦄", R.string.verification_emoji_unicorn) - 5 -> EmojiRepresentation("🐷", R.string.verification_emoji_pig) - 6 -> EmojiRepresentation("🐘", R.string.verification_emoji_elephant) - 7 -> EmojiRepresentation("🐰", R.string.verification_emoji_rabbit) - 8 -> EmojiRepresentation("🐼", R.string.verification_emoji_panda) - 9 -> EmojiRepresentation("🐓", R.string.verification_emoji_rooster) - 10 -> EmojiRepresentation("🐧", R.string.verification_emoji_penguin) - 11 -> EmojiRepresentation("🐢", R.string.verification_emoji_turtle) - 12 -> EmojiRepresentation("🐟", R.string.verification_emoji_fish) - 13 -> EmojiRepresentation("🐙", R.string.verification_emoji_octopus) - 14 -> EmojiRepresentation("🦋", R.string.verification_emoji_butterfly) - 15 -> EmojiRepresentation("🌷", R.string.verification_emoji_flower) - 16 -> EmojiRepresentation("🌳", R.string.verification_emoji_tree) - 17 -> EmojiRepresentation("🌵", R.string.verification_emoji_cactus) - 18 -> EmojiRepresentation("🍄", R.string.verification_emoji_mushroom) - 19 -> EmojiRepresentation("🌏", R.string.verification_emoji_globe) - 20 -> EmojiRepresentation("🌙", R.string.verification_emoji_moon) - 21 -> EmojiRepresentation("☁️", R.string.verification_emoji_cloud) - 22 -> EmojiRepresentation("🔥", R.string.verification_emoji_fire) - 23 -> EmojiRepresentation("🍌", R.string.verification_emoji_banana) - 24 -> EmojiRepresentation("🍎", R.string.verification_emoji_apple) - 25 -> EmojiRepresentation("🍓", R.string.verification_emoji_strawberry) - 26 -> EmojiRepresentation("🌽", R.string.verification_emoji_corn) - 27 -> EmojiRepresentation("🍕", R.string.verification_emoji_pizza) - 28 -> EmojiRepresentation("🎂", R.string.verification_emoji_cake) - 29 -> EmojiRepresentation("❤️", R.string.verification_emoji_heart) - 30 -> EmojiRepresentation("😀", R.string.verification_emoji_smiley) - 31 -> EmojiRepresentation("🤖", R.string.verification_emoji_robot) - 32 -> EmojiRepresentation("🎩", R.string.verification_emoji_hat) - 33 -> EmojiRepresentation("👓", R.string.verification_emoji_glasses) - 34 -> EmojiRepresentation("🔧", R.string.verification_emoji_wrench) - 35 -> EmojiRepresentation("🎅", R.string.verification_emoji_santa) - 36 -> EmojiRepresentation("👍", R.string.verification_emoji_thumbsup) - 37 -> EmojiRepresentation("☂️", R.string.verification_emoji_umbrella) - 38 -> EmojiRepresentation("⌛", R.string.verification_emoji_hourglass) - 39 -> EmojiRepresentation("⏰", R.string.verification_emoji_clock) - 40 -> EmojiRepresentation("🎁", R.string.verification_emoji_gift) - 41 -> EmojiRepresentation("💡", R.string.verification_emoji_lightbulb) - 42 -> EmojiRepresentation("📕", R.string.verification_emoji_book) - 43 -> EmojiRepresentation("✏️", R.string.verification_emoji_pencil) - 44 -> EmojiRepresentation("📎", R.string.verification_emoji_paperclip) - 45 -> EmojiRepresentation("✂️", R.string.verification_emoji_scissors) - 46 -> EmojiRepresentation("🔒", R.string.verification_emoji_lock) - 47 -> EmojiRepresentation("🔑", R.string.verification_emoji_key) - 48 -> EmojiRepresentation("🔨", R.string.verification_emoji_hammer) - 49 -> EmojiRepresentation("☎️", R.string.verification_emoji_telephone) - 50 -> EmojiRepresentation("🏁", R.string.verification_emoji_flag) - 51 -> EmojiRepresentation("🚂", R.string.verification_emoji_train) - 52 -> EmojiRepresentation("🚲", R.string.verification_emoji_bicycle) - 53 -> EmojiRepresentation("✈️", R.string.verification_emoji_airplane) - 54 -> EmojiRepresentation("🚀", R.string.verification_emoji_rocket) - 55 -> EmojiRepresentation("🏆", R.string.verification_emoji_trophy) - 56 -> EmojiRepresentation("⚽", R.string.verification_emoji_ball) - 57 -> EmojiRepresentation("🎸", R.string.verification_emoji_guitar) - 58 -> EmojiRepresentation("🎺", R.string.verification_emoji_trumpet) - 59 -> EmojiRepresentation("🔔", R.string.verification_emoji_bell) - 60 -> EmojiRepresentation("⚓", R.string.verification_emoji_anchor) - 61 -> EmojiRepresentation("🎧", R.string.verification_emoji_headphone) - 62 -> EmojiRepresentation("📁", R.string.verification_emoji_folder) - /* 63 */ else -> EmojiRepresentation("📌", R.string.verification_emoji_pin) + 0 -> EmojiRepresentation("🐶", R.string.verification_emoji_dog, R.drawable.ic_verification_dog) + 1 -> EmojiRepresentation("🐱", R.string.verification_emoji_cat, R.drawable.ic_verification_cat) + 2 -> EmojiRepresentation("🦁", R.string.verification_emoji_lion, R.drawable.ic_verification_lion) + 3 -> EmojiRepresentation("🐎", R.string.verification_emoji_horse, R.drawable.ic_verification_horse) + 4 -> EmojiRepresentation("🦄", R.string.verification_emoji_unicorn, R.drawable.ic_verification_unicorn) + 5 -> EmojiRepresentation("🐷", R.string.verification_emoji_pig, R.drawable.ic_verification_pig) + 6 -> EmojiRepresentation("🐘", R.string.verification_emoji_elephant, R.drawable.ic_verification_elephant) + 7 -> EmojiRepresentation("🐰", R.string.verification_emoji_rabbit, R.drawable.ic_verification_rabbit) + 8 -> EmojiRepresentation("🐼", R.string.verification_emoji_panda, R.drawable.ic_verification_panda) + 9 -> EmojiRepresentation("🐓", R.string.verification_emoji_rooster, R.drawable.ic_verification_rooster) + 10 -> EmojiRepresentation("🐧", R.string.verification_emoji_penguin, R.drawable.ic_verification_penguin) + 11 -> EmojiRepresentation("🐢", R.string.verification_emoji_turtle, R.drawable.ic_verification_turtle) + 12 -> EmojiRepresentation("🐟", R.string.verification_emoji_fish, R.drawable.ic_verification_fish) + 13 -> EmojiRepresentation("🐙", R.string.verification_emoji_octopus, R.drawable.ic_verification_octopus) + 14 -> EmojiRepresentation("🦋", R.string.verification_emoji_butterfly, R.drawable.ic_verification_butterfly) + 15 -> EmojiRepresentation("🌷", R.string.verification_emoji_flower, R.drawable.ic_verification_flower) + 16 -> EmojiRepresentation("🌳", R.string.verification_emoji_tree, R.drawable.ic_verification_tree) + 17 -> EmojiRepresentation("🌵", R.string.verification_emoji_cactus, R.drawable.ic_verification_cactus) + 18 -> EmojiRepresentation("🍄", R.string.verification_emoji_mushroom, R.drawable.ic_verification_mushroom) + 19 -> EmojiRepresentation("🌏", R.string.verification_emoji_globe, R.drawable.ic_verification_globe) + 20 -> EmojiRepresentation("🌙", R.string.verification_emoji_moon, R.drawable.ic_verification_moon) + 21 -> EmojiRepresentation("☁️", R.string.verification_emoji_cloud, R.drawable.ic_verification_cloud) + 22 -> EmojiRepresentation("🔥", R.string.verification_emoji_fire, R.drawable.ic_verification_fire) + 23 -> EmojiRepresentation("🍌", R.string.verification_emoji_banana, R.drawable.ic_verification_banana) + 24 -> EmojiRepresentation("🍎", R.string.verification_emoji_apple, R.drawable.ic_verification_apple) + 25 -> EmojiRepresentation("🍓", R.string.verification_emoji_strawberry, R.drawable.ic_verification_strawberry) + 26 -> EmojiRepresentation("🌽", R.string.verification_emoji_corn, R.drawable.ic_verification_corn) + 27 -> EmojiRepresentation("🍕", R.string.verification_emoji_pizza, R.drawable.ic_verification_pizza) + 28 -> EmojiRepresentation("🎂", R.string.verification_emoji_cake, R.drawable.ic_verification_cake) + 29 -> EmojiRepresentation("❤️", R.string.verification_emoji_heart, R.drawable.ic_verification_heart) + 30 -> EmojiRepresentation("🙂", R.string.verification_emoji_smiley, R.drawable.ic_verification_smiley) + 31 -> EmojiRepresentation("🤖", R.string.verification_emoji_robot, R.drawable.ic_verification_robot) + 32 -> EmojiRepresentation("🎩", R.string.verification_emoji_hat, R.drawable.ic_verification_hat) + 33 -> EmojiRepresentation("👓", R.string.verification_emoji_glasses, R.drawable.ic_verification_glasses) + 34 -> EmojiRepresentation("🔧", R.string.verification_emoji_wrench, R.drawable.ic_verification_wrench) + 35 -> EmojiRepresentation("🎅", R.string.verification_emoji_santa, R.drawable.ic_verification_santa) + 36 -> EmojiRepresentation("👍", R.string.verification_emoji_thumbsup, R.drawable.ic_verification_thumbs_up) + 37 -> EmojiRepresentation("☂️", R.string.verification_emoji_umbrella, R.drawable.ic_verification_umbrella) + 38 -> EmojiRepresentation("⌛", R.string.verification_emoji_hourglass, R.drawable.ic_verification_hourglass) + 39 -> EmojiRepresentation("⏰", R.string.verification_emoji_clock, R.drawable.ic_verification_clock) + 40 -> EmojiRepresentation("🎁", R.string.verification_emoji_gift, R.drawable.ic_verification_gift) + 41 -> EmojiRepresentation("💡", R.string.verification_emoji_lightbulb, R.drawable.ic_verification_light_bulb) + 42 -> EmojiRepresentation("📕", R.string.verification_emoji_book, R.drawable.ic_verification_book) + 43 -> EmojiRepresentation("✏️", R.string.verification_emoji_pencil, R.drawable.ic_verification_pencil) + 44 -> EmojiRepresentation("📎", R.string.verification_emoji_paperclip, R.drawable.ic_verification_paperclip) + 45 -> EmojiRepresentation("✂️", R.string.verification_emoji_scissors, R.drawable.ic_verification_scissors) + 46 -> EmojiRepresentation("🔒", R.string.verification_emoji_lock, R.drawable.ic_verification_lock) + 47 -> EmojiRepresentation("🔑", R.string.verification_emoji_key, R.drawable.ic_verification_key) + 48 -> EmojiRepresentation("🔨", R.string.verification_emoji_hammer, R.drawable.ic_verification_hammer) + 49 -> EmojiRepresentation("☎️", R.string.verification_emoji_telephone, R.drawable.ic_verification_phone) + 50 -> EmojiRepresentation("🏁", R.string.verification_emoji_flag, R.drawable.ic_verification_flag) + 51 -> EmojiRepresentation("🚂", R.string.verification_emoji_train, R.drawable.ic_verification_train) + 52 -> EmojiRepresentation("🚲", R.string.verification_emoji_bicycle, R.drawable.ic_verification_bicycle) + 53 -> EmojiRepresentation("✈️", R.string.verification_emoji_airplane, R.drawable.ic_verification_airplane) + 54 -> EmojiRepresentation("🚀", R.string.verification_emoji_rocket, R.drawable.ic_verification_rocket) + 55 -> EmojiRepresentation("🏆", R.string.verification_emoji_trophy, R.drawable.ic_verification_trophy) + 56 -> EmojiRepresentation("⚽", R.string.verification_emoji_ball, R.drawable.ic_verification_ball) + 57 -> EmojiRepresentation("🎸", R.string.verification_emoji_guitar, R.drawable.ic_verification_guitar) + 58 -> EmojiRepresentation("🎺", R.string.verification_emoji_trumpet, R.drawable.ic_verification_trumpet) + 59 -> EmojiRepresentation("🔔", R.string.verification_emoji_bell, R.drawable.ic_verification_bell) + 60 -> EmojiRepresentation("⚓", R.string.verification_emoji_anchor, R.drawable.ic_verification_anchor) + 61 -> EmojiRepresentation("🎧", R.string.verification_emoji_headphone, R.drawable.ic_verification_headphone) + 62 -> EmojiRepresentation("📁", R.string.verification_emoji_folder, R.drawable.ic_verification_folder) + /* 63 */ else -> EmojiRepresentation("📌", R.string.verification_emoji_pin, R.drawable.ic_verification_pin) } } diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_airplane.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_airplane.xml new file mode 100644 index 0000000000..72026cd7a0 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_airplane.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_anchor.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_anchor.xml new file mode 100644 index 0000000000..b89d033b9e --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_anchor.xml @@ -0,0 +1,12 @@ + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_apple.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_apple.xml new file mode 100644 index 0000000000..54e0f9a3c0 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_apple.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_ball.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_ball.xml new file mode 100644 index 0000000000..b12c6d245b --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_ball.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_banana.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_banana.xml new file mode 100644 index 0000000000..cdd3cb1b9f --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_banana.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_bell.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_bell.xml new file mode 100644 index 0000000000..2f29828bcf --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_bell.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_bicycle.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_bicycle.xml new file mode 100644 index 0000000000..1427e793c5 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_bicycle.xml @@ -0,0 +1,27 @@ + + + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_book.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_book.xml new file mode 100644 index 0000000000..8e3ecc00c0 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_book.xml @@ -0,0 +1,24 @@ + + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_butterfly.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_butterfly.xml new file mode 100644 index 0000000000..d4b557a7ed --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_butterfly.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_cactus.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_cactus.xml new file mode 100644 index 0000000000..ce8aff0657 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_cactus.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_cake.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_cake.xml new file mode 100644 index 0000000000..9ebb3c0904 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_cake.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_cat.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_cat.xml new file mode 100644 index 0000000000..b34cf63d98 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_cat.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_clock.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_clock.xml new file mode 100644 index 0000000000..48d7150c36 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_clock.xml @@ -0,0 +1,27 @@ + + + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_cloud.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_cloud.xml new file mode 100644 index 0000000000..d390bd6e87 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_cloud.xml @@ -0,0 +1,12 @@ + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_corn.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_corn.xml new file mode 100644 index 0000000000..d863d03c2a --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_corn.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_dog.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_dog.xml new file mode 100644 index 0000000000..8346a5ebee --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_dog.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_elephant.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_elephant.xml new file mode 100644 index 0000000000..d0a2de42cb --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_elephant.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_fire.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_fire.xml new file mode 100644 index 0000000000..ebf42039b1 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_fire.xml @@ -0,0 +1,12 @@ + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_fish.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_fish.xml new file mode 100644 index 0000000000..30907f2496 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_fish.xml @@ -0,0 +1,24 @@ + + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_flag.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_flag.xml new file mode 100644 index 0000000000..250388dc4a --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_flag.xml @@ -0,0 +1,24 @@ + + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_flower.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_flower.xml new file mode 100644 index 0000000000..8a91221a80 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_flower.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_folder.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_folder.xml new file mode 100644 index 0000000000..9320766492 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_folder.xml @@ -0,0 +1,12 @@ + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_gift.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_gift.xml new file mode 100644 index 0000000000..d18c6e860a --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_gift.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_glasses.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_glasses.xml new file mode 100644 index 0000000000..8913d1ffd7 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_glasses.xml @@ -0,0 +1,12 @@ + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_globe.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_globe.xml new file mode 100644 index 0000000000..2a07829cb3 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_globe.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_guitar.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_guitar.xml new file mode 100644 index 0000000000..2622fbe416 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_guitar.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_hammer.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_hammer.xml new file mode 100644 index 0000000000..7b70654d52 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_hammer.xml @@ -0,0 +1,12 @@ + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_hat.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_hat.xml new file mode 100644 index 0000000000..15f980bdb1 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_hat.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_headphone.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_headphone.xml new file mode 100644 index 0000000000..cbc43e7601 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_headphone.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_heart.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_heart.xml new file mode 100644 index 0000000000..d37bcc33d1 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_heart.xml @@ -0,0 +1,9 @@ + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_horse.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_horse.xml new file mode 100644 index 0000000000..bedf0f6f46 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_horse.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_hourglass.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_hourglass.xml new file mode 100644 index 0000000000..8bb37a35bb --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_hourglass.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_key.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_key.xml new file mode 100644 index 0000000000..4cd1d033f7 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_key.xml @@ -0,0 +1,9 @@ + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_light_bulb.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_light_bulb.xml new file mode 100644 index 0000000000..18f3149500 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_light_bulb.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_lion.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_lion.xml new file mode 100644 index 0000000000..b97a508fc2 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_lion.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_lock.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_lock.xml new file mode 100644 index 0000000000..de3979434f --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_lock.xml @@ -0,0 +1,12 @@ + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_moon.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_moon.xml new file mode 100644 index 0000000000..3f5abe6ae3 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_moon.xml @@ -0,0 +1,12 @@ + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_mushroom.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_mushroom.xml new file mode 100644 index 0000000000..72f7036856 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_mushroom.xml @@ -0,0 +1,24 @@ + + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_octopus.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_octopus.xml new file mode 100644 index 0000000000..054760f3b8 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_octopus.xml @@ -0,0 +1,24 @@ + + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_panda.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_panda.xml new file mode 100644 index 0000000000..ab1e718c44 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_panda.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_paperclip.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_paperclip.xml new file mode 100644 index 0000000000..e8f89859d6 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_paperclip.xml @@ -0,0 +1,9 @@ + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_pencil.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_pencil.xml new file mode 100644 index 0000000000..3b9f51fca5 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_pencil.xml @@ -0,0 +1,24 @@ + + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_penguin.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_penguin.xml new file mode 100644 index 0000000000..fb2e05760f --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_penguin.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_phone.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_phone.xml new file mode 100644 index 0000000000..7beda09c4e --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_phone.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_pig.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_pig.xml new file mode 100644 index 0000000000..c31bd06c52 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_pig.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_pin.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_pin.xml new file mode 100644 index 0000000000..f10e4606a9 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_pin.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_pizza.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_pizza.xml new file mode 100644 index 0000000000..a514aeb3d6 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_pizza.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_rabbit.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_rabbit.xml new file mode 100644 index 0000000000..c8ff75c999 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_rabbit.xml @@ -0,0 +1,27 @@ + + + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_robot.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_robot.xml new file mode 100644 index 0000000000..a53cfe99c0 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_robot.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_rocket.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_rocket.xml new file mode 100644 index 0000000000..4097ed9030 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_rocket.xml @@ -0,0 +1,24 @@ + + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_rooster.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_rooster.xml new file mode 100644 index 0000000000..cb7ad563f0 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_rooster.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_santa.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_santa.xml new file mode 100644 index 0000000000..4f7bc1a24f --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_santa.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_scissors.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_scissors.xml new file mode 100644 index 0000000000..98e68c2071 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_scissors.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_smiley.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_smiley.xml new file mode 100644 index 0000000000..087adc8c6d --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_smiley.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_strawberry.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_strawberry.xml new file mode 100644 index 0000000000..0eeb290d9d --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_strawberry.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_thumbs_up.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_thumbs_up.xml new file mode 100644 index 0000000000..9761204ab6 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_thumbs_up.xml @@ -0,0 +1,12 @@ + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_train.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_train.xml new file mode 100644 index 0000000000..e317ce1642 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_train.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_tree.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_tree.xml new file mode 100644 index 0000000000..c5acc19a72 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_tree.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_trophy.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_trophy.xml new file mode 100644 index 0000000000..631da7320d --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_trophy.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_trumpet.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_trumpet.xml new file mode 100644 index 0000000000..84f95a8592 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_trumpet.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_turtle.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_turtle.xml new file mode 100644 index 0000000000..1cedc1b6ad --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_turtle.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_umbrella.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_umbrella.xml new file mode 100644 index 0000000000..ac1267cd3b --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_umbrella.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_unicorn.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_unicorn.xml new file mode 100644 index 0000000000..19cef5d339 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_unicorn.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/matrix-sdk-android/src/main/res/drawable/ic_verification_wrench.xml b/matrix-sdk-android/src/main/res/drawable/ic_verification_wrench.xml new file mode 100644 index 0000000000..ba3c4313a3 --- /dev/null +++ b/matrix-sdk-android/src/main/res/drawable/ic_verification_wrench.xml @@ -0,0 +1,9 @@ + + + diff --git a/vector/src/debug/java/im/vector/riotx/features/debug/sas/SasEmojiItem.kt b/vector/src/debug/java/im/vector/riotx/features/debug/sas/SasEmojiItem.kt index 7403ead43c..cf9ca1032c 100644 --- a/vector/src/debug/java/im/vector/riotx/features/debug/sas/SasEmojiItem.kt +++ b/vector/src/debug/java/im/vector/riotx/features/debug/sas/SasEmojiItem.kt @@ -18,11 +18,14 @@ package im.vector.riotx.features.debug.sas import android.annotation.SuppressLint import android.widget.TextView +import androidx.core.content.ContextCompat import com.airbnb.epoxy.EpoxyAttribute import com.airbnb.epoxy.EpoxyModelClass import im.vector.matrix.android.api.session.crypto.verification.EmojiRepresentation import im.vector.riotx.core.epoxy.VectorEpoxyHolder import im.vector.riotx.core.epoxy.VectorEpoxyModel +import me.gujun.android.span.image +import me.gujun.android.span.span @EpoxyModelClass(layout = im.vector.riotx.R.layout.item_sas_emoji) abstract class SasEmojiItem : VectorEpoxyModel() { @@ -36,7 +39,12 @@ abstract class SasEmojiItem : VectorEpoxyModel() { override fun bind(holder: Holder) { super.bind(holder) holder.indexView.text = "$index:" - holder.emojiView.text = emojiRepresentation.emoji + holder.emojiView.text = span { + +emojiRepresentation.emoji + emojiRepresentation.drawableRes?.let { + image(ContextCompat.getDrawable(holder.view.context, it)!!) + } + } holder.textView.setText(emojiRepresentation.nameResId) holder.idView.text = holder.idView.resources.getResourceEntryName(emojiRepresentation.nameResId) } diff --git a/vector/src/main/assets/open_source_licenses.html b/vector/src/main/assets/open_source_licenses.html index e4fdc2f5ae..3af564aaca 100755 --- a/vector/src/main/assets/open_source_licenses.html +++ b/vector/src/main/assets/open_source_licenses.html @@ -23,6 +23,7 @@ } + @@ -566,5 +567,13 @@ Apache License of your accepting any such warranty or additional liability. +
+    CC-BY 4.0
+    
  • + Twitter/twemoji Graphics +
    +
  • +
    + diff --git a/vector/src/main/java/im/vector/riotx/features/crypto/verification/epoxy/BottomSheetVerificationEmojisItem.kt b/vector/src/main/java/im/vector/riotx/features/crypto/verification/epoxy/BottomSheetVerificationEmojisItem.kt index 7d72486ccd..be14c7df3d 100644 --- a/vector/src/main/java/im/vector/riotx/features/crypto/verification/epoxy/BottomSheetVerificationEmojisItem.kt +++ b/vector/src/main/java/im/vector/riotx/features/crypto/verification/epoxy/BottomSheetVerificationEmojisItem.kt @@ -16,14 +16,21 @@ */ package im.vector.riotx.features.crypto.verification.epoxy +import android.content.Context import android.view.ViewGroup +import android.widget.ImageView import android.widget.TextView +import androidx.core.content.ContextCompat +import androidx.core.view.isVisible import com.airbnb.epoxy.EpoxyAttribute import com.airbnb.epoxy.EpoxyModelClass import im.vector.matrix.android.api.session.crypto.verification.EmojiRepresentation import im.vector.riotx.R import im.vector.riotx.core.epoxy.VectorEpoxyHolder import im.vector.riotx.core.epoxy.VectorEpoxyModel +import me.gujun.android.span.Span +import me.gujun.android.span.image +import me.gujun.android.span.span /** * A emoji list for bottom sheet. @@ -40,26 +47,36 @@ abstract class BottomSheetVerificationEmojisItem : VectorEpoxyModel(R.id.item_emoji_tv).text = emojiRepresentation0.emoji - holder.emoji0View.findViewById(R.id.item_emoji_name_tv).setText(emojiRepresentation0.nameResId) + bindEmojiView(holder.emoji0View, emojiRepresentation0) + bindEmojiView(holder.emoji1View, emojiRepresentation1) + bindEmojiView(holder.emoji2View, emojiRepresentation2) + bindEmojiView(holder.emoji3View, emojiRepresentation3) + bindEmojiView(holder.emoji4View, emojiRepresentation4) + bindEmojiView(holder.emoji5View, emojiRepresentation5) + bindEmojiView(holder.emoji6View, emojiRepresentation6) + } - holder.emoji1View.findViewById(R.id.item_emoji_tv).text = emojiRepresentation1.emoji - holder.emoji1View.findViewById(R.id.item_emoji_name_tv).setText(emojiRepresentation1.nameResId) + private fun spanForRepresentation(context: Context, rep: EmojiRepresentation): Span { + return span { + if (rep.drawableRes != null) { + ContextCompat.getDrawable(context, rep.drawableRes!!)?.let { image(it) } + } else { + +rep.emoji + } + } + } - holder.emoji2View.findViewById(R.id.item_emoji_tv).text = emojiRepresentation2.emoji - holder.emoji2View.findViewById(R.id.item_emoji_name_tv).setText(emojiRepresentation2.nameResId) - - holder.emoji3View.findViewById(R.id.item_emoji_tv).text = emojiRepresentation3.emoji - holder.emoji3View.findViewById(R.id.item_emoji_name_tv)?.setText(emojiRepresentation3.nameResId) - - holder.emoji4View.findViewById(R.id.item_emoji_tv).text = emojiRepresentation4.emoji - holder.emoji4View.findViewById(R.id.item_emoji_name_tv).setText(emojiRepresentation4.nameResId) - - holder.emoji5View.findViewById(R.id.item_emoji_tv).text = emojiRepresentation5.emoji - holder.emoji5View.findViewById(R.id.item_emoji_name_tv).setText(emojiRepresentation5.nameResId) - - holder.emoji6View.findViewById(R.id.item_emoji_tv).text = emojiRepresentation6.emoji - holder.emoji6View.findViewById(R.id.item_emoji_name_tv).setText(emojiRepresentation6.nameResId) + private fun bindEmojiView(view: ViewGroup, rep: EmojiRepresentation) { + rep.drawableRes?.let { + view.findViewById(R.id.item_emoji_tv).isVisible = false + view.findViewById(R.id.item_emoji_image).isVisible = true + view.findViewById(R.id.item_emoji_image).setImageDrawable(ContextCompat.getDrawable(view.context, it)) + } ?: kotlin.run { + view.findViewById(R.id.item_emoji_tv).isVisible = true + view.findViewById(R.id.item_emoji_image).isVisible = false + view.findViewById(R.id.item_emoji_tv).text = rep.emoji + } + view.findViewById(R.id.item_emoji_name_tv).setText(rep.nameResId) } class Holder : VectorEpoxyHolder() { diff --git a/vector/src/main/res/layout/item_emoji_verif.xml b/vector/src/main/res/layout/item_emoji_verif.xml index df9210f0ab..ff883e6de1 100644 --- a/vector/src/main/res/layout/item_emoji_verif.xml +++ b/vector/src/main/res/layout/item_emoji_verif.xml @@ -15,6 +15,19 @@ android:layout_gravity="center" android:textColor="@color/black" android:textSize="40dp" + tools:visibility="gone" + tools:ignore="SpUsage" + tools:text="🌵" /> + +