Fix not being able to decline an invite from the room list (#3466)

* Add `InvitedRoom` to wrap Rust SDK Rooms in 'invited' membership state.

At the moment, this is a wrapper that allows us to call `Room.leave()` without having to initialise the room's timeline (which is impossible).

* Add `MatrixRoom.getInvitedRoom(roomId)` to get one of these rooms.

Also, `RustRoomFactory` now has a `createInvitedRoom` method for this.

* Adapt `AcceptDeclineInvitePresenter` to use the new APIs.
This commit is contained in:
Jorge Martin Espinosa 2024-09-16 15:02:20 +02:00 committed by GitHub
parent 764692b90b
commit 7238af7f7f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 122 additions and 15 deletions

View file

@ -112,8 +112,8 @@ class AcceptDeclineInvitePresenter @Inject constructor(
private fun CoroutineScope.declineInvite(roomId: RoomId, declinedAction: MutableState<AsyncAction<RoomId>>) = launch {
suspend {
client.getRoom(roomId)?.use {
it.leave().getOrThrow()
client.getInvitedRoom(roomId)?.use {
it.declineInvite().getOrThrow()
notificationCleaner.clearMembershipNotificationForRoom(client.sessionId, roomId)
}
roomId