Update rust sdk to 0.1.37

This commit is contained in:
ganfra 2023-07-27 20:49:27 +02:00
parent 5f35852625
commit 69c42a3cbc
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" }
molecule-runtime = { module = "app.cash.molecule:molecule-runtime", version.ref = "molecule" }
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-jvm = { module = "com.squareup.sqldelight:sqlite-driver", 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
}.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 {
val listener = object : RoomListEntriesListener {
override fun onUpdate(roomEntriesUpdate: RoomListEntriesUpdate) {
trySendBlocking(roomEntriesUpdate)
override fun onUpdate(roomEntriesUpdates: List<RoomListEntriesUpdate>) {
trySendBlocking(roomEntriesUpdates)
}
}
val result = entries(listener)

View file

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

View file

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

View file

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