Split MatrixRoom into BaseRoom and JoinedRoom (#4561)
`JoinedRoom` will now contain both a mandatory live timeline reference and all the functionality associated to it. `BaseRoom` on the other hand will contain only functionality that's shared for both joined and not joined rooms. `NotJoinedRoom` is a wrapper around `RoomPreviewInfo` data and a possible local `BaseRoom`, if it exists. The `RustRoomFactory` cache is now gone since the persistent event cache should have the same effect.
This commit is contained in:
parent
91cb84ce8d
commit
619aa6f2de
193 changed files with 2921 additions and 2567 deletions
|
|
@ -16,7 +16,7 @@ import io.element.android.features.leaveroom.api.LeaveRoomState
|
|||
import io.element.android.libraries.matrix.api.MatrixClient
|
||||
import io.element.android.libraries.matrix.test.A_ROOM_ID
|
||||
import io.element.android.libraries.matrix.test.FakeMatrixClient
|
||||
import io.element.android.libraries.matrix.test.room.FakeMatrixRoom
|
||||
import io.element.android.libraries.matrix.test.room.FakeBaseRoom
|
||||
import io.element.android.libraries.matrix.test.room.aRoomInfo
|
||||
import io.element.android.tests.testutils.WarmUpRule
|
||||
import io.element.android.tests.testutils.lambda.assert
|
||||
|
|
@ -30,7 +30,7 @@ import org.junit.Rule
|
|||
import org.junit.Test
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
class LeaveRoomPresenterTest {
|
||||
class LeaveBaseRoomPresenterTest {
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ class LeaveRoomPresenterTest {
|
|||
client = FakeMatrixClient().apply {
|
||||
givenGetRoomResult(
|
||||
roomId = A_ROOM_ID,
|
||||
result = FakeMatrixRoom().apply {
|
||||
result = FakeBaseRoom().apply {
|
||||
givenRoomInfo(aRoomInfo(isDirect = false, isPublic = true, joinedMembersCount = 10))
|
||||
}
|
||||
)
|
||||
|
|
@ -75,7 +75,7 @@ class LeaveRoomPresenterTest {
|
|||
client = FakeMatrixClient().apply {
|
||||
givenGetRoomResult(
|
||||
roomId = A_ROOM_ID,
|
||||
result = FakeMatrixRoom().apply {
|
||||
result = FakeBaseRoom().apply {
|
||||
givenRoomInfo(aRoomInfo(isPublic = false))
|
||||
},
|
||||
)
|
||||
|
|
@ -97,7 +97,7 @@ class LeaveRoomPresenterTest {
|
|||
client = FakeMatrixClient().apply {
|
||||
givenGetRoomResult(
|
||||
roomId = A_ROOM_ID,
|
||||
result = FakeMatrixRoom().apply {
|
||||
result = FakeBaseRoom().apply {
|
||||
givenRoomInfo(aRoomInfo(joinedMembersCount = 1))
|
||||
},
|
||||
)
|
||||
|
|
@ -119,7 +119,7 @@ class LeaveRoomPresenterTest {
|
|||
client = FakeMatrixClient().apply {
|
||||
givenGetRoomResult(
|
||||
roomId = A_ROOM_ID,
|
||||
result = FakeMatrixRoom().apply {
|
||||
result = FakeBaseRoom().apply {
|
||||
givenRoomInfo(aRoomInfo(isDirect = true, activeMembersCount = 2))
|
||||
},
|
||||
)
|
||||
|
|
@ -142,7 +142,7 @@ class LeaveRoomPresenterTest {
|
|||
client = FakeMatrixClient().apply {
|
||||
givenGetRoomResult(
|
||||
roomId = A_ROOM_ID,
|
||||
result = FakeMatrixRoom(
|
||||
result = FakeBaseRoom(
|
||||
leaveRoomLambda = leaveRoomLambda
|
||||
),
|
||||
)
|
||||
|
|
@ -167,7 +167,7 @@ class LeaveRoomPresenterTest {
|
|||
client = FakeMatrixClient().apply {
|
||||
givenGetRoomResult(
|
||||
roomId = A_ROOM_ID,
|
||||
result = FakeMatrixRoom(
|
||||
result = FakeBaseRoom(
|
||||
leaveRoomLambda = { Result.failure(RuntimeException("Blimey!")) }
|
||||
),
|
||||
)
|
||||
|
|
@ -191,7 +191,7 @@ class LeaveRoomPresenterTest {
|
|||
client = FakeMatrixClient().apply {
|
||||
givenGetRoomResult(
|
||||
roomId = A_ROOM_ID,
|
||||
result = FakeMatrixRoom(
|
||||
result = FakeBaseRoom(
|
||||
leaveRoomLambda = { Result.success(Unit) }
|
||||
),
|
||||
)
|
||||
|
|
@ -215,7 +215,7 @@ class LeaveRoomPresenterTest {
|
|||
client = FakeMatrixClient().apply {
|
||||
givenGetRoomResult(
|
||||
roomId = A_ROOM_ID,
|
||||
result = FakeMatrixRoom(
|
||||
result = FakeBaseRoom(
|
||||
leaveRoomLambda = { Result.failure(RuntimeException("Blimey!")) }
|
||||
),
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue