diff --git a/CHANGES.md b/CHANGES.md index 594ac8e84d..e9789c1414 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,8 @@ Features ✨: Improvements 🙌: - Split network request `/keys/query` into smaller requests (250 users max) (#2925) + - Crypto improvement | Bulk send NO_OLM withheld code + - Display the room shield in all room setting screens Bugfix 🐛: - diff --git a/build.gradle b/build.gradle index ec7ec8c1de..4e2c81a379 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ buildscript { } } dependencies { - classpath 'com.android.tools.build:gradle:4.1.2' + classpath 'com.android.tools.build:gradle:4.1.3' classpath 'com.google.gms:google-services:4.3.5' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.1.1' diff --git a/matrix-sdk-android/build.gradle b/matrix-sdk-android/build.gradle index c9918cceaf..5ca5ce1e05 100644 --- a/matrix-sdk-android/build.gradle +++ b/matrix-sdk-android/build.gradle @@ -166,13 +166,13 @@ dependencies { implementation 'com.facebook.stetho:stetho-okhttp3:1.5.1' // Phone number https://github.com/google/libphonenumber - implementation 'com.googlecode.libphonenumber:libphonenumber:8.12.19' + implementation 'com.googlecode.libphonenumber:libphonenumber:8.12.20' testImplementation 'junit:junit:4.13.2' testImplementation 'org.robolectric:robolectric:4.5.1' //testImplementation 'org.robolectric:shadows-support-v4:3.0' // Note: version sticks to 1.9.2 due to https://github.com/mockk/mockk/issues/281 - testImplementation 'io.mockk:mockk:1.10.6' + testImplementation 'io.mockk:mockk:1.11.0' testImplementation 'org.amshove.kluent:kluent-android:1.65' testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version" // Plant Timber tree for test @@ -186,7 +186,7 @@ dependencies { androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' androidTestImplementation 'org.amshove.kluent:kluent-android:1.61' // Note: version sticks to 1.9.2 due to https://github.com/mockk/mockk/issues/281 - androidTestImplementation 'io.mockk:mockk-android:1.10.6' + androidTestImplementation 'io.mockk:mockk-android:1.11.0' androidTestImplementation "androidx.arch.core:core-testing:$arch_version" androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version" // Plant Timber tree for test diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/megolm/MXMegolmEncryption.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/megolm/MXMegolmEncryption.kt index 6b91c0b859..697711d051 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/megolm/MXMegolmEncryption.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/megolm/MXMegolmEncryption.kt @@ -67,8 +67,9 @@ internal class MXMegolmEncryption( init { // restore existing outbound session if any - outboundSession = olmDevice.restoreOutboundGroupSessionForRoom(roomId) + outboundSession = olmDevice.restoreOutboundGroupSessionForRoom(roomId) } + // Default rotation periods // TODO: Make it configurable via parameters // Session rotation periods @@ -125,6 +126,7 @@ internal class MXMegolmEncryption( Timber.v("## CRYPTO | preshareKey ${System.currentTimeMillis() - ts} millis") } + /** * Prepare a new session. * @@ -240,6 +242,7 @@ internal class MXMegolmEncryption( val contentMap = MXUsersDevicesMap() var haveTargets = false val userIds = results.userIds + val noOlmToNotify = mutableListOf() for (userId in userIds) { val devicesToShareWith = devicesByUser[userId] for ((deviceID) in devicesToShareWith!!) { @@ -251,13 +254,7 @@ internal class MXMegolmEncryption( // MSC 2399 // send withheld m.no_olm: an olm session could not be established. // This may happen, for example, if the sender was unable to obtain a one-time key from the recipient. - notifyKeyWithHeld( - listOf(UserDevice(userId, deviceID)), - session.sessionId, - olmDevice.deviceCurve25519Key, - WithHeldCode.NO_OLM - ) - + noOlmToNotify.add(UserDevice(userId, deviceID)) continue } Timber.i("## CRYPTO | shareUserDevicesKey() : Add to share keys contentMap for $userId:$deviceID") @@ -277,14 +274,14 @@ internal class MXMegolmEncryption( session.sharedWithHelper.markedSessionAsShared(userId, deviceId, chainIndex) gossipingEventBuffer.add( Event( - type = EventType.ROOM_KEY, - senderId = this.userId, - content = submap.apply { - this["session_key"] = "" - // we add a fake key for trail - this["_dest"] = "$userId|$deviceId" - } - )) + type = EventType.ROOM_KEY, + senderId = this.userId, + content = submap.apply { + this["session_key"] = "" + // we add a fake key for trail + this["_dest"] = "$userId|$deviceId" + } + )) } } @@ -304,6 +301,16 @@ internal class MXMegolmEncryption( } else { Timber.i("## CRYPTO | shareUserDevicesKey() : no need to sharekey") } + + if (noOlmToNotify.isNotEmpty()) { + // XXX offload?, as they won't read the message anyhow? + notifyKeyWithHeld( + noOlmToNotify, + session.sessionId, + olmDevice.deviceCurve25519Key, + WithHeldCode.NO_OLM + ) + } } private suspend fun notifyKeyWithHeld(targets: List, diff --git a/vector/build.gradle b/vector/build.gradle index 008a165aae..70538b100a 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -290,7 +290,7 @@ android { dependencies { - def epoxy_version = '4.4.2' + def epoxy_version = '4.4.3' def fragment_version = '1.3.0' def arrow_version = "0.8.2" def markwon_version = '4.1.2' @@ -342,7 +342,7 @@ dependencies { implementation 'com.facebook.stetho:stetho:1.5.1' // Phone number https://github.com/google/libphonenumber - implementation 'com.googlecode.libphonenumber:libphonenumber:8.12.19' + implementation 'com.googlecode.libphonenumber:libphonenumber:8.12.20' // rx implementation 'io.reactivex.rxjava2:rxkotlin:2.4.0' diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/alias/RoomAliasFragment.kt b/vector/src/main/java/im/vector/app/features/roomprofile/alias/RoomAliasFragment.kt index 2fc1575341..1c5f8fe3af 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/alias/RoomAliasFragment.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/alias/RoomAliasFragment.kt @@ -128,6 +128,7 @@ class RoomAliasFragment @Inject constructor( state.roomSummary()?.let { views.roomSettingsToolbarTitleView.text = it.displayName avatarRenderer.render(it.toMatrixItem(), views.roomSettingsToolbarAvatarImageView) + views.roomSettingsDecorationToolbarAvatarImageView.render(it.roomEncryptionTrustLevel) } } diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/banned/RoomBannedMemberListFragment.kt b/vector/src/main/java/im/vector/app/features/roomprofile/banned/RoomBannedMemberListFragment.kt index 556d950230..620d65781c 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/banned/RoomBannedMemberListFragment.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/banned/RoomBannedMemberListFragment.kt @@ -117,6 +117,7 @@ class RoomBannedMemberListFragment @Inject constructor( state.roomSummary()?.let { views.roomSettingsToolbarTitleView.text = it.displayName avatarRenderer.render(it.toMatrixItem(), views.roomSettingsToolbarAvatarImageView) + views.roomSettingsDecorationToolbarAvatarImageView.render(it.roomEncryptionTrustLevel) } } } diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListFragment.kt b/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListFragment.kt index 1db9200451..2ff89d6e54 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListFragment.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListFragment.kt @@ -140,6 +140,7 @@ class RoomMemberListFragment @Inject constructor( state.roomSummary()?.let { views.roomSettingGeneric.roomSettingsToolbarTitleView.text = it.displayName avatarRenderer.render(it.toMatrixItem(), views.roomSettingGeneric.roomSettingsToolbarAvatarImageView) + views.roomSettingGeneric.roomSettingsDecorationToolbarAvatarImageView.render(it.roomEncryptionTrustLevel) } } } diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/permissions/RoomPermissionsFragment.kt b/vector/src/main/java/im/vector/app/features/roomprofile/permissions/RoomPermissionsFragment.kt index 61635c9b31..a538c9269b 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/permissions/RoomPermissionsFragment.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/permissions/RoomPermissionsFragment.kt @@ -91,6 +91,7 @@ class RoomPermissionsFragment @Inject constructor( state.roomSummary()?.let { views.roomSettingsToolbarTitleView.text = it.displayName avatarRenderer.render(it.toMatrixItem(), views.roomSettingsToolbarAvatarImageView) + views.roomSettingsDecorationToolbarAvatarImageView.render(it.roomEncryptionTrustLevel) } } diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/settings/RoomSettingsFragment.kt b/vector/src/main/java/im/vector/app/features/roomprofile/settings/RoomSettingsFragment.kt index e431dbfcd6..129888ee04 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/settings/RoomSettingsFragment.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/settings/RoomSettingsFragment.kt @@ -154,6 +154,7 @@ class RoomSettingsFragment @Inject constructor( state.roomSummary()?.let { views.roomSettingsToolbarTitleView.text = it.displayName avatarRenderer.render(it.toMatrixItem(), views.roomSettingsToolbarAvatarImageView) + views.roomSettingsDecorationToolbarAvatarImageView.render(it.roomEncryptionTrustLevel) } invalidateOptionsMenu() diff --git a/vector/src/main/res/layout/fragment_room_setting_generic.xml b/vector/src/main/res/layout/fragment_room_setting_generic.xml index c11ce07062..9c3827f919 100644 --- a/vector/src/main/res/layout/fragment_room_setting_generic.xml +++ b/vector/src/main/res/layout/fragment_room_setting_generic.xml @@ -34,6 +34,15 @@ app:layout_constraintTop_toTopOf="parent" tools:src="@tools:sample/avatars" /> + +