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:
parent
764692b90b
commit
7238af7f7f
9 changed files with 122 additions and 15 deletions
|
|
@ -21,6 +21,7 @@ import io.element.android.libraries.matrix.api.notification.NotificationService
|
|||
import io.element.android.libraries.matrix.api.notificationsettings.NotificationSettingsService
|
||||
import io.element.android.libraries.matrix.api.oidc.AccountManagementAction
|
||||
import io.element.android.libraries.matrix.api.pusher.PushersService
|
||||
import io.element.android.libraries.matrix.api.room.InvitedRoom
|
||||
import io.element.android.libraries.matrix.api.room.MatrixRoom
|
||||
import io.element.android.libraries.matrix.api.room.MatrixRoomInfo
|
||||
import io.element.android.libraries.matrix.api.room.RoomMembershipObserver
|
||||
|
|
@ -49,6 +50,7 @@ interface MatrixClient : Closeable {
|
|||
val sessionCoroutineScope: CoroutineScope
|
||||
val ignoredUsersFlow: StateFlow<ImmutableList<UserId>>
|
||||
suspend fun getRoom(roomId: RoomId): MatrixRoom?
|
||||
suspend fun getInvitedRoom(roomId: RoomId): InvitedRoom?
|
||||
suspend fun findDM(userId: UserId): RoomId?
|
||||
suspend fun ignoreUser(userId: UserId): Result<Unit>
|
||||
suspend fun unignoreUser(userId: UserId): Result<Unit>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright 2024 New Vector Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
* Please see LICENSE in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.matrix.api.room
|
||||
|
||||
import io.element.android.libraries.matrix.api.core.RoomId
|
||||
import io.element.android.libraries.matrix.api.core.SessionId
|
||||
|
||||
/** A reference to a room the current user has been invited to, with the ability to decline the invite. */
|
||||
interface InvitedRoom : AutoCloseable {
|
||||
val sessionId: SessionId
|
||||
val roomId: RoomId
|
||||
|
||||
/** Decline the invite to this room. */
|
||||
suspend fun declineInvite(): Result<Unit>
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue