Update dependency org.matrix.rustcomponents:sdk-android to v0.1.96 (#2323)
* Update dependency org.matrix.rustcomponents:sdk-android to v0.1.96 * Fixes for the SDK upgrade --------- 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:
@@ -153,7 +153,7 @@ jsoup = "org.jsoup:jsoup:1.17.2"
|
||||
appyx_core = { module = "com.bumble.appyx:core", version.ref = "appyx" }
|
||||
molecule-runtime = "app.cash.molecule:molecule-runtime:1.3.2"
|
||||
timber = "com.jakewharton.timber:timber:5.0.1"
|
||||
matrix_sdk = "org.matrix.rustcomponents:sdk-android:0.1.95"
|
||||
matrix_sdk = "org.matrix.rustcomponents:sdk-android:0.1.96"
|
||||
matrix_richtexteditor = { module = "io.element.android:wysiwyg", version.ref = "wysiwyg" }
|
||||
matrix_richtexteditor_compose = { module = "io.element.android:wysiwyg-compose", version.ref = "wysiwyg" }
|
||||
sqldelight-driver-android = { module = "app.cash.sqldelight:android-driver", version.ref = "sqldelight" }
|
||||
|
||||
@@ -252,7 +252,5 @@ interface MatrixRoom : Closeable {
|
||||
*/
|
||||
fun getWidgetDriver(widgetSettings: MatrixWidgetSettings): Result<MatrixWidgetDriver>
|
||||
|
||||
fun pollHistory(): MatrixTimeline
|
||||
|
||||
override fun close() = destroy()
|
||||
}
|
||||
|
||||
@@ -76,11 +76,14 @@ import kotlinx.coroutines.withTimeout
|
||||
import org.matrix.rustcomponents.sdk.BackupState
|
||||
import org.matrix.rustcomponents.sdk.Client
|
||||
import org.matrix.rustcomponents.sdk.ClientDelegate
|
||||
import org.matrix.rustcomponents.sdk.FilterStateEventType
|
||||
import org.matrix.rustcomponents.sdk.FilterTimelineEventType
|
||||
import org.matrix.rustcomponents.sdk.NotificationProcessSetup
|
||||
import org.matrix.rustcomponents.sdk.PowerLevels
|
||||
import org.matrix.rustcomponents.sdk.Room
|
||||
import org.matrix.rustcomponents.sdk.RoomListItem
|
||||
import org.matrix.rustcomponents.sdk.TaskHandle
|
||||
import org.matrix.rustcomponents.sdk.TimelineEventTypeFilter
|
||||
import org.matrix.rustcomponents.sdk.use
|
||||
import timber.log.Timber
|
||||
import java.io.File
|
||||
@@ -198,6 +201,25 @@ class RustMatrixClient(
|
||||
),
|
||||
)
|
||||
|
||||
private val eventFilters = TimelineEventTypeFilter.exclude(
|
||||
listOf(
|
||||
FilterStateEventType.ROOM_ALIASES,
|
||||
FilterStateEventType.ROOM_CANONICAL_ALIAS,
|
||||
FilterStateEventType.ROOM_GUEST_ACCESS,
|
||||
FilterStateEventType.ROOM_HISTORY_VISIBILITY,
|
||||
FilterStateEventType.ROOM_JOIN_RULES,
|
||||
FilterStateEventType.ROOM_PINNED_EVENTS,
|
||||
FilterStateEventType.ROOM_POWER_LEVELS,
|
||||
FilterStateEventType.ROOM_SERVER_ACL,
|
||||
FilterStateEventType.ROOM_TOMBSTONE,
|
||||
FilterStateEventType.SPACE_CHILD,
|
||||
FilterStateEventType.SPACE_PARENT,
|
||||
FilterStateEventType.POLICY_RULE_ROOM,
|
||||
FilterStateEventType.POLICY_RULE_SERVER,
|
||||
FilterStateEventType.POLICY_RULE_USER,
|
||||
).map(FilterTimelineEventType::State)
|
||||
)
|
||||
|
||||
override val roomListService: RoomListService
|
||||
get() = rustRoomListService
|
||||
|
||||
@@ -248,7 +270,12 @@ class RustMatrixClient(
|
||||
|
||||
private suspend fun pairOfRoom(roomId: RoomId): Pair<RoomListItem, Room>? {
|
||||
val cachedRoomListItem = innerRoomListService.roomOrNull(roomId.value)
|
||||
val fullRoom = cachedRoomListItem?.fullRoom()
|
||||
val fullRoom = cachedRoomListItem?.let { roomListItem ->
|
||||
if (!roomListItem.isTimelineInitialized()) {
|
||||
roomListItem.initTimeline(eventFilters)
|
||||
}
|
||||
roomListItem.fullRoom()
|
||||
}
|
||||
return if (cachedRoomListItem == null || fullRoom == null) {
|
||||
Timber.d("No room cached for $roomId")
|
||||
null
|
||||
|
||||
@@ -50,7 +50,6 @@ import io.element.android.libraries.matrix.impl.notificationsettings.RustNotific
|
||||
import io.element.android.libraries.matrix.impl.poll.toInner
|
||||
import io.element.android.libraries.matrix.impl.room.location.toInner
|
||||
import io.element.android.libraries.matrix.impl.room.member.RoomMemberListFetcher
|
||||
import io.element.android.libraries.matrix.impl.timeline.AsyncMatrixTimeline
|
||||
import io.element.android.libraries.matrix.impl.timeline.RustMatrixTimeline
|
||||
import io.element.android.libraries.matrix.impl.util.mxCallbackFlow
|
||||
import io.element.android.libraries.matrix.impl.widget.RustWidgetDriver
|
||||
@@ -545,14 +544,6 @@ class RustMatrixRoom(
|
||||
)
|
||||
}
|
||||
|
||||
override fun pollHistory() = AsyncMatrixTimeline(
|
||||
coroutineScope = roomCoroutineScope,
|
||||
dispatcher = roomDispatcher
|
||||
) {
|
||||
val innerTimeline = innerRoom.pollHistory()
|
||||
createMatrixTimeline(innerTimeline)
|
||||
}
|
||||
|
||||
private fun sendAttachment(files: List<File>, handle: () -> SendAttachmentJoinHandle): Result<MediaUploadHandler> {
|
||||
return runCatching {
|
||||
MediaUploadHandlerImpl(files, handle())
|
||||
|
||||
@@ -38,6 +38,7 @@ import timber.log.Timber
|
||||
/**
|
||||
* This class is a wrapper around a [MatrixTimeline] that will be created asynchronously.
|
||||
*/
|
||||
@Suppress("unused")
|
||||
class AsyncMatrixTimeline(
|
||||
coroutineScope: CoroutineScope,
|
||||
dispatcher: CoroutineDispatcher,
|
||||
|
||||
@@ -443,10 +443,6 @@ class FakeMatrixRoom(
|
||||
|
||||
override fun getWidgetDriver(widgetSettings: MatrixWidgetSettings): Result<MatrixWidgetDriver> = getWidgetDriverResult
|
||||
|
||||
override fun pollHistory(): MatrixTimeline {
|
||||
return FakeMatrixTimeline()
|
||||
}
|
||||
|
||||
fun givenLeaveRoomError(throwable: Throwable?) {
|
||||
this.leaveRoomError = throwable
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.matrix.ui.room
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.DisposableEffect
|
||||
import androidx.compose.runtime.remember
|
||||
import io.element.android.libraries.matrix.api.room.MatrixRoom
|
||||
import io.element.android.libraries.matrix.api.timeline.MatrixTimeline
|
||||
|
||||
@Composable
|
||||
fun MatrixRoom.rememberPollHistory(): MatrixTimeline {
|
||||
val pollHistory = remember {
|
||||
pollHistory()
|
||||
}
|
||||
DisposableEffect(pollHistory) {
|
||||
onDispose {
|
||||
pollHistory.close()
|
||||
}
|
||||
}
|
||||
return pollHistory
|
||||
}
|
||||
Reference in New Issue
Block a user