mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Fix issues on JoinedRoom / BaseRoom (#4724)
* Import type * Add test to cover an existing issue. roomCoroutineScope is not cancelled when the class is destroyed * Cancel roomCoroutineScope when the class is destroyed * Move `isOneToOne` to BaseRoom, we do not need a JoinedRoom for it. * Let `roomInfoFlow` be implemented by RustBaseRoom. It should fix a few issues where we rely on the room info to be live, and it was not the case on RustBaseRoom. * Add more assertions. The test would fail anyway if roomCoroutineScope was still active, but it's more explicit with these assertions.
This commit is contained in:
+6
@@ -55,6 +55,12 @@ interface BaseRoom : Closeable {
|
||||
*/
|
||||
fun info(): RoomInfo = roomInfoFlow.value
|
||||
|
||||
/**
|
||||
* A one-to-one is a room with exactly 2 members.
|
||||
* See [the Matrix spec](https://spec.matrix.org/latest/client-server-api/#default-underride-rules).
|
||||
*/
|
||||
val isOneToOne: Boolean get() = info().activeMembersCount == 2L
|
||||
|
||||
/**
|
||||
* Try to load the room members and update the membersFlow.
|
||||
*/
|
||||
|
||||
-6
@@ -50,12 +50,6 @@ interface JoinedRoom : BaseRoom {
|
||||
*/
|
||||
val knockRequestsFlow: Flow<List<KnockRequest>>
|
||||
|
||||
/**
|
||||
* A one-to-one is a room with exactly 2 members.
|
||||
* See [the Matrix spec](https://spec.matrix.org/latest/client-server-api/#default-underride-rules).
|
||||
*/
|
||||
val isOneToOne: Boolean get() = info().activeMembersCount == 2L
|
||||
|
||||
/**
|
||||
* The live timeline of the room. Must be used to send Event to a room.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user