Bump Rust SDK to v0.2.18 and bump app version (#2836)
* Adapt to changes in SDK:
- Remove name from MatrixRoom, we should use displayName instead.
- Remove separate invites room list.
- Added runBlocking to get the now async NotificationClient from the Rust SDK.
- Made some other functions suspend.
- Client.resolveRoomAlias now returns a roomId and via parameters, we pass the roomId.
* Add logs removal migration again as `AppMigration03` to make sure we don't leak private data in existing logs.
* Bump app version to `0.4.12`
This commit is contained in:
parent
d0923f21cd
commit
f2f96e0e0a
24 changed files with 111 additions and 79 deletions
|
|
@ -96,6 +96,7 @@ import kotlinx.coroutines.flow.flow
|
|||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.flow.stateIn
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlinx.coroutines.withTimeout
|
||||
import org.matrix.rustcomponents.sdk.BackupState
|
||||
|
|
@ -145,12 +146,7 @@ class RustMatrixClient(
|
|||
dispatchers = dispatchers,
|
||||
)
|
||||
private val notificationProcessSetup = NotificationProcessSetup.SingleProcess(syncService)
|
||||
private val notificationClient = client.notificationClient(notificationProcessSetup)
|
||||
.use { builder ->
|
||||
builder
|
||||
.filterByPushRules()
|
||||
.finish()
|
||||
}
|
||||
private val notificationClient = runBlocking { client.notificationClient(notificationProcessSetup) }
|
||||
private val notificationService = RustNotificationService(sessionId, notificationClient, dispatchers, clock)
|
||||
private val notificationSettingsService = RustNotificationSettingsService(client, dispatchers)
|
||||
.apply { start() }
|
||||
|
|
@ -465,7 +461,7 @@ class RustMatrixClient(
|
|||
|
||||
override suspend fun resolveRoomAlias(roomAlias: RoomAlias): Result<RoomId> = withContext(sessionDispatcher) {
|
||||
runCatching {
|
||||
client.resolveRoomAlias(roomAlias.value).let(::RoomId)
|
||||
client.resolveRoomAlias(roomAlias.value).roomId.let(::RoomId)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,6 @@ class RustMatrixClientFactory @Inject constructor(
|
|||
|
||||
val syncService = client.syncService()
|
||||
.withUtdHook(utdTracker)
|
||||
.withUnifiedInvitesInRoomList(true)
|
||||
.finish()
|
||||
|
||||
RustMatrixClient(
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class MatrixRoomInfoMapper(
|
|||
fun map(rustRoomInfo: RustRoomInfo): MatrixRoomInfo = rustRoomInfo.use {
|
||||
return MatrixRoomInfo(
|
||||
id = RoomId(it.id),
|
||||
name = it.name,
|
||||
name = it.displayName,
|
||||
topic = it.topic,
|
||||
avatarUrl = it.avatarUrl,
|
||||
isDirect = it.isDirect,
|
||||
|
|
|
|||
|
|
@ -191,9 +191,6 @@ class RustMatrixRoom(
|
|||
roomListItem.destroy()
|
||||
}
|
||||
|
||||
override val name: String?
|
||||
get() = runCatching { roomListItem.name() }.getOrDefault(null)
|
||||
|
||||
override val displayName: String
|
||||
get() = runCatching { innerRoom.displayName() }.getOrDefault("")
|
||||
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ internal fun RoomListServiceInterface.syncIndicator(): Flow<RoomListServiceSyncI
|
|||
}
|
||||
}.buffer(Channel.UNLIMITED)
|
||||
|
||||
internal fun RoomListServiceInterface.roomOrNull(roomId: String): RoomListItem? {
|
||||
internal suspend fun RoomListServiceInterface.roomOrNull(roomId: String): RoomListItem? {
|
||||
return try {
|
||||
room(roomId)
|
||||
} catch (exception: Exception) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class RoomSummaryDetailsFactory(private val roomMessageFactory: RoomMessageFacto
|
|||
}
|
||||
return RoomSummaryDetails(
|
||||
roomId = RoomId(roomInfo.id),
|
||||
name = roomInfo.name,
|
||||
name = roomInfo.displayName,
|
||||
canonicalAlias = roomInfo.canonicalAlias?.let(::RoomAlias),
|
||||
isDirect = roomInfo.isDirect,
|
||||
avatarUrl = roomInfo.avatarUrl,
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ internal class RustRoomListService(
|
|||
) {
|
||||
when (source) {
|
||||
RoomList.Source.All -> innerRoomListService.allRooms()
|
||||
RoomList.Source.Invites -> innerRoomListService.invites()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -70,13 +69,6 @@ internal class RustRoomListService(
|
|||
innerRoomListService.allRooms()
|
||||
}
|
||||
|
||||
override val invites: RoomList = roomListFactory.createRoomList(
|
||||
pageSize = Int.MAX_VALUE,
|
||||
coroutineContext = sessionDispatcher,
|
||||
) {
|
||||
innerRoomListService.invites()
|
||||
}
|
||||
|
||||
init {
|
||||
allRooms.loadAllIncrementally(sessionCoroutineScope)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -515,7 +515,7 @@ class RustTimeline(
|
|||
}
|
||||
}
|
||||
|
||||
private fun fetchDetailsForEvent(eventId: EventId): Result<Unit> {
|
||||
private suspend fun fetchDetailsForEvent(eventId: EventId): Result<Unit> {
|
||||
return runCatching {
|
||||
inner.fetchDetailsForEvent(eventId.value)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,11 +170,7 @@ class RoomSummaryListProcessorTests {
|
|||
|
||||
override suspend fun applyInput(input: RoomListInput) = Unit
|
||||
|
||||
override suspend fun invites(): RoomList {
|
||||
return RoomList(Pointer.NULL)
|
||||
}
|
||||
|
||||
override fun room(roomId: String): RoomListItem {
|
||||
override suspend fun room(roomId: String): RoomListItem {
|
||||
return RoomListItem(Pointer.NULL)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue