Update rust sdk to 0.1.37
This commit is contained in:
parent
5f35852625
commit
69c42a3cbc
6 changed files with 20 additions and 14 deletions
|
|
@ -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" }
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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 ->
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ class TimelineEventContentMapper(private val eventMessageMapper: EventMessageMap
|
|||
data = kind.msg.map()
|
||||
)
|
||||
}
|
||||
else -> UnknownContent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue