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
|
|
@ -319,8 +319,6 @@ class RoomListPresenter @Inject constructor(
|
|||
|
||||
private fun CoroutineScope.clearCacheOfRoom(roomId: RoomId) = launch {
|
||||
client.getRoom(roomId)?.use { room ->
|
||||
// Ideally we wouldn't have a live timeline at this point, but right now we instantiate one when retrieving the room
|
||||
room.liveTimeline.close()
|
||||
room.clearEventCacheStorage()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ import io.element.android.libraries.matrix.test.A_USER_NAME
|
|||
import io.element.android.libraries.matrix.test.FakeMatrixClient
|
||||
import io.element.android.libraries.matrix.test.encryption.FakeEncryptionService
|
||||
import io.element.android.libraries.matrix.test.notificationsettings.FakeNotificationSettingsService
|
||||
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.libraries.matrix.test.room.aRoomSummary
|
||||
import io.element.android.libraries.matrix.test.roomlist.FakeRoomListService
|
||||
|
|
@ -275,7 +275,7 @@ class RoomListPresenterTest {
|
|||
|
||||
@Test
|
||||
fun `present - show context menu`() = runTest {
|
||||
val room = FakeMatrixRoom()
|
||||
val room = FakeBaseRoom()
|
||||
val client = FakeMatrixClient().apply {
|
||||
givenGetRoomResult(A_ROOM_ID, room)
|
||||
}
|
||||
|
|
@ -353,7 +353,7 @@ class RoomListPresenterTest {
|
|||
|
||||
@Test
|
||||
fun `present - hide context menu`() = runTest {
|
||||
val room = FakeMatrixRoom()
|
||||
val room = FakeBaseRoom()
|
||||
val client = FakeMatrixClient().apply {
|
||||
givenGetRoomResult(A_ROOM_ID, room)
|
||||
}
|
||||
|
|
@ -463,7 +463,7 @@ class RoomListPresenterTest {
|
|||
@Test
|
||||
fun `present - when set is favorite event is emitted, then the action is called`() = runTest {
|
||||
val setIsFavoriteResult = lambdaRecorder { _: Boolean -> Result.success(Unit) }
|
||||
val room = FakeMatrixRoom(
|
||||
val room = FakeBaseRoom(
|
||||
setIsFavoriteResult = setIsFavoriteResult
|
||||
)
|
||||
val analyticsService = FakeAnalyticsService()
|
||||
|
|
@ -510,9 +510,9 @@ class RoomListPresenterTest {
|
|||
|
||||
@Test
|
||||
fun `present - check that the room is marked as read with correct RR and as unread`() = runTest {
|
||||
val room = FakeMatrixRoom()
|
||||
val room2 = FakeMatrixRoom(roomId = A_ROOM_ID_2)
|
||||
val room3 = FakeMatrixRoom(roomId = A_ROOM_ID_3)
|
||||
val room = FakeBaseRoom()
|
||||
val room2 = FakeBaseRoom(roomId = A_ROOM_ID_2)
|
||||
val room3 = FakeBaseRoom(roomId = A_ROOM_ID_3)
|
||||
val allRooms = setOf(room, room2, room3)
|
||||
val sessionPreferencesStore = InMemorySessionPreferencesStore()
|
||||
val matrixClient = FakeMatrixClient().apply {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import io.element.android.libraries.matrix.test.A_ROOM_NAME
|
|||
import kotlinx.collections.immutable.toPersistentList
|
||||
import org.junit.Test
|
||||
|
||||
class RoomListRoomSummaryTest {
|
||||
class RoomListBaseRoomSummaryTest {
|
||||
@Test
|
||||
fun `test default value`() {
|
||||
val sut = createRoomListRoomSummary(
|
||||
Loading…
Add table
Add a link
Reference in a new issue