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
|
|
@ -44,7 +44,6 @@ import java.io.File
|
|||
interface MatrixRoom : Closeable {
|
||||
val sessionId: SessionId
|
||||
val roomId: RoomId
|
||||
val name: String?
|
||||
val displayName: String
|
||||
val alias: RoomAlias?
|
||||
val alternativeAliases: List<RoomAlias>
|
||||
|
|
|
|||
|
|
@ -39,14 +39,12 @@ interface RoomList {
|
|||
|
||||
/**
|
||||
* The source of the room list data.
|
||||
* All: all rooms except invites.
|
||||
* Invites: only invites.
|
||||
* All: all rooms.
|
||||
*
|
||||
* To apply some dynamic filtering on top of that, use [DynamicRoomList].
|
||||
*/
|
||||
enum class Source {
|
||||
All,
|
||||
Invites,
|
||||
All
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -59,11 +59,6 @@ interface RoomListService {
|
|||
*/
|
||||
val allRooms: DynamicRoomList
|
||||
|
||||
/**
|
||||
* returns a [RoomList] object of all invites.
|
||||
*/
|
||||
val invites: RoomList
|
||||
|
||||
/**
|
||||
* Will set the visible range of all rooms.
|
||||
* This is useful to load more data when the user scrolls down.
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,6 @@ import java.io.File
|
|||
class FakeMatrixRoom(
|
||||
override val sessionId: SessionId = A_SESSION_ID,
|
||||
override val roomId: RoomId = A_ROOM_ID,
|
||||
override val name: String? = null,
|
||||
override val displayName: String = "",
|
||||
override val topic: String? = null,
|
||||
override val avatarUrl: String? = null,
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ class FakeRoomListService : RoomListService {
|
|||
private val allRoomSummariesFlow = MutableStateFlow<List<RoomSummary>>(emptyList())
|
||||
private val inviteRoomSummariesFlow = MutableStateFlow<List<RoomSummary>>(emptyList())
|
||||
private val allRoomsLoadingStateFlow = MutableStateFlow<RoomList.LoadingState>(RoomList.LoadingState.NotLoaded)
|
||||
private val inviteRoomsLoadingStateFlow = MutableStateFlow<RoomList.LoadingState>(RoomList.LoadingState.NotLoaded)
|
||||
private val roomListStateFlow = MutableStateFlow<RoomListService.State>(RoomListService.State.Idle)
|
||||
private val syncIndicatorStateFlow = MutableStateFlow<RoomListService.SyncIndicator>(RoomListService.SyncIndicator.Hide)
|
||||
|
||||
|
|
@ -44,10 +43,6 @@ class FakeRoomListService : RoomListService {
|
|||
allRoomsLoadingStateFlow.emit(loadingState)
|
||||
}
|
||||
|
||||
suspend fun postInviteRoomsLoadingState(loadingState: RoomList.LoadingState) {
|
||||
inviteRoomsLoadingStateFlow.emit(loadingState)
|
||||
}
|
||||
|
||||
suspend fun postState(state: RoomListService.State) {
|
||||
roomListStateFlow.emit(state)
|
||||
}
|
||||
|
|
@ -66,7 +61,6 @@ class FakeRoomListService : RoomListService {
|
|||
): DynamicRoomList {
|
||||
return when (source) {
|
||||
RoomList.Source.All -> allRooms
|
||||
RoomList.Source.Invites -> invites
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -76,12 +70,6 @@ class FakeRoomListService : RoomListService {
|
|||
MutableStateFlow(RoomListFilter.all())
|
||||
)
|
||||
|
||||
override val invites = SimplePagedRoomList(
|
||||
inviteRoomSummariesFlow,
|
||||
inviteRoomsLoadingStateFlow,
|
||||
MutableStateFlow(RoomListFilter.all())
|
||||
)
|
||||
|
||||
override fun updateAllRoomsVisibleRange(range: IntRange) {
|
||||
latestSlidingSyncRange = range
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue