diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt index b7cd2d2061..101d049659 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt @@ -398,7 +398,7 @@ class RustMatrixClient( sessionDispatcher ) { runCatching { - client.knock(roomIdOrAlias.identifier).destroy() + client.knock(roomIdOrAlias.identifier, message, serverNames).destroy() try { awaitRoom(roomIdOrAlias, 10.seconds, CurrentUserMembership.KNOCKED) } catch (e: Exception) { diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RoomSyncSubscriber.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RoomSyncSubscriber.kt index 9ad27a7914..3ffb87cbaf 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RoomSyncSubscriber.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RoomSyncSubscriber.kt @@ -9,18 +9,13 @@ package io.element.android.libraries.matrix.impl.room import io.element.android.libraries.core.coroutine.CoroutineDispatchers import io.element.android.libraries.matrix.api.core.RoomId -import io.element.android.libraries.matrix.api.timeline.item.event.EventType import kotlinx.coroutines.CancellationException import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock import kotlinx.coroutines.withContext -import org.matrix.rustcomponents.sdk.RequiredState import org.matrix.rustcomponents.sdk.RoomListService -import org.matrix.rustcomponents.sdk.RoomSubscription import timber.log.Timber -private const val DEFAULT_TIMELINE_LIMIT = 20u - class RoomSyncSubscriber( private val roomListService: RoomListService, private val dispatchers: CoroutineDispatchers, @@ -28,28 +23,13 @@ class RoomSyncSubscriber( private val subscribedRoomIds = mutableSetOf() private val mutex = Mutex() - private val settings = RoomSubscription( - requiredState = listOf( - RequiredState(key = EventType.STATE_ROOM_NAME, value = ""), - RequiredState(key = EventType.STATE_ROOM_TOPIC, value = ""), - RequiredState(key = EventType.STATE_ROOM_AVATAR, value = ""), - RequiredState(key = EventType.STATE_ROOM_CANONICAL_ALIAS, value = ""), - RequiredState(key = EventType.STATE_ROOM_JOIN_RULES, value = ""), - RequiredState(key = EventType.STATE_ROOM_POWER_LEVELS, value = ""), - RequiredState(key = EventType.STATE_ROOM_PINNED_EVENT, value = ""), - ), - timelineLimit = DEFAULT_TIMELINE_LIMIT, - // We don't need heroes here as they're already included in the `all_rooms` list - includeHeroes = false, - ) - suspend fun subscribe(roomId: RoomId) { mutex.withLock { withContext(dispatchers.io) { try { if (!isSubscribedTo(roomId)) { Timber.d("Subscribing to room $roomId}") - roomListService.subscribeToRooms(listOf(roomId.value), settings) + roomListService.subscribeToRooms(listOf(roomId.value)) } subscribedRoomIds.add(roomId) } catch (exception: Exception) { @@ -65,7 +45,7 @@ class RoomSyncSubscriber( val roomIdsToSubscribeTo = roomIds.filterNot { isSubscribedTo(it) } if (roomIdsToSubscribeTo.isNotEmpty()) { Timber.d("Subscribing to rooms: $roomIds") - roomListService.subscribeToRooms(roomIdsToSubscribeTo.map { it.value }, settings) + roomListService.subscribeToRooms(roomIdsToSubscribeTo.map { it.value }) subscribedRoomIds.addAll(roomIds) } } catch (cancellationException: CancellationException) { diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt index 56c9cf4d85..af597a88ab 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt @@ -339,6 +339,7 @@ class RustTimeline( formattedCaption = formattedBody?.let { FormattedBody(body = it, format = MessageFormat.Html) }, + storeInCache = true, progressWatcher = progressCallback?.toProgressWatcher() ) } @@ -361,6 +362,7 @@ class RustTimeline( formattedCaption = formattedBody?.let { FormattedBody(body = it, format = MessageFormat.Html) }, + storeInCache = true, progressWatcher = progressCallback?.toProgressWatcher() ) } @@ -374,6 +376,7 @@ class RustTimeline( // Maybe allow a caption in the future? caption = null, formattedCaption = null, + storeInCache = true, progressWatcher = progressCallback?.toProgressWatcher() ) } @@ -381,7 +384,7 @@ class RustTimeline( override suspend fun sendFile(file: File, fileInfo: FileInfo, progressCallback: ProgressCallback?): Result { return sendAttachment(listOf(file)) { - inner.sendFile(file.path, fileInfo.map(), progressCallback?.toProgressWatcher()) + inner.sendFile(file.path, fileInfo.map(), false, progressCallback?.toProgressWatcher()) } } @@ -496,6 +499,7 @@ class RustTimeline( // Maybe allow a caption in the future? caption = null, formattedCaption = null, + storeInCache = true, progressWatcher = progressCallback?.toProgressWatcher(), ) }