diff --git a/build.gradle b/build.gradle index a40790d441..49dc1e7fb4 100644 --- a/build.gradle +++ b/build.gradle @@ -29,7 +29,7 @@ buildscript { classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.4.0.2513' classpath 'com.google.android.gms:oss-licenses-plugin:0.10.5' classpath "com.likethesalad.android:stem-plugin:2.2.2" - classpath 'org.owasp:dependency-check-gradle:7.1.2' + classpath 'org.owasp:dependency-check-gradle:7.2.0' classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.7.10" classpath "org.jetbrains.kotlinx:kotlinx-knit:0.4.0" classpath 'com.jakewharton:butterknife-gradle-plugin:10.2.3' diff --git a/changelog.d/7130.bugfix b/changelog.d/7130.bugfix new file mode 100644 index 0000000000..1e4045ad76 --- /dev/null +++ b/changelog.d/7130.bugfix @@ -0,0 +1 @@ + Fix empty verification bottom sheet. diff --git a/changelog.d/7132.bugfix b/changelog.d/7132.bugfix new file mode 100644 index 0000000000..1ef925d1d3 --- /dev/null +++ b/changelog.d/7132.bugfix @@ -0,0 +1 @@ +[New Layout] Fixes new chat dialog not getting dismissed after selecting its actions diff --git a/changelog.d/7140.misc b/changelog.d/7140.misc new file mode 100644 index 0000000000..8f364e59bc --- /dev/null +++ b/changelog.d/7140.misc @@ -0,0 +1 @@ +Exclude legacy android support annotation library diff --git a/changelog.d/7157.misc b/changelog.d/7157.misc new file mode 100644 index 0000000000..dc52ed73cd --- /dev/null +++ b/changelog.d/7157.misc @@ -0,0 +1 @@ +Fixing build cache misses when compiling the vector module diff --git a/dependencies_groups.gradle b/dependencies_groups.gradle index bcd737acc9..433bc53568 100644 --- a/dependencies_groups.gradle +++ b/dependencies_groups.gradle @@ -69,8 +69,6 @@ ext.groups = [ 'com.gabrielittner.threetenbp', 'com.getkeepsafe.relinker', 'com.github.bumptech.glide', - 'com.github.filippudak', - 'com.github.filippudak.progresspieview', 'com.github.javaparser', 'com.github.piasy', 'com.github.shyiko.klob', diff --git a/library/jsonviewer/build.gradle b/library/jsonviewer/build.gradle index ad472b0b54..fcad3f1087 100644 --- a/library/jsonviewer/build.gradle +++ b/library/jsonviewer/build.gradle @@ -55,8 +55,9 @@ dependencies { implementation libs.airbnb.mavericks // Span utils - implementation 'me.gujun.android:span:1.7' - + implementation('me.gujun.android:span:1.7') { + exclude group: 'com.android.support', module: 'support-annotations' + } implementation libs.jetbrains.coroutinesCore implementation libs.jetbrains.coroutinesAndroid diff --git a/library/ui-strings/build.gradle b/library/ui-strings/build.gradle index 860fc3c980..6a31f24c9b 100644 --- a/library/ui-strings/build.gradle +++ b/library/ui-strings/build.gradle @@ -20,3 +20,7 @@ android { jvmTarget = "11" } } + +tasks.withType( com.likethesalad.android.templates.common.tasks.BaseTask) { + it.outputs.cacheIf { true } +} diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/SessionExtensions.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/SessionExtensions.kt index a15e73eb88..96dac27618 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/SessionExtensions.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/SessionExtensions.kt @@ -32,5 +32,13 @@ fun Session.getRoomSummary(roomIdOrAlias: String): RoomSummary? = roomService(). /** * Get a user using the UserService of a Session. + * @param userId the userId to look for. + * @return a user with userId or null if the User is not known yet by the SDK. + * See [org.matrix.android.sdk.api.session.user.UserService.resolveUser] to ensure that a User is retrieved. */ fun Session.getUser(userId: String): User? = userService().getUser(userId) + +/** + * Similar to [getUser], but fallback to a User without details if the User is not known by the SDK, or if Session is null. + */ +fun Session?.getUserOrDefault(userId: String): User = this?.userService()?.getUser(userId) ?: User(userId) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/user/UserService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/user/UserService.kt index 0c5465e12a..7075023798 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/user/UserService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/user/UserService.kt @@ -29,7 +29,7 @@ interface UserService { /** * Get a user from a userId. * @param userId the userId to look for. - * @return a user with userId or null + * @return a user with userId or null if the User is not known yet by the SDK. See [resolveUser] to ensure that a User is retrieved. */ fun getUser(userId: String): User? diff --git a/tools/emojis/emoji_picker_datasource_formatted.json b/tools/emojis/emoji_picker_datasource_formatted.json index 551ec824b7..c00bd10371 100644 --- a/tools/emojis/emoji_picker_datasource_formatted.json +++ b/tools/emojis/emoji_picker_datasource_formatted.json @@ -54,6 +54,7 @@ "grimacing-face", "face-exhaling", "lying-face", + "shaking-face", "relieved-face", "pensive-face", "sleepy-face", @@ -104,7 +105,7 @@ "tired-face", "yawning-face", "face-with-steam-from-nose", - "pouting-face", + "enraged-face", "angry-face", "face-with-symbols-on-mouth", "smiling-face-with-horns", @@ -131,7 +132,6 @@ "seenoevil-monkey", "hearnoevil-monkey", "speaknoevil-monkey", - "kiss-mark", "love-letter", "heart-with-arrow", "heart-with-ribbon", @@ -146,14 +146,18 @@ "heart-on-fire", "mending-heart", "red-heart", + "pink-heart", "orange-heart", "yellow-heart", "green-heart", "blue-heart", + "light-blue-heart", "purple-heart", "brown-heart", "black-heart", + "grey-heart", "white-heart", + "kiss-mark", "hundred-points", "anger-symbol", "collision", @@ -161,7 +165,6 @@ "sweat-droplets", "dashing-away", "hole", - "bomb", "speech-balloon", "eye-in-speech-bubble", "left-speech-bubble", @@ -183,6 +186,8 @@ "leftwards-hand", "palm-down-hand", "palm-up-hand", + "leftwards-pushing-hand", + "rightwards-pushing-hand", "ok-hand", "pinched-fingers", "pinching-hand", @@ -561,6 +566,8 @@ "tiger", "leopard", "horse-face", + "moose", + "donkey", "horse", "unicorn", "zebra", @@ -623,6 +630,9 @@ "flamingo", "peacock", "parrot", + "wing", + "black-bird", + "goose", "frog", "crocodile", "turtle", @@ -643,6 +653,7 @@ "octopus", "spiral-shell", "coral", + "jellyfish", "snail", "butterfly", "bug", @@ -670,6 +681,7 @@ "sunflower", "blossom", "tulip", + "hyacinth", "seedling", "potted-plant", "evergreen-tree", @@ -684,7 +696,8 @@ "fallen-leaf", "leaf-fluttering-in-wind", "empty-nest", - "nest-with-eggs" + "nest-with-eggs", + "mushroom" ] }, { @@ -722,10 +735,11 @@ "broccoli", "garlic", "onion", - "mushroom", "peanuts", "beans", "chestnut", + "ginger-root", + "pea-pod", "bread", "croissant", "baguette-bread", @@ -1110,11 +1124,10 @@ "bullseye", "yoyo", "kite", + "water-pistol", "pool-8-ball", "crystal-ball", "magic-wand", - "nazar-amulet", - "hamsa", "video-game", "joystick", "slot-machine", @@ -1165,6 +1178,7 @@ "shorts", "bikini", "womans-clothes", + "folding-hand-fan", "purse", "handbag", "clutch-bag", @@ -1179,6 +1193,7 @@ "womans-sandal", "ballet-shoes", "womans-boot", + "hair-pick", "crown", "womans-hat", "top-hat", @@ -1217,6 +1232,8 @@ "banjo", "drum", "long-drum", + "maracas", + "flute", "mobile-phone", "mobile-phone-with-arrow", "telephone", @@ -1336,7 +1353,7 @@ "hammer-and-wrench", "dagger", "crossed-swords", - "water-pistol", + "bomb", "boomerang", "bow-and-arrow", "shield", @@ -1397,6 +1414,8 @@ "coffin", "headstone", "funeral-urn", + "nazar-amulet", + "hamsa", "moai", "placard", "identification-card" @@ -1465,6 +1484,7 @@ "peace-symbol", "menorah", "dotted-sixpointed-star", + "khanda", "aries", "taurus", "gemini", @@ -1500,6 +1520,7 @@ "dim-button", "bright-button", "antenna-bars", + "wireless", "vibration-mode", "mobile-phone-off", "female-sign", @@ -2050,7 +2071,7 @@ ] }, "melting-face": { - "a": "⊛ Melting Face", + "a": "Melting Face", "b": "1FAE0", "j": [ "disappear", @@ -2345,7 +2366,7 @@ ] }, "face-with-open-eyes-and-hand-over-mouth": { - "a": "⊛ Face with Open Eyes and Hand over Mouth", + "a": "Face with Open Eyes and Hand over Mouth", "b": "1FAE2", "j": [ "amazement", @@ -2360,7 +2381,7 @@ ] }, "face-with-peeking-eye": { - "a": "⊛ Face with Peeking Eye", + "a": "Face with Peeking Eye", "b": "1FAE3", "j": [ "captivated", @@ -2394,10 +2415,10 @@ ] }, "saluting-face": { - "a": "⊛ Saluting Face", + "a": "Saluting Face", "b": "1FAE1", "j": [ - "ok", + "OK", "salute", "sunny", "troops", @@ -2470,7 +2491,7 @@ ] }, "dotted-line-face": { - "a": "⊛ Dotted Line Face", + "a": "Dotted Line Face", "b": "1FAE5", "j": [ "depressed", @@ -2570,6 +2591,17 @@ "pinocchio" ] }, + "shaking-face": { + "a": "⊛ Shaking Face", + "b": "1FAE8", + "j": [ + "earthquake", + "face", + "shaking", + "shock", + "vibrate" + ] + }, "relieved-face": { "a": "Relieved Face", "b": "1F60C", @@ -2599,6 +2631,7 @@ "b": "1F62A", "j": [ "face", + "good night", "sleep", "tired", "rest", @@ -2618,11 +2651,13 @@ "b": "1F634", "j": [ "face", + "good night", "sleep", - "zzz", + "ZZZ", "tired", "sleepy", - "night" + "night", + "zzz" ] }, "face-with-medical-mask": { @@ -2852,9 +2887,10 @@ "a": "Face with Monocle", "b": "1F9D0", "j": [ + "face", + "monocle", "stuffy", - "wealthy", - "face" + "wealthy" ] }, "confused-face": { @@ -2872,7 +2908,7 @@ ] }, "face-with-diagonal-mouth": { - "a": "⊛ Face with Diagonal Mouth", + "a": "Face with Diagonal Mouth", "b": "1FAE4", "j": [ "disappointed", @@ -2981,7 +3017,7 @@ ] }, "face-holding-back-tears": { - "a": "⊛ Face Holding Back Tears", + "a": "Face Holding Back Tears", "b": "1F979", "j": [ "angry", @@ -3192,16 +3228,18 @@ "pride" ] }, - "pouting-face": { - "a": "Pouting Face", + "enraged-face": { + "a": "Enraged Face", "b": "1F621", "j": [ "angry", + "enraged", "face", "mad", "pouting", "rage", "red", + "pouting_face", "hate", "despise" ] @@ -3579,19 +3617,6 @@ "omg" ] }, - "kiss-mark": { - "a": "Kiss Mark", - "b": "1F48B", - "j": [ - "kiss", - "lips", - "face", - "love", - "like", - "affection", - "valentines" - ] - }, "love-letter": { "a": "Love Letter", "b": "1F48C", @@ -3765,6 +3790,17 @@ "valentines" ] }, + "pink-heart": { + "a": "⊛ Pink Heart", + "b": "1FA77", + "j": [ + "cute", + "heart", + "like", + "love", + "pink" + ] + }, "orange-heart": { "a": "Orange Heart", "b": "1F9E1", @@ -3809,6 +3845,17 @@ "valentines" ] }, + "light-blue-heart": { + "a": "⊛ Light Blue Heart", + "b": "1FA75", + "j": [ + "cyan", + "heart", + "light blue", + "light blue heart", + "teal" + ] + }, "purple-heart": { "a": "Purple Heart", "b": "1F49C", @@ -3838,6 +3885,17 @@ "wicked" ] }, + "grey-heart": { + "a": "⊛ Grey Heart", + "b": "1FA76", + "j": [ + "gray", + "grey heart", + "heart", + "silver", + "slate" + ] + }, "white-heart": { "a": "White Heart", "b": "1F90D", @@ -3847,6 +3905,19 @@ "pure" ] }, + "kiss-mark": { + "a": "Kiss Mark", + "b": "1F48B", + "j": [ + "kiss", + "lips", + "face", + "love", + "like", + "affection", + "valentines" + ] + }, "hundred-points": { "a": "Hundred Points", "b": "1F4AF", @@ -3931,17 +4002,6 @@ "embarrassing" ] }, - "bomb": { - "a": "Bomb", - "b": "1F4A3", - "j": [ - "comic", - "boom", - "explode", - "explosion", - "terrorism" - ] - }, "speech-balloon": { "a": "Speech Balloon", "b": "1F4AC", @@ -3961,8 +4021,10 @@ "a": "Eye in Speech Bubble", "b": "1F441-FE0F-200D-1F5E8-FE0F", "j": [ + "balloon", + "bubble", "eye", - "speech bubble", + "speech", "witness", "info" ] @@ -3971,6 +4033,8 @@ "a": "Left Speech Bubble", "b": "1F5E8", "j": [ + "balloon", + "bubble", "dialog", "speech", "words", @@ -4011,7 +4075,9 @@ "b": "1F4A4", "j": [ "comic", + "good night", "sleep", + "ZZZ", "sleepy", "tired", "dream" @@ -4081,7 +4147,7 @@ ] }, "rightwards-hand": { - "a": "⊛ Rightwards Hand", + "a": "Rightwards Hand", "b": "1FAF1", "j": [ "hand", @@ -4092,7 +4158,7 @@ ] }, "leftwards-hand": { - "a": "⊛ Leftwards Hand", + "a": "Leftwards Hand", "b": "1FAF2", "j": [ "hand", @@ -4103,7 +4169,7 @@ ] }, "palm-down-hand": { - "a": "⊛ Palm Down Hand", + "a": "Palm Down Hand", "b": "1FAF3", "j": [ "dismiss", @@ -4113,7 +4179,7 @@ ] }, "palm-up-hand": { - "a": "⊛ Palm Up Hand", + "a": "Palm Up Hand", "b": "1FAF4", "j": [ "beckon", @@ -4124,6 +4190,32 @@ "demand" ] }, + "leftwards-pushing-hand": { + "a": "⊛ Leftwards Pushing Hand", + "b": "1FAF7", + "j": [ + "high five", + "leftward", + "leftwards pushing hand", + "push", + "refuse", + "stop", + "wait" + ] + }, + "rightwards-pushing-hand": { + "a": "⊛ Rightwards Pushing Hand", + "b": "1FAF8", + "j": [ + "high five", + "push", + "refuse", + "rightward", + "rightwards pushing hand", + "stop", + "wait" + ] + }, "ok-hand": { "a": "Ok Hand", "b": "1F44C", @@ -4187,7 +4279,7 @@ ] }, "hand-with-index-finger-and-thumb-crossed": { - "a": "⊛ Hand with Index Finger and Thumb Crossed", + "a": "Hand with Index Finger and Thumb Crossed", "b": "1FAF0", "j": [ "expensive", @@ -4229,6 +4321,8 @@ "j": [ "call", "hand", + "hang loose", + "Shaka", "hands", "gesture", "shaka" @@ -4314,7 +4408,7 @@ ] }, "index-pointing-at-the-viewer": { - "a": "⊛ Index Pointing at the Viewer", + "a": "Index Pointing at the Viewer", "b": "1FAF5", "j": [ "point", @@ -4430,7 +4524,7 @@ ] }, "heart-hands": { - "a": "⊛ Heart Hands", + "a": "Heart Hands", "b": "1FAF6", "j": [ "love", @@ -4687,7 +4781,7 @@ ] }, "biting-lip": { - "a": "⊛ Biting Lip", + "a": "Biting Lip", "b": "1FAE6", "j": [ "anxious", @@ -6089,7 +6183,7 @@ ] }, "person-with-crown": { - "a": "⊛ Person with Crown", + "a": "Person with Crown", "b": "1FAC5", "j": [ "monarch", @@ -6263,7 +6357,7 @@ ] }, "pregnant-man": { - "a": "⊛ Pregnant Man", + "a": "Pregnant Man", "b": "1FAC3", "j": [ "belly", @@ -6274,7 +6368,7 @@ ] }, "pregnant-person": { - "a": "⊛ Pregnant Person", + "a": "Pregnant Person", "b": "1FAC4", "j": [ "belly", @@ -6670,7 +6764,7 @@ ] }, "troll": { - "a": "⊛ Troll", + "a": "Troll", "b": "1F9CC", "j": [ "fairy tale", @@ -7634,6 +7728,7 @@ "a": "Person in Bed", "b": "1F6CC", "j": [ + "good night", "hotel", "sleep", "bed", @@ -8515,6 +8610,30 @@ "nature" ] }, + "moose": { + "a": "⊛ Moose", + "b": "1FACE", + "j": [ + "animal", + "antlers", + "elk", + "mammal", + "moose" + ] + }, + "donkey": { + "a": "⊛ Donkey", + "b": "1FACF", + "j": [ + "animal", + "ass", + "burro", + "donkey", + "mammal", + "mule", + "stubborn" + ] + }, "horse": { "a": "Horse", "b": "1F40E", @@ -9181,6 +9300,40 @@ "nature" ] }, + "wing": { + "a": "⊛ Wing", + "b": "1FABD", + "j": [ + "angelic", + "aviation", + "bird", + "flying", + "mythology", + "wing" + ] + }, + "black-bird": { + "a": "⊛ Black Bird", + "b": "1F426-200D-2B1B", + "j": [ + "bird", + "black", + "crow", + "raven", + "rook" + ] + }, + "goose": { + "a": "⊛ Goose", + "b": "1FABF", + "j": [ + "bird", + "fowl", + "goose", + "honk", + "silly" + ] + }, "frog": { "a": "Frog", "b": "1F438", @@ -9411,7 +9564,7 @@ ] }, "coral": { - "a": "⊛ Coral", + "a": "Coral", "b": "1FAB8", "j": [ "ocean", @@ -9419,6 +9572,19 @@ "sea" ] }, + "jellyfish": { + "a": "⊛ Jellyfish", + "b": "1FABC", + "j": [ + "burn", + "invertebrate", + "jelly", + "jellyfish", + "marine", + "ouch", + "stinger" + ] + }, "snail": { "a": "Snail", "b": "1F40C", @@ -9622,7 +9788,7 @@ ] }, "lotus": { - "a": "⊛ Lotus", + "a": "Lotus", "b": "1FAB7", "j": [ "Buddhism", @@ -9711,6 +9877,18 @@ "spring" ] }, + "hyacinth": { + "a": "⊛ Hyacinth", + "b": "1FABB", + "j": [ + "bluebonnet", + "flower", + "hyacinth", + "lavender", + "lupine", + "snapdragon" + ] + }, "seedling": { "a": "Seedling", "b": "1F331", @@ -9875,7 +10053,7 @@ ] }, "empty-nest": { - "a": "⊛ Empty Nest", + "a": "Empty Nest", "b": "1FAB9", "j": [ "nesting", @@ -9883,13 +10061,22 @@ ] }, "nest-with-eggs": { - "a": "⊛ Nest with Eggs", + "a": "Nest with Eggs", "b": "1FABA", "j": [ "nesting", "bird" ] }, + "mushroom": { + "a": "Mushroom", + "b": "1F344", + "j": [ + "toadstool", + "plant", + "vegetable" + ] + }, "grapes": { "a": "Grapes", "b": "1F347", @@ -10201,15 +10388,6 @@ "spice" ] }, - "mushroom": { - "a": "Mushroom", - "b": "1F344", - "j": [ - "toadstool", - "plant", - "vegetable" - ] - }, "peanuts": { "a": "Peanuts", "b": "1F95C", @@ -10221,7 +10399,7 @@ ] }, "beans": { - "a": "⊛ Beans", + "a": "Beans", "b": "1FAD8", "j": [ "food", @@ -10238,6 +10416,28 @@ "squirrel" ] }, + "ginger-root": { + "a": "⊛ Ginger Root", + "b": "1FADA", + "j": [ + "beer", + "ginger root", + "root", + "spice" + ] + }, + "pea-pod": { + "a": "⊛ Pea Pod", + "b": "1FADB", + "j": [ + "beans", + "edamame", + "legume", + "pea", + "pod", + "vegetable" + ] + }, "bread": { "a": "Bread", "b": "1F35E", @@ -11258,7 +11458,7 @@ ] }, "pouring-liquid": { - "a": "⊛ Pouring Liquid", + "a": "Pouring Liquid", "b": "1FAD7", "j": [ "drink", @@ -11387,7 +11587,7 @@ ] }, "jar": { - "a": "⊛ Jar", + "a": "Jar", "b": "1FAD9", "j": [ "condiment", @@ -12078,7 +12278,7 @@ ] }, "playground-slide": { - "a": "⊛ Playground Slide", + "a": "Playground Slide", "b": "1F6DD", "j": [ "amusement park", @@ -12609,7 +12809,7 @@ ] }, "wheel": { - "a": "⊛ Wheel", + "a": "Wheel", "b": "1F6DE", "j": [ "circle", @@ -12691,7 +12891,7 @@ ] }, "ring-buoy": { - "a": "⊛ Ring Buoy", + "a": "Ring Buoy", "b": "1F6DF", "j": [ "float", @@ -14686,6 +14886,20 @@ "wind" ] }, + "water-pistol": { + "a": "Water Pistol", + "b": "1F52B", + "j": [ + "gun", + "handgun", + "pistol", + "revolver", + "tool", + "water", + "weapon", + "violence" + ] + }, "pool-8-ball": { "a": "Pool 8 Ball", "b": "1F3B1", @@ -14729,30 +14943,6 @@ "power" ] }, - "nazar-amulet": { - "a": "Nazar Amulet", - "b": "1F9FF", - "j": [ - "bead", - "charm", - "evil-eye", - "nazar", - "talisman" - ] - }, - "hamsa": { - "a": "⊛ Hamsa", - "b": "1FAAC", - "j": [ - "amulet", - "Fatima", - "hand", - "Mary", - "Miriam", - "protection", - "religion" - ] - }, "video-game": { "a": "Video Game", "b": "1F3AE", @@ -14834,7 +15024,7 @@ ] }, "mirror-ball": { - "a": "⊛ Mirror Ball", + "a": "Mirror Ball", "b": "1FAA9", "j": [ "dance", @@ -15255,6 +15445,19 @@ "female" ] }, + "folding-hand-fan": { + "a": "⊛ Folding Hand Fan", + "b": "1FAAD", + "j": [ + "cooling", + "dance", + "fan", + "flutter", + "folding hand fan", + "hot", + "shy" + ] + }, "purse": { "a": "Purse", "b": "1F45B", @@ -15429,6 +15632,16 @@ "fashion" ] }, + "hair-pick": { + "a": "⊛ Hair Pick", + "b": "1FAAE", + "j": [ + "Afro", + "comb", + "hair", + "pick" + ] + }, "crown": { "a": "Crown", "b": "1F451", @@ -15867,6 +16080,30 @@ "music" ] }, + "maracas": { + "a": "⊛ Maracas", + "b": "1FA87", + "j": [ + "instrument", + "maracas", + "music", + "percussion", + "rattle", + "shake" + ] + }, + "flute": { + "a": "⊛ Flute", + "b": "1FA88", + "j": [ + "fife", + "flute", + "music", + "pipe", + "recorder", + "woodwind" + ] + }, "mobile-phone": { "a": "Mobile Phone", "b": "1F4F1", @@ -15944,7 +16181,7 @@ ] }, "low-battery": { - "a": "⊛ Low Battery", + "a": "Low Battery", "b": "1FAAB", "j": [ "electronic", @@ -16057,7 +16294,7 @@ "a": "Optical Disk", "b": "1F4BF", "j": [ - "cd", + "CD", "computer", "disk", "optical", @@ -16071,9 +16308,10 @@ "a": "Dvd", "b": "1F4C0", "j": [ - "blu-ray", + "Blu-ray", "computer", "disk", + "DVD", "optical", "cd", "disc" @@ -17261,18 +17499,15 @@ "weapon" ] }, - "water-pistol": { - "a": "Water Pistol", - "b": "1F52B", + "bomb": { + "a": "Bomb", + "b": "1F4A3", "j": [ - "gun", - "handgun", - "pistol", - "revolver", - "tool", - "water", - "weapon", - "violence" + "comic", + "boom", + "explode", + "explosion", + "terrorism" ] }, "boomerang": { @@ -17587,7 +17822,7 @@ ] }, "crutch": { - "a": "⊛ Crutch", + "a": "Crutch", "b": "1FA7C", "j": [ "cane", @@ -17610,7 +17845,7 @@ ] }, "xray": { - "a": "⊛ X-Ray", + "a": "X-Ray", "b": "1FA7B", "j": [ "bones", @@ -17817,7 +18052,7 @@ ] }, "bubbles": { - "a": "⊛ Bubbles", + "a": "Bubbles", "b": "1FAE7", "j": [ "burp", @@ -17920,6 +18155,30 @@ "rip" ] }, + "nazar-amulet": { + "a": "Nazar Amulet", + "b": "1F9FF", + "j": [ + "bead", + "charm", + "evil-eye", + "nazar", + "talisman" + ] + }, + "hamsa": { + "a": "Hamsa", + "b": "1FAAC", + "j": [ + "amulet", + "Fatima", + "hand", + "Mary", + "Miriam", + "protection", + "religion" + ] + }, "moai": { "a": "Moai", "b": "1F5FF", @@ -17943,7 +18202,7 @@ ] }, "identification-card": { - "a": "⊛ Identification Card", + "a": "Identification Card", "b": "1FAAA", "j": [ "credentials", @@ -17957,7 +18216,7 @@ "a": "Atm Sign", "b": "1F3E7", "j": [ - "atm", + "ATM", "ATM sign", "automated", "bank", @@ -18009,13 +18268,15 @@ "a": "Men’S Room", "b": "1F6B9", "j": [ + "bathroom", "lavatory", "man", "men’s room", "restroom", - "wc", - "men_s_room", "toilet", + "WC", + "men_s_room", + "wc", "blue-square", "gender", "male" @@ -18025,15 +18286,16 @@ "a": "Women’S Room", "b": "1F6BA", "j": [ + "bathroom", "lavatory", "restroom", - "wc", + "toilet", + "WC", "woman", "women’s room", "women_s_room", "purple-square", "female", - "toilet", "loo", "gender" ] @@ -18042,10 +18304,11 @@ "a": "Restroom", "b": "1F6BB", "j": [ + "bathroom", "lavatory", + "toilet", "WC", "blue-square", - "toilet", "refresh", "wc", "gender" @@ -18065,12 +18328,13 @@ "a": "Water Closet", "b": "1F6BE", "j": [ + "bathroom", "closet", "lavatory", "restroom", - "water", - "wc", "toilet", + "water", + "WC", "blue-square" ] }, @@ -18507,8 +18771,7 @@ "b": "1F519", "j": [ "arrow", - "back", - "BACK arrow", + "BACK", "words", "return" ] @@ -18518,8 +18781,7 @@ "b": "1F51A", "j": [ "arrow", - "end", - "END arrow", + "END", "words" ] }, @@ -18529,8 +18791,8 @@ "j": [ "arrow", "mark", - "on", - "ON! arrow", + "ON", + "ON!", "words" ] }, @@ -18539,8 +18801,7 @@ "b": "1F51C", "j": [ "arrow", - "soon", - "SOON arrow", + "SOON", "words" ] }, @@ -18549,8 +18810,7 @@ "b": "1F51D", "j": [ "arrow", - "top", - "TOP arrow", + "TOP", "up", "words", "blue-square" @@ -18692,6 +18952,15 @@ "hexagram" ] }, + "khanda": { + "a": "⊛ Khanda", + "b": "1FAAF", + "j": [ + "khanda", + "religion", + "Sikh" + ] + }, "aries": { "a": "Aries", "b": "2648", @@ -18969,7 +19238,6 @@ "j": [ "arrow", "button", - "red", "blue-square", "triangle", "direction", @@ -18996,7 +19264,6 @@ "arrow", "button", "down", - "red", "blue-square", "direction", "bottom" @@ -19106,6 +19373,16 @@ "bars" ] }, + "wireless": { + "a": "⊛ Wireless", + "b": "1F6DC", + "j": [ + "computer", + "internet", + "network", + "wireless" + ] + }, "vibration-mode": { "a": "Vibration Mode", "b": "1F4F3", @@ -19216,7 +19493,7 @@ ] }, "heavy-equals-sign": { - "a": "⊛ Heavy Equals Sign", + "a": "Heavy Equals Sign", "b": "1F7F0", "j": [ "equality", @@ -19595,7 +19872,7 @@ "a": "Copyright", "b": "00A9", "j": [ - "c", + "C", "ip", "license", "circle", @@ -19607,7 +19884,7 @@ "a": "Registered", "b": "00AE", "j": [ - "r", + "R", "alphabet", "circle" ] @@ -19617,7 +19894,7 @@ "b": "2122", "j": [ "mark", - "tm", + "TM", "trademark", "brand", "law", @@ -19815,7 +20092,7 @@ "a": "A Button (Blood Type)", "b": "1F170", "j": [ - "a", + "A", "A button (blood type)", "blood type", "a_button", @@ -19828,7 +20105,7 @@ "a": "Ab Button (Blood Type)", "b": "1F18E", "j": [ - "ab", + "AB", "AB button (blood type)", "blood type", "ab_button", @@ -19840,7 +20117,7 @@ "a": "B Button (Blood Type)", "b": "1F171", "j": [ - "b", + "B", "B button (blood type)", "blood type", "b_button", @@ -19853,7 +20130,7 @@ "a": "Cl Button", "b": "1F191", "j": [ - "cl", + "CL", "CL button", "alphabet", "words", @@ -19864,7 +20141,7 @@ "a": "Cool Button", "b": "1F192", "j": [ - "cool", + "COOL", "COOL button", "words", "blue-square" @@ -19874,7 +20151,7 @@ "a": "Free Button", "b": "1F193", "j": [ - "free", + "FREE", "FREE button", "blue-square", "words" @@ -19894,7 +20171,7 @@ "a": "Id Button", "b": "1F194", "j": [ - "id", + "ID", "ID button", "identity", "purple-square", @@ -19907,7 +20184,7 @@ "j": [ "circle", "circled M", - "m", + "M", "alphabet", "blue-circle", "letter" @@ -19917,7 +20194,7 @@ "a": "New Button", "b": "1F195", "j": [ - "new", + "NEW", "NEW button", "blue-square", "words", @@ -19928,7 +20205,7 @@ "a": "Ng Button", "b": "1F196", "j": [ - "ng", + "NG", "NG button", "blue-square", "words", @@ -19941,7 +20218,7 @@ "b": "1F17E", "j": [ "blood type", - "o", + "O", "O button (blood type)", "o_button", "alphabet", @@ -19965,6 +20242,7 @@ "a": "P Button", "b": "1F17F", "j": [ + "P", "P button", "parking", "cars", @@ -19978,7 +20256,7 @@ "b": "1F198", "j": [ "help", - "sos", + "SOS", "SOS button", "red-square", "words", @@ -19991,7 +20269,8 @@ "b": "1F199", "j": [ "mark", - "up", + "UP", + "UP!", "UP! button", "blue-square", "above", @@ -20003,7 +20282,7 @@ "b": "1F19A", "j": [ "versus", - "vs", + "VS", "VS button", "words", "orange-square" diff --git a/vector-app/build.gradle b/vector-app/build.gradle index 82c433d2df..ea543166fe 100644 --- a/vector-app/build.gradle +++ b/vector-app/build.gradle @@ -370,7 +370,7 @@ dependencies { debugImplementation 'com.facebook.soloader:soloader:0.10.4' debugImplementation "com.kgurgul.flipper:flipper-realm-android:2.2.0" - gplayImplementation "com.google.android.gms:play-services-location:16.0.0" + gplayImplementation "com.google.android.gms:play-services-location:20.0.0" // UnifiedPush gplay flavor only gplayImplementation('com.github.UnifiedPush:android-embedded_fcm_distributor:2.1.2') { exclude group: 'com.google.firebase', module: 'firebase-core' diff --git a/vector/build.gradle b/vector/build.gradle index f6db2a61df..ac3699454c 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -100,7 +100,6 @@ android { viewBinding true } } - dependencies { implementation project(":vector-config") api project(":matrix-sdk-android") @@ -177,7 +176,9 @@ dependencies { // UI implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1' implementation libs.google.material - api 'me.gujun.android:span:1.7' + api('me.gujun.android:span:1.7') { + exclude group: 'com.android.support', module: 'support-annotations' + } implementation libs.markwon.core implementation libs.markwon.extLatex implementation libs.markwon.inlineParser @@ -206,7 +207,6 @@ dependencies { // Image Loading implementation libs.github.bigImageViewer implementation libs.github.glideImageLoader - implementation libs.github.progressPieIndicator implementation libs.github.glideImageViewFactory // implementation 'com.github.MikeOrtiz:TouchImageView:3.0.2' @@ -225,7 +225,9 @@ dependencies { kapt libs.dagger.hiltCompiler // Analytics - implementation 'com.posthog.android:posthog:1.1.2' + implementation('com.posthog.android:posthog:1.1.2') { + exclude group: 'com.android.support', module: 'support-annotations' + } // UnifiedPush implementation 'com.github.UnifiedPush:android-connector:2.0.1' @@ -242,12 +244,22 @@ dependencies { exclude group: 'com.google.firebase' exclude group: 'com.google.android.gms' exclude group: 'com.android.installreferrer' + + // Exclude jitsi's android-scalablevideoview fork's support library + // The library exports a jetified artifact but doesn't remove the support library dependency + // https://github.com/MatrixFrog/Android-ScalableVideoView/blob/master/gradle.properties#L1 + exclude group: 'com.android.support', module: 'appcompat-v7' } // QR-code // Stick to 3.3.3 because of https://github.com/zxing/zxing/issues/1170 implementation 'com.google.zxing:core:3.3.3' - implementation 'me.dm7.barcodescanner:zxing:1.9.13' + + // Excludes the legacy support library annotation usages + // https://github.com/dm77/barcodescanner/blob/d036996c8a6f36a68843ffe539c834c28944b2d5/core/src/main/java/me/dm7/barcodescanner/core/CameraWrapper.java#L4 + implementation ('me.dm7.barcodescanner:zxing:1.9.13') { + exclude group: 'com.android.support', module: 'support-v4' + } // Emoji Keyboard api libs.vanniktech.emojiMaterial diff --git a/vector/src/main/java/im/vector/app/features/createdirect/CreateDirectRoomViewModel.kt b/vector/src/main/java/im/vector/app/features/createdirect/CreateDirectRoomViewModel.kt index 36ee47ca06..61ebc82767 100644 --- a/vector/src/main/java/im/vector/app/features/createdirect/CreateDirectRoomViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/createdirect/CreateDirectRoomViewModel.kt @@ -37,11 +37,10 @@ import kotlinx.coroutines.launch import org.matrix.android.sdk.api.extensions.orFalse import org.matrix.android.sdk.api.raw.RawService import org.matrix.android.sdk.api.session.Session -import org.matrix.android.sdk.api.session.getUser +import org.matrix.android.sdk.api.session.getUserOrDefault import org.matrix.android.sdk.api.session.permalinks.PermalinkData import org.matrix.android.sdk.api.session.permalinks.PermalinkParser import org.matrix.android.sdk.api.session.room.model.create.CreateRoomParams -import org.matrix.android.sdk.api.session.user.model.User class CreateDirectRoomViewModel @AssistedInject constructor( @Assisted initialState: CreateDirectRoomViewState, @@ -78,11 +77,7 @@ class CreateDirectRoomViewModel @AssistedInject constructor( _viewEvents.post(CreateDirectRoomViewEvents.DmSelf) } else { // Try to get user from known users and fall back to creating a User object from MXID - val qrInvitee = if (session.getUser(mxid) != null) { - session.getUser(mxid)!! - } else { - User(mxid, null, null) - } + val qrInvitee = session.getUserOrDefault(mxid) onSubmitInvitees(setOf(PendingSelection.UserPendingSelection(qrInvitee))) } } diff --git a/vector/src/main/java/im/vector/app/features/crypto/verification/IncomingVerificationRequestHandler.kt b/vector/src/main/java/im/vector/app/features/crypto/verification/IncomingVerificationRequestHandler.kt index 91bb3fa7f2..3406a86d1e 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/verification/IncomingVerificationRequestHandler.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/verification/IncomingVerificationRequestHandler.kt @@ -31,6 +31,7 @@ import org.matrix.android.sdk.api.session.crypto.verification.PendingVerificatio import org.matrix.android.sdk.api.session.crypto.verification.VerificationService import org.matrix.android.sdk.api.session.crypto.verification.VerificationTransaction import org.matrix.android.sdk.api.session.crypto.verification.VerificationTxState +import org.matrix.android.sdk.api.session.getUserOrDefault import org.matrix.android.sdk.api.util.toMatrixItem import timber.log.Timber import javax.inject.Inject @@ -67,8 +68,8 @@ class IncomingVerificationRequestHandler @Inject constructor( when (tx.state) { is VerificationTxState.OnStarted -> { // Add a notification for every incoming request - val user = session?.userService()?.getUser(tx.otherUserId) - val name = user?.toMatrixItem()?.getBestName() ?: tx.otherUserId + val user = session.getUserOrDefault(tx.otherUserId).toMatrixItem() + val name = user.getBestName() val alert = VerificationVectorAlert( uid, context.getString(R.string.sas_incoming_request_notif_title), @@ -86,7 +87,7 @@ class IncomingVerificationRequestHandler @Inject constructor( } ) .apply { - viewBinder = VerificationVectorAlert.ViewBinder(user?.toMatrixItem(), avatarRenderer.get()) + viewBinder = VerificationVectorAlert.ViewBinder(user, avatarRenderer.get()) contentAction = Runnable { (weakCurrentActivity?.get() as? VectorBaseActivity<*>)?.let { it.navigator.performDeviceVerification(it, tx.otherUserId, tx.transactionId) @@ -131,8 +132,8 @@ class IncomingVerificationRequestHandler @Inject constructor( // XXX this is a bit hard coded :/ popupAlertManager.cancelAlert("review_login") } - val user = session?.userService()?.getUser(pr.otherUserId)?.toMatrixItem() - val name = user?.getBestName() ?: pr.otherUserId + val user = session.getUserOrDefault(pr.otherUserId).toMatrixItem() + val name = user.getBestName() val description = if (name == pr.otherUserId) { name } else { diff --git a/vector/src/main/java/im/vector/app/features/crypto/verification/VerificationBottomSheet.kt b/vector/src/main/java/im/vector/app/features/crypto/verification/VerificationBottomSheet.kt index eae868eb26..38b72f2022 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/verification/VerificationBottomSheet.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/verification/VerificationBottomSheet.kt @@ -152,29 +152,25 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment - state.otherUserMxItem?.let { matrixItem -> - if (state.isMe) { - avatarRenderer.render(matrixItem, views.otherUserAvatarImageView) - if (state.sasTransactionState == VerificationTxState.Verified || - state.qrTransactionState == VerificationTxState.Verified || - state.verifiedFromPrivateKeys) { - views.otherUserShield.render(RoomEncryptionTrustLevel.Trusted) - } else { - views.otherUserShield.render(RoomEncryptionTrustLevel.Warning) - } - views.otherUserNameText.text = getString( - if (state.selfVerificationMode) R.string.crosssigning_verify_this_session else R.string.crosssigning_verify_session - ) + avatarRenderer.render(state.otherUserMxItem, views.otherUserAvatarImageView) + if (state.isMe) { + if (state.sasTransactionState == VerificationTxState.Verified || + state.qrTransactionState == VerificationTxState.Verified || + state.verifiedFromPrivateKeys) { + views.otherUserShield.render(RoomEncryptionTrustLevel.Trusted) } else { - avatarRenderer.render(matrixItem, views.otherUserAvatarImageView) - - if (state.sasTransactionState == VerificationTxState.Verified || state.qrTransactionState == VerificationTxState.Verified) { - views.otherUserNameText.text = getString(R.string.verification_verified_user, matrixItem.getBestName()) - views.otherUserShield.render(RoomEncryptionTrustLevel.Trusted) - } else { - views.otherUserNameText.text = getString(R.string.verification_verify_user, matrixItem.getBestName()) - views.otherUserShield.render(null) - } + views.otherUserShield.render(RoomEncryptionTrustLevel.Warning) + } + views.otherUserNameText.text = getString( + if (state.selfVerificationMode) R.string.crosssigning_verify_this_session else R.string.crosssigning_verify_session + ) + } else { + if (state.sasTransactionState == VerificationTxState.Verified || state.qrTransactionState == VerificationTxState.Verified) { + views.otherUserNameText.text = getString(R.string.verification_verified_user, state.otherUserMxItem.getBestName()) + views.otherUserShield.render(RoomEncryptionTrustLevel.Trusted) + } else { + views.otherUserNameText.text = getString(R.string.verification_verify_user, state.otherUserMxItem.getBestName()) + views.otherUserShield.render(null) } } @@ -235,7 +231,7 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment = Uninitialized, val pendingLocalId: String? = null, val sasTransactionState: VerificationTxState? = null, @@ -92,7 +93,8 @@ data class VerificationBottomSheetViewState( otherUserId = args.otherUserId, verificationId = args.verificationId, roomId = args.roomId, - selfVerificationMode = args.selfVerificationMode + selfVerificationMode = args.selfVerificationMode, + otherUserMxItem = MatrixItem.UserItem(args.otherUserId), ) } @@ -126,7 +128,7 @@ class VerificationBottomSheetViewModel @AssistedInject constructor( } } - val userItem = session.getUser(initialState.otherUserId) + fetchOtherUserProfile(initialState.otherUserId) var autoReady = false val pr = if (initialState.selfVerificationMode) { @@ -160,7 +162,6 @@ class VerificationBottomSheetViewModel @AssistedInject constructor( setState { copy( - otherUserMxItem = userItem?.toMatrixItem(), sasTransactionState = sasTx?.state, qrTransactionState = qrTx?.state, transactionId = pr?.transactionId ?: initialState.verificationId, @@ -183,6 +184,28 @@ class VerificationBottomSheetViewModel @AssistedInject constructor( } } + private fun fetchOtherUserProfile(otherUserId: String) { + session.getUser(otherUserId)?.toMatrixItem()?.let { + setState { + copy( + otherUserMxItem = it + ) + } + } + // Always fetch the latest User data + viewModelScope.launch { + tryOrNull { session.userService().resolveUser(otherUserId) } + ?.toMatrixItem() + ?.let { + setState { + copy( + otherUserMxItem = it + ) + } + } + } + } + override fun onCleared() { session.cryptoService().verificationService().removeListener(this) super.onCleared() @@ -216,12 +239,12 @@ class VerificationBottomSheetViewModel @AssistedInject constructor( private fun cancelAllPendingVerifications(state: VerificationBottomSheetViewState) { session.cryptoService() - .verificationService().getExistingVerificationRequest(state.otherUserMxItem?.id ?: "", state.transactionId)?.let { + .verificationService().getExistingVerificationRequest(state.otherUserId, state.transactionId)?.let { session.cryptoService().verificationService().cancelVerificationRequest(it) } session.cryptoService() .verificationService() - .getExistingTransaction(state.otherUserMxItem?.id ?: "", state.transactionId ?: "") + .getExistingTransaction(state.otherUserId, state.transactionId ?: "") ?.cancel(CancelCode.User) } @@ -249,7 +272,7 @@ class VerificationBottomSheetViewModel @AssistedInject constructor( } override fun handle(action: VerificationAction) = withState { state -> - val otherUserId = state.otherUserMxItem?.id ?: return@withState + val otherUserId = state.otherUserId val roomId = state.roomId ?: session.roomService().getExistingDirectRoomWithUser(otherUserId) @@ -514,7 +537,7 @@ class VerificationBottomSheetViewModel @AssistedInject constructor( override fun transactionUpdated(tx: VerificationTransaction) = withState { state -> if (state.selfVerificationMode && state.transactionId == null) { // is this an incoming with that user - if (tx.isIncoming && tx.otherUserId == state.otherUserMxItem?.id) { + if (tx.isIncoming && tx.otherUserId == state.otherUserId) { // Also auto accept incoming if needed! if (tx is IncomingSasVerificationTransaction) { if (tx.uxState == IncomingSasVerificationTransaction.UxState.SHOW_ACCEPT) { @@ -564,7 +587,7 @@ class VerificationBottomSheetViewModel @AssistedInject constructor( if (state.selfVerificationMode && state.pendingRequest.invoke() == null && state.transactionId == null) { // is this an incoming with that user - if (pr.isIncoming && pr.otherUserId == state.otherUserMxItem?.id) { + if (pr.isIncoming && pr.otherUserId == state.otherUserId) { if (!pr.isReady) { // auto ready in this case, as we are waiting // TODO, can I be here in DM mode? in this case should test if roomID is null? diff --git a/vector/src/main/java/im/vector/app/features/crypto/verification/cancel/VerificationCancelController.kt b/vector/src/main/java/im/vector/app/features/crypto/verification/cancel/VerificationCancelController.kt index 1adafe2760..600d5e1be1 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/verification/cancel/VerificationCancelController.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/verification/cancel/VerificationCancelController.kt @@ -26,6 +26,7 @@ import im.vector.app.core.utils.colorizeMatchingText import im.vector.app.features.crypto.verification.VerificationBottomSheetViewState import im.vector.app.features.crypto.verification.epoxy.bottomSheetVerificationActionItem import im.vector.app.features.crypto.verification.epoxy.bottomSheetVerificationNoticeItem +import im.vector.app.features.displayname.getBestName import im.vector.lib.core.utils.epoxy.charsequence.EpoxyCharSequence import im.vector.lib.core.utils.epoxy.charsequence.toEpoxyCharSequence import javax.inject.Inject @@ -60,8 +61,8 @@ class VerificationCancelController @Inject constructor( } } } else { - val otherUserID = state.otherUserMxItem?.id ?: "" - val otherDisplayName = state.otherUserMxItem?.displayName ?: "" + val otherUserID = state.otherUserId + val otherDisplayName = state.otherUserMxItem.getBestName() bottomSheetVerificationNoticeItem { id("notice") notice( diff --git a/vector/src/main/java/im/vector/app/features/crypto/verification/choose/VerificationChooseMethodFragment.kt b/vector/src/main/java/im/vector/app/features/crypto/verification/choose/VerificationChooseMethodFragment.kt index 45f7908446..9f908d83f6 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/verification/choose/VerificationChooseMethodFragment.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/verification/choose/VerificationChooseMethodFragment.kt @@ -78,7 +78,7 @@ class VerificationChooseMethodFragment : override fun doVerifyBySas() = withState(sharedViewModel) { state -> sharedViewModel.handle( VerificationAction.StartSASVerification( - state.otherUserMxItem?.id ?: "", + state.otherUserId, state.pendingRequest.invoke()?.transactionId ?: "" ) ) @@ -130,7 +130,7 @@ class VerificationChooseMethodFragment : private fun onRemoteQrCodeScanned(remoteQrCode: String) = withState(sharedViewModel) { state -> sharedViewModel.handle( VerificationAction.RemoteQrCodeScanned( - state.otherUserMxItem?.id ?: "", + state.otherUserId, state.pendingRequest.invoke()?.transactionId ?: "", remoteQrCode ) diff --git a/vector/src/main/java/im/vector/app/features/crypto/verification/emoji/VerificationEmojiCodeController.kt b/vector/src/main/java/im/vector/app/features/crypto/verification/emoji/VerificationEmojiCodeController.kt index 98b163f4e3..bf514249d8 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/verification/emoji/VerificationEmojiCodeController.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/verification/emoji/VerificationEmojiCodeController.kt @@ -136,7 +136,7 @@ class VerificationEmojiCodeController @Inject constructor( if (state.isWaitingFromOther) { bottomSheetVerificationWaitingItem { id("waiting") - title(host.stringProvider.getString(R.string.verification_request_waiting_for, state.otherUser?.getBestName() ?: "")) + title(host.stringProvider.getString(R.string.verification_request_waiting_for, state.otherUser.getBestName())) } } else { bottomSheetVerificationActionItem { diff --git a/vector/src/main/java/im/vector/app/features/crypto/verification/emoji/VerificationEmojiCodeFragment.kt b/vector/src/main/java/im/vector/app/features/crypto/verification/emoji/VerificationEmojiCodeFragment.kt index 1e1a8d0710..58b5c01923 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/verification/emoji/VerificationEmojiCodeFragment.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/verification/emoji/VerificationEmojiCodeFragment.kt @@ -68,13 +68,13 @@ class VerificationEmojiCodeFragment : } override fun onMatchButtonTapped() = withState(viewModel) { state -> - val otherUserId = state.otherUser?.id ?: return@withState + val otherUserId = state.otherUser.id val txId = state.transactionId ?: return@withState sharedViewModel.handle(VerificationAction.SASMatchAction(otherUserId, txId)) } override fun onDoNotMatchButtonTapped() = withState(viewModel) { state -> - val otherUserId = state.otherUser?.id ?: return@withState + val otherUserId = state.otherUser.id val txId = state.transactionId ?: return@withState sharedViewModel.handle(VerificationAction.SASDoNotMatchAction(otherUserId, txId)) } diff --git a/vector/src/main/java/im/vector/app/features/crypto/verification/emoji/VerificationEmojiCodeViewModel.kt b/vector/src/main/java/im/vector/app/features/crypto/verification/emoji/VerificationEmojiCodeViewModel.kt index db9a8fed4a..6761d98a55 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/verification/emoji/VerificationEmojiCodeViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/verification/emoji/VerificationEmojiCodeViewModel.kt @@ -40,13 +40,13 @@ import org.matrix.android.sdk.api.session.crypto.verification.SasVerificationTra import org.matrix.android.sdk.api.session.crypto.verification.VerificationService import org.matrix.android.sdk.api.session.crypto.verification.VerificationTransaction import org.matrix.android.sdk.api.session.crypto.verification.VerificationTxState -import org.matrix.android.sdk.api.session.getUser +import org.matrix.android.sdk.api.session.getUserOrDefault import org.matrix.android.sdk.api.util.MatrixItem import org.matrix.android.sdk.api.util.toMatrixItem data class VerificationEmojiCodeViewState( val transactionId: String?, - val otherUser: MatrixItem? = null, + val otherUser: MatrixItem, val supportsEmoji: Boolean = true, val emojiDescription: Async> = Uninitialized, val decimalDescription: Async = Uninitialized, @@ -59,15 +59,13 @@ class VerificationEmojiCodeViewModel @AssistedInject constructor( ) : VectorViewModel(initialState), VerificationService.Listener { init { - withState { state -> - refreshStateFromTx( - session.cryptoService().verificationService() - .getExistingTransaction( - state.otherUser?.id ?: "", state.transactionId - ?: "" - ) as? SasVerificationTransaction - ) - } + refreshStateFromTx( + session.cryptoService().verificationService() + .getExistingTransaction( + otherUserId = initialState.otherUser.id, + tid = initialState.transactionId ?: "" + ) as? SasVerificationTransaction + ) session.cryptoService().verificationService().addListener(this) } @@ -165,10 +163,10 @@ class VerificationEmojiCodeViewModel @AssistedInject constructor( companion object : MavericksViewModelFactory by hiltMavericksViewModelFactory() { - override fun initialState(viewModelContext: ViewModelContext): VerificationEmojiCodeViewState? { + override fun initialState(viewModelContext: ViewModelContext): VerificationEmojiCodeViewState { val args = viewModelContext.args() val session = EntryPoints.get(viewModelContext.app(), SingletonEntryPoint::class.java).activeSessionHolder().getActiveSession() - val matrixItem = session.getUser(args.otherUserId)?.toMatrixItem() + val matrixItem = session.getUserOrDefault(args.otherUserId).toMatrixItem() return VerificationEmojiCodeViewState( transactionId = args.verificationId, diff --git a/vector/src/main/java/im/vector/app/features/crypto/verification/qrconfirmation/VerificationQrScannedByOtherController.kt b/vector/src/main/java/im/vector/app/features/crypto/verification/qrconfirmation/VerificationQrScannedByOtherController.kt index 71d64b99bc..639ebac29e 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/verification/qrconfirmation/VerificationQrScannedByOtherController.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/verification/qrconfirmation/VerificationQrScannedByOtherController.kt @@ -54,7 +54,7 @@ class VerificationQrScannedByOtherController @Inject constructor( if (state.isMe) { notice(host.stringProvider.getString(R.string.qr_code_scanned_self_verif_notice).toEpoxyCharSequence()) } else { - val name = state.otherUserMxItem?.getBestName() ?: "" + val name = state.otherUserMxItem.getBestName() notice(host.stringProvider.getString(R.string.qr_code_scanned_by_other_notice, name).toEpoxyCharSequence()) } } diff --git a/vector/src/main/java/im/vector/app/features/crypto/verification/request/VerificationRequestController.kt b/vector/src/main/java/im/vector/app/features/crypto/verification/request/VerificationRequestController.kt index e050c5bfb0..185ee48351 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/verification/request/VerificationRequestController.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/verification/request/VerificationRequestController.kt @@ -52,7 +52,6 @@ class VerificationRequestController @Inject constructor( override fun buildModels() { val state = viewState ?: return - val matrixItem = viewState?.otherUserMxItem ?: return val host = this if (state.selfVerificationMode) { @@ -107,11 +106,9 @@ class VerificationRequestController @Inject constructor( if (state.isMe) { stringProvider.getString(R.string.verify_new_session_notice) } else { - matrixItem.let { - stringProvider.getString(R.string.verification_request_notice, it.id) - .toSpannable() - .colorizeMatchingText(it.id, colorProvider.getColorFromAttribute(R.attr.vctr_notice_text_color)) - } + stringProvider.getString(R.string.verification_request_notice, state.otherUserId) + .toSpannable() + .colorizeMatchingText(state.otherUserId, colorProvider.getColorFromAttribute(R.attr.vctr_notice_text_color)) } bottomSheetVerificationNoticeItem { @@ -138,7 +135,7 @@ class VerificationRequestController @Inject constructor( is Loading -> { bottomSheetVerificationWaitingItem { id("waiting") - title(host.stringProvider.getString(R.string.verification_request_waiting_for, matrixItem.getBestName())) + title(host.stringProvider.getString(R.string.verification_request_waiting_for, state.otherUserMxItem.getBestName())) } } is Success -> { @@ -151,7 +148,7 @@ class VerificationRequestController @Inject constructor( } else { bottomSheetVerificationWaitingItem { id("waiting") - title(host.stringProvider.getString(R.string.verification_request_waiting_for, matrixItem.getBestName())) + title(host.stringProvider.getString(R.string.verification_request_waiting_for, state.otherUserMxItem.getBestName())) } } } diff --git a/vector/src/main/java/im/vector/app/features/crypto/verification/request/VerificationRequestFragment.kt b/vector/src/main/java/im/vector/app/features/crypto/verification/request/VerificationRequestFragment.kt index 6887451a76..a466759eae 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/verification/request/VerificationRequestFragment.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/verification/request/VerificationRequestFragment.kt @@ -64,9 +64,7 @@ class VerificationRequestFragment : } override fun onClickOnVerificationStart(): Unit = withState(viewModel) { state -> - state.otherUserMxItem?.id?.let { otherUserId -> - viewModel.handle(VerificationAction.RequestVerificationByDM(otherUserId, state.roomId)) - } + viewModel.handle(VerificationAction.RequestVerificationByDM(state.otherUserId, state.roomId)) } override fun onClickRecoverFromPassphrase() { diff --git a/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt b/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt index 46b7efbb97..dd27b5550c 100644 --- a/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt +++ b/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt @@ -514,7 +514,7 @@ class HomeActivity : ) } - private fun promptSecurityEvent(userItem: MatrixItem.UserItem?, titleRes: Int, descRes: Int, action: ((VectorBaseActivity<*>) -> Unit)) { + private fun promptSecurityEvent(userItem: MatrixItem.UserItem, titleRes: Int, descRes: Int, action: ((VectorBaseActivity<*>) -> Unit)) { popupAlertManager.postVectorAlert( VerificationVectorAlert( uid = "upgradeSecurity", diff --git a/vector/src/main/java/im/vector/app/features/home/HomeActivityViewEvents.kt b/vector/src/main/java/im/vector/app/features/home/HomeActivityViewEvents.kt index e0b9e8ceb5..4147cf7186 100644 --- a/vector/src/main/java/im/vector/app/features/home/HomeActivityViewEvents.kt +++ b/vector/src/main/java/im/vector/app/features/home/HomeActivityViewEvents.kt @@ -20,13 +20,13 @@ import im.vector.app.core.platform.VectorViewEvents import org.matrix.android.sdk.api.util.MatrixItem sealed interface HomeActivityViewEvents : VectorViewEvents { - data class AskPasswordToInitCrossSigning(val userItem: MatrixItem.UserItem?) : HomeActivityViewEvents + data class AskPasswordToInitCrossSigning(val userItem: MatrixItem.UserItem) : HomeActivityViewEvents data class CurrentSessionNotVerified( - val userItem: MatrixItem.UserItem?, + val userItem: MatrixItem.UserItem, val waitForIncomingRequest: Boolean = true, ) : HomeActivityViewEvents data class CurrentSessionCannotBeVerified( - val userItem: MatrixItem.UserItem?, + val userItem: MatrixItem.UserItem, ) : HomeActivityViewEvents data class OnCrossSignedInvalidated(val userItem: MatrixItem.UserItem) : HomeActivityViewEvents object PromptToEnableSessionPush : HomeActivityViewEvents diff --git a/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt b/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt index 6aba9eefcf..cbe531ea71 100644 --- a/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt @@ -60,7 +60,7 @@ import org.matrix.android.sdk.api.raw.RawService import org.matrix.android.sdk.api.session.crypto.crosssigning.CrossSigningService import org.matrix.android.sdk.api.session.crypto.model.CryptoDeviceInfo import org.matrix.android.sdk.api.session.crypto.model.MXUsersDevicesMap -import org.matrix.android.sdk.api.session.getUser +import org.matrix.android.sdk.api.session.getUserOrDefault import org.matrix.android.sdk.api.session.pushrules.RuleIds import org.matrix.android.sdk.api.session.room.model.Membership import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams @@ -312,10 +312,10 @@ class HomeActivityViewModel @AssistedInject constructor( } else { // cross signing keys have been reset // Trigger a popup to re-verify - // Note: user can be null in case of logout - session.getUser(session.myUserId) - ?.toMatrixItem() - ?.let { user -> + // Note: user can be unknown in case of logout + session.getUserOrDefault(session.myUserId) + .toMatrixItem() + .let { user -> _viewEvents.post(HomeActivityViewEvents.OnCrossSignedInvalidated(user)) } } @@ -396,7 +396,7 @@ class HomeActivityViewModel @AssistedInject constructor( // New session _viewEvents.post( HomeActivityViewEvents.CurrentSessionNotVerified( - session.getUser(session.myUserId)?.toMatrixItem(), + session.getUserOrDefault(session.myUserId).toMatrixItem(), // Always send request instead of waiting for an incoming as per recent EW changes false ) @@ -404,7 +404,7 @@ class HomeActivityViewModel @AssistedInject constructor( } else { _viewEvents.post( HomeActivityViewEvents.CurrentSessionCannotBeVerified( - session.getUser(session.myUserId)?.toMatrixItem(), + session.getUserOrDefault(session.myUserId).toMatrixItem(), ) ) } @@ -424,7 +424,7 @@ class HomeActivityViewModel @AssistedInject constructor( // Check this is not an SSO account if (session.homeServerCapabilitiesService().getHomeServerCapabilities().canChangePassword) { // Ask password to the user: Upgrade security - _viewEvents.post(HomeActivityViewEvents.AskPasswordToInitCrossSigning(session.getUser(session.myUserId)?.toMatrixItem())) + _viewEvents.post(HomeActivityViewEvents.AskPasswordToInitCrossSigning(session.getUserOrDefault(session.myUserId).toMatrixItem())) } // Else (SSO) just ignore for the moment } else { diff --git a/vector/src/main/java/im/vector/app/features/home/UnknownDeviceDetectorSharedViewModel.kt b/vector/src/main/java/im/vector/app/features/home/UnknownDeviceDetectorSharedViewModel.kt index 34bdc5fcd3..855c47f4bb 100644 --- a/vector/src/main/java/im/vector/app/features/home/UnknownDeviceDetectorSharedViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/UnknownDeviceDetectorSharedViewModel.kt @@ -21,10 +21,13 @@ import com.airbnb.mvrx.MavericksState import com.airbnb.mvrx.MavericksViewModelFactory import com.airbnb.mvrx.Success import com.airbnb.mvrx.Uninitialized +import com.airbnb.mvrx.ViewModelContext import dagger.assisted.Assisted import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject +import dagger.hilt.EntryPoints import im.vector.app.core.di.MavericksAssistedViewModelFactory +import im.vector.app.core.di.SingletonEntryPoint import im.vector.app.core.di.hiltMavericksViewModelFactory import im.vector.app.core.platform.EmptyViewEvents import im.vector.app.core.platform.VectorViewModel @@ -40,14 +43,14 @@ import org.matrix.android.sdk.api.NoOpMatrixCallback import org.matrix.android.sdk.api.extensions.orFalse import org.matrix.android.sdk.api.session.Session import org.matrix.android.sdk.api.session.crypto.model.DeviceInfo -import org.matrix.android.sdk.api.session.getUser +import org.matrix.android.sdk.api.session.getUserOrDefault import org.matrix.android.sdk.api.util.MatrixItem import org.matrix.android.sdk.api.util.toMatrixItem import org.matrix.android.sdk.flow.flow import timber.log.Timber data class UnknownDevicesState( - val myMatrixItem: MatrixItem.UserItem? = null, + val myMatrixItem: MatrixItem.UserItem, val unknownSessions: Async> = Uninitialized ) : MavericksState @@ -73,7 +76,15 @@ class UnknownDeviceDetectorSharedViewModel @AssistedInject constructor( override fun create(initialState: UnknownDevicesState): UnknownDeviceDetectorSharedViewModel } - companion object : MavericksViewModelFactory by hiltMavericksViewModelFactory() + companion object : MavericksViewModelFactory by hiltMavericksViewModelFactory() { + override fun initialState(viewModelContext: ViewModelContext): UnknownDevicesState { + val session = EntryPoints.get(viewModelContext.app(), SingletonEntryPoint::class.java).activeSessionHolder().getActiveSession() + + return UnknownDevicesState( + myMatrixItem = session.getUserOrDefault(session.myUserId).toMatrixItem() + ) + } + } private val ignoredDeviceList = ArrayList() @@ -118,7 +129,7 @@ class UnknownDeviceDetectorSharedViewModel @AssistedInject constructor( .execute { async -> // Timber.v("## Detector trigger passed distinct") copy( - myMatrixItem = session.getUser(session.myUserId)?.toMatrixItem(), + myMatrixItem = session.getUserOrDefault(session.myUserId).toMatrixItem(), unknownSessions = async ) } diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/home/HomeRoomListViewModel.kt b/vector/src/main/java/im/vector/app/features/home/room/list/home/HomeRoomListViewModel.kt index 83ffc482ad..e06815b5fd 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/home/HomeRoomListViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/home/HomeRoomListViewModel.kt @@ -32,6 +32,7 @@ import im.vector.app.core.platform.StateView import im.vector.app.core.platform.VectorViewModel import im.vector.app.core.resources.DrawableProvider import im.vector.app.core.resources.StringProvider +import im.vector.app.features.displayname.getBestName import im.vector.app.features.home.room.list.home.header.HomeRoomFilter import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.Flow @@ -53,6 +54,7 @@ import org.matrix.android.sdk.api.query.RoomTagQueryFilter import org.matrix.android.sdk.api.query.toActiveSpaceOrNoFilter import org.matrix.android.sdk.api.session.Session import org.matrix.android.sdk.api.session.getRoom +import org.matrix.android.sdk.api.session.getUserOrDefault import org.matrix.android.sdk.api.session.room.RoomSortOrder import org.matrix.android.sdk.api.session.room.RoomSummaryQueryParams import org.matrix.android.sdk.api.session.room.UpdatableLivePageResult @@ -62,6 +64,7 @@ import org.matrix.android.sdk.api.session.room.model.tag.RoomTag import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams import org.matrix.android.sdk.api.session.room.state.isPublic import org.matrix.android.sdk.api.util.Optional +import org.matrix.android.sdk.api.util.toMatrixItem import org.matrix.android.sdk.flow.flow class HomeRoomListViewModel @AssistedInject constructor( @@ -298,7 +301,7 @@ class HomeRoomListViewModel @AssistedInject constructor( isBigImage = true ) } else { - val userName = session.userService().getUser(session.myUserId)?.displayName ?: "" + val userName = session.getUserOrDefault(session.myUserId).toMatrixItem().getBestName() StateView.State.Empty( title = stringProvider.getString(R.string.home_empty_no_rooms_title, userName), message = stringProvider.getString(R.string.home_empty_no_rooms_message), diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/home/NewChatBottomSheet.kt b/vector/src/main/java/im/vector/app/features/home/room/list/home/NewChatBottomSheet.kt index 0cba387a36..3f12ae4a63 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/home/NewChatBottomSheet.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/home/NewChatBottomSheet.kt @@ -42,14 +42,17 @@ class NewChatBottomSheet : VectorBaseBottomSheetDialogFragment