fix(deps): update dependency org.matrix.rustcomponents:sdk-android to v25.6.25 (#4936)
Fix broken API changes: - `RoomInfo.isPublic` is now optional, so we need to assume its default value in some places of the app. - `RoomInfo.userPowerLevels` is now `RoomInfo.roomPowerLevels` and also contains this info. - `ClientBuilder` now uses a `DecryptionSettings` value. - The call widget settings provider now internally uses a different Rust type. - `Client.clearCache` now takes a `syncService` so it can stop it. --- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jorge Martín <jorgem@element.io>
This commit is contained in:
parent
ef9436ed8d
commit
7d3f4cbb09
28 changed files with 148 additions and 60 deletions
|
|
@ -129,7 +129,7 @@ class RustMatrixClient(
|
|||
private val sessionStore: SessionStore,
|
||||
private val appCoroutineScope: CoroutineScope,
|
||||
private val sessionDelegate: RustClientSessionDelegate,
|
||||
innerSyncService: ClientSyncService,
|
||||
private val innerSyncService: ClientSyncService,
|
||||
dispatchers: CoroutineDispatchers,
|
||||
baseCacheDirectory: File,
|
||||
clock: SystemClock,
|
||||
|
|
@ -531,7 +531,7 @@ class RustMatrixClient(
|
|||
}
|
||||
|
||||
override suspend fun clearCache() {
|
||||
innerClient.clearCaches()
|
||||
innerClient.clearCaches(innerSyncService)
|
||||
destroy()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import org.matrix.rustcomponents.sdk.SlidingSyncVersionBuilder
|
|||
import org.matrix.rustcomponents.sdk.use
|
||||
import timber.log.Timber
|
||||
import uniffi.matrix_sdk_crypto.CollectStrategy
|
||||
import uniffi.matrix_sdk_crypto.DecryptionSettings
|
||||
import uniffi.matrix_sdk_crypto.TrustRequirement
|
||||
import java.io.File
|
||||
import javax.inject.Inject
|
||||
|
|
@ -120,12 +121,14 @@ class RustMatrixClientFactory @Inject constructor(
|
|||
CollectStrategy.ERROR_ON_VERIFIED_USER_PROBLEM
|
||||
}
|
||||
)
|
||||
.roomDecryptionTrustRequirement(
|
||||
trustRequirement = if (featureFlagService.isFeatureEnabled(FeatureFlags.OnlySignedDeviceIsolationMode)) {
|
||||
TrustRequirement.CROSS_SIGNED_OR_LEGACY
|
||||
} else {
|
||||
TrustRequirement.UNTRUSTED
|
||||
}
|
||||
.decryptionSettings(
|
||||
DecryptionSettings(
|
||||
senderDeviceTrustRequirement = if (featureFlagService.isFeatureEnabled(FeatureFlags.OnlySignedDeviceIsolationMode)) {
|
||||
TrustRequirement.CROSS_SIGNED_OR_LEGACY
|
||||
} else {
|
||||
TrustRequirement.UNTRUSTED
|
||||
}
|
||||
)
|
||||
)
|
||||
.enableShareHistoryOnInvite(featureFlagService.isFeatureEnabled(FeatureFlags.EnableKeyShareOnInvite))
|
||||
.run {
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ class JoinedRustRoom(
|
|||
}
|
||||
|
||||
init {
|
||||
val powerLevelChanges = roomInfoFlow.map { it.userPowerLevels }.distinctUntilChanged()
|
||||
val powerLevelChanges = roomInfoFlow.map { it.roomPowerLevels }.distinctUntilChanged()
|
||||
val membershipChanges = liveTimeline.membershipChangeEventReceived.onStart { emit(Unit) }
|
||||
combine(membershipChanges, powerLevelChanges) { _, _ -> }
|
||||
// Skip initial one
|
||||
|
|
|
|||
|
|
@ -14,12 +14,13 @@ import io.element.android.libraries.matrix.api.core.UserId
|
|||
import io.element.android.libraries.matrix.api.room.CurrentUserMembership
|
||||
import io.element.android.libraries.matrix.api.room.RoomInfo
|
||||
import io.element.android.libraries.matrix.api.room.RoomNotificationMode
|
||||
import io.element.android.libraries.matrix.api.room.powerlevels.RoomPowerLevels
|
||||
import io.element.android.libraries.matrix.api.user.MatrixUser
|
||||
import io.element.android.libraries.matrix.impl.room.history.map
|
||||
import io.element.android.libraries.matrix.impl.room.join.map
|
||||
import io.element.android.libraries.matrix.impl.room.member.RoomMemberMapper
|
||||
import io.element.android.libraries.matrix.impl.room.powerlevels.RoomPowerLevelsValuesMapper
|
||||
import io.element.android.libraries.matrix.impl.room.tombstone.map
|
||||
import kotlinx.collections.immutable.ImmutableMap
|
||||
import kotlinx.collections.immutable.toImmutableList
|
||||
import kotlinx.collections.immutable.toPersistentMap
|
||||
import org.matrix.rustcomponents.sdk.Membership
|
||||
|
|
@ -28,6 +29,7 @@ import uniffi.matrix_sdk_base.EncryptionState
|
|||
import org.matrix.rustcomponents.sdk.Membership as RustMembership
|
||||
import org.matrix.rustcomponents.sdk.RoomInfo as RustRoomInfo
|
||||
import org.matrix.rustcomponents.sdk.RoomNotificationMode as RustRoomNotificationMode
|
||||
import org.matrix.rustcomponents.sdk.RoomPowerLevels as RustRoomPowerLevels
|
||||
|
||||
class RoomInfoMapper {
|
||||
fun map(rustRoomInfo: RustRoomInfo): RoomInfo = rustRoomInfo.let {
|
||||
|
|
@ -55,7 +57,7 @@ class RoomInfoMapper {
|
|||
activeMembersCount = it.activeMembersCount.toLong(),
|
||||
invitedMembersCount = it.invitedMembersCount.toLong(),
|
||||
joinedMembersCount = it.joinedMembersCount.toLong(),
|
||||
userPowerLevels = mapPowerLevels(it.userPowerLevels),
|
||||
roomPowerLevels = it.powerLevels?.let(::mapPowerLevels),
|
||||
highlightCount = it.highlightCount.toLong(),
|
||||
notificationCount = it.notificationCount.toLong(),
|
||||
userDefinedNotificationMode = it.cachedUserDefinedNotificationMode?.map(),
|
||||
|
|
@ -96,6 +98,9 @@ fun RoomHero.map(): MatrixUser = MatrixUser(
|
|||
avatarUrl = avatarUrl
|
||||
)
|
||||
|
||||
fun mapPowerLevels(powerLevels: Map<String, Long>): ImmutableMap<UserId, Long> {
|
||||
return powerLevels.mapKeys { (key, _) -> UserId(key) }.toPersistentMap()
|
||||
fun mapPowerLevels(roomPowerLevels: RustRoomPowerLevels): RoomPowerLevels {
|
||||
return RoomPowerLevels(
|
||||
values = RoomPowerLevelsValuesMapper.map(roomPowerLevels.values()),
|
||||
users = roomPowerLevels.userPowerLevels().mapKeys { (key, _) -> UserId(key) }.toPersistentMap()
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ object RoomPreviewInfoMapper {
|
|||
roomType = info.roomType.map(),
|
||||
isHistoryWorldReadable = info.isHistoryWorldReadable.orFalse(),
|
||||
membership = info.membership?.map(),
|
||||
joinRule = info.joinRule.map(),
|
||||
joinRule = info.joinRule?.map(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ import io.element.android.libraries.matrix.api.widget.CallWidgetSettingsProvider
|
|||
import io.element.android.libraries.matrix.api.widget.MatrixWidgetSettings
|
||||
import io.element.android.services.analytics.api.AnalyticsService
|
||||
import kotlinx.coroutines.flow.first
|
||||
import org.matrix.rustcomponents.sdk.EncryptionSystem
|
||||
import org.matrix.rustcomponents.sdk.VirtualElementCallWidgetOptions
|
||||
import org.matrix.rustcomponents.sdk.newVirtualElementCallWidget
|
||||
import uniffi.matrix_sdk.EncryptionSystem
|
||||
import uniffi.matrix_sdk.VirtualElementCallWidgetOptions
|
||||
import javax.inject.Inject
|
||||
import org.matrix.rustcomponents.sdk.Intent as CallIntent
|
||||
import uniffi.matrix_sdk.Intent as CallIntent
|
||||
|
||||
@ContributesBinding(AppScope::class)
|
||||
class DefaultCallWidgetSettingsProvider @Inject constructor(
|
||||
|
|
@ -50,6 +50,7 @@ class DefaultCallWidgetSettingsProvider @Inject constructor(
|
|||
parentUrl = null,
|
||||
hideHeader = true,
|
||||
controlledMediaDevices = true,
|
||||
header = null,
|
||||
)
|
||||
val rustWidgetSettings = newVirtualElementCallWidget(options)
|
||||
return MatrixWidgetSettings.fromRustWidgetSettings(rustWidgetSettings)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue