Update rust sdk to 0.1.37

This commit is contained in:
ganfra 2023-07-27 20:49:27 +02:00
parent 925b399c49
commit 5547b6278e
6 changed files with 20 additions and 14 deletions

View file

@ -145,7 +145,7 @@ jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" }
appyx_core = { module = "com.bumble.appyx:core", version.ref = "appyx" } appyx_core = { module = "com.bumble.appyx:core", version.ref = "appyx" }
molecule-runtime = { module = "app.cash.molecule:molecule-runtime", version.ref = "molecule" } molecule-runtime = { module = "app.cash.molecule:molecule-runtime", version.ref = "molecule" }
timber = "com.jakewharton.timber:timber:5.0.1" timber = "com.jakewharton.timber:timber:5.0.1"
matrix_sdk = "org.matrix.rustcomponents:sdk-android:0.1.36" matrix_sdk = "org.matrix.rustcomponents:sdk-android:0.1.37"
sqldelight-driver-android = { module = "com.squareup.sqldelight:android-driver", version.ref = "sqldelight" } sqldelight-driver-android = { module = "com.squareup.sqldelight:android-driver", version.ref = "sqldelight" }
sqldelight-driver-jvm = { module = "com.squareup.sqldelight:sqlite-driver", version.ref = "sqldelight" } sqldelight-driver-jvm = { module = "com.squareup.sqldelight:sqlite-driver", version.ref = "sqldelight" }
sqldelight-coroutines = { module = "com.squareup.sqldelight:coroutines-extensions", version.ref = "sqldelight" } sqldelight-coroutines = { module = "com.squareup.sqldelight:coroutines-extensions", version.ref = "sqldelight" }

View file

@ -46,11 +46,11 @@ fun RoomList.loadingStateFlow(): Flow<RoomListLoadingState> =
result.stateStream result.stateStream
}.buffer(Channel.UNLIMITED) }.buffer(Channel.UNLIMITED)
fun RoomList.entriesFlow(onInitialList: suspend (List<RoomListEntry>) -> Unit): Flow<RoomListEntriesUpdate> = fun RoomList.entriesFlow(onInitialList: suspend (List<RoomListEntry>) -> Unit): Flow<List<RoomListEntriesUpdate>> =
mxCallbackFlow { mxCallbackFlow {
val listener = object : RoomListEntriesListener { val listener = object : RoomListEntriesListener {
override fun onUpdate(roomEntriesUpdate: RoomListEntriesUpdate) { override fun onUpdate(roomEntriesUpdates: List<RoomListEntriesUpdate>) {
trySendBlocking(roomEntriesUpdate) trySendBlocking(roomEntriesUpdates)
} }
} }
val result = entries(listener) val result = entries(listener)

View file

@ -50,12 +50,14 @@ class RoomSummaryListProcessor(
initLatch.complete(Unit) initLatch.complete(Unit)
} }
suspend fun postUpdate(update: RoomListEntriesUpdate) { suspend fun postUpdate(updates: List<RoomListEntriesUpdate>) {
// Makes sure to process first entries before update. // Makes sure to process first entries before update.
initLatch.await() initLatch.await()
updateRoomSummaries { updateRoomSummaries {
Timber.v("Update rooms from postUpdate ($update) on ${Thread.currentThread()}") Timber.v("Update rooms from postUpdates (with ${updates.size} items) on ${Thread.currentThread()}")
applyUpdate(update) updates.forEach { update ->
applyUpdate(update)
}
} }
} }

View file

@ -364,13 +364,16 @@ class RustMatrixRoom(
) )
} }
} }
}
//TODO handle cancellation, need refactoring of how we are catching errors //TODO handle cancellation, need refactoring of how we are catching errors
private suspend fun sendAttachment(handle: () -> SendAttachmentJoinHandle): Result<Unit> { private suspend fun sendAttachment(handle: () -> SendAttachmentJoinHandle): Result<Unit> = withContext(roomDispatcher) {
return runCatching { runCatching {
handle().use { handle().use {
it.join() it.join()
}
} }
} }
} }

View file

@ -112,7 +112,7 @@ private fun RoomListLoadingState.toRoomSummaryDataSourceLoadingState(): RoomSumm
} }
} }
private fun RoomList.observeEntriesWithProcessor(processor: RoomSummaryListProcessor): Flow<RoomListEntriesUpdate> { private fun RoomList.observeEntriesWithProcessor(processor: RoomSummaryListProcessor): Flow<List<RoomListEntriesUpdate>> {
return entriesFlow { roomListEntries -> return entriesFlow { roomListEntries ->
processor.postEntries(roomListEntries) processor.postEntries(roomListEntries)
}.onEach { update -> }.onEach { update ->

View file

@ -96,6 +96,7 @@ class TimelineEventContentMapper(private val eventMessageMapper: EventMessageMap
data = kind.msg.map() data = kind.msg.map()
) )
} }
else -> UnknownContent
} }
} }
} }