From 4924f86d3b8e38cb26ecba3227201f02211dce32 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 22 Jan 2024 10:49:19 +0100 Subject: [PATCH 01/10] Do not use the function for preview in test. --- .../android/features/roomlist/impl/RoomListPresenterTests.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListPresenterTests.kt b/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListPresenterTests.kt index e4a8d91583..f4e944e96d 100644 --- a/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListPresenterTests.kt +++ b/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListPresenterTests.kt @@ -29,7 +29,6 @@ import io.element.android.features.roomlist.impl.datasource.FakeInviteDataSource import io.element.android.features.roomlist.impl.datasource.InviteStateDataSource import io.element.android.features.roomlist.impl.datasource.RoomListDataSource import io.element.android.features.roomlist.impl.model.RoomListRoomSummary -import io.element.android.features.roomlist.impl.model.aRoomListRoomSummary import io.element.android.libraries.dateformatter.api.LastMessageTimestampFormatter import io.element.android.libraries.dateformatter.test.FakeLastMessageTimestampFormatter import io.element.android.libraries.designsystem.components.avatar.AvatarData @@ -316,7 +315,7 @@ class RoomListPresenterTests { skipItems(1) val initialState = awaitItem() - val summary = aRoomListRoomSummary() + val summary = aRoomListRoomSummary initialState.eventSink(RoomListEvents.ShowContextMenu(summary)) val shownState = awaitItem() @@ -336,7 +335,7 @@ class RoomListPresenterTests { skipItems(1) val initialState = awaitItem() - val summary = aRoomListRoomSummary() + val summary = aRoomListRoomSummary initialState.eventSink(RoomListEvents.ShowContextMenu(summary)) val shownState = awaitItem() From 579f4d6a4e152a9b1a938fbbe02a8760c664eaa6 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 22 Jan 2024 10:59:42 +0100 Subject: [PATCH 02/10] `fun aRoomListRoomSummary`: make internal, add all fields and reorder to match RoomListRoomSummary constructor order. --- .../impl/model/RoomListRoomSummaryProvider.kt | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryProvider.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryProvider.kt index 8390bd03d7..89a902f7dc 100644 --- a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryProvider.kt +++ b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryProvider.kt @@ -44,23 +44,27 @@ open class RoomListRoomSummaryProvider : PreviewParameterProvider Date: Mon, 22 Jan 2024 11:02:13 +0100 Subject: [PATCH 03/10] Use aRoomListRoomSummary function instead of invoking the constructor. --- .../features/roomlist/impl/RoomListStateProvider.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListStateProvider.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListStateProvider.kt index bf18bc60cc..b4445dcce0 100644 --- a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListStateProvider.kt +++ b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListStateProvider.kt @@ -20,6 +20,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameterProvider import io.element.android.features.leaveroom.api.aLeaveRoomState import io.element.android.features.roomlist.impl.model.RoomListRoomSummary import io.element.android.features.roomlist.impl.model.RoomListRoomSummaryPlaceholders +import io.element.android.features.roomlist.impl.model.aRoomListRoomSummary import io.element.android.libraries.designsystem.components.avatar.AvatarData import io.element.android.libraries.designsystem.components.avatar.AvatarSize import io.element.android.libraries.designsystem.utils.snackbar.SnackbarMessage @@ -71,23 +72,21 @@ internal fun aRoomListState() = RoomListState( internal fun aRoomListRoomSummaryList(): ImmutableList { return persistentListOf( - RoomListRoomSummary( + aRoomListRoomSummary( name = "Room", hasUnread = true, timestamp = "14:18", lastMessage = "A very very very very long message which suites on two lines", avatarData = AvatarData("!id", "R", size = AvatarSize.RoomListItem), id = "!roomId:domain", - roomId = RoomId("!roomId:domain") ), - RoomListRoomSummary( + aRoomListRoomSummary( name = "Room#2", hasUnread = false, timestamp = "14:16", lastMessage = "A short message", avatarData = AvatarData("!id", "Z", size = AvatarSize.RoomListItem), id = "!roomId2:domain", - roomId = RoomId("!roomId2:domain") ), RoomListRoomSummaryPlaceholders.create("!roomId2:domain"), RoomListRoomSummaryPlaceholders.create("!roomId3:domain"), From ed1112f09bcdd576252aab16d4d1d5b266f0622c Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 22 Jan 2024 11:02:45 +0100 Subject: [PATCH 04/10] Ensure roomId are unique in the list. --- .../android/features/roomlist/impl/RoomListStateProvider.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListStateProvider.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListStateProvider.kt index b4445dcce0..e1e105afeb 100644 --- a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListStateProvider.kt +++ b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListStateProvider.kt @@ -88,7 +88,7 @@ internal fun aRoomListRoomSummaryList(): ImmutableList { avatarData = AvatarData("!id", "Z", size = AvatarSize.RoomListItem), id = "!roomId2:domain", ), - RoomListRoomSummaryPlaceholders.create("!roomId2:domain"), RoomListRoomSummaryPlaceholders.create("!roomId3:domain"), + RoomListRoomSummaryPlaceholders.create("!roomId4:domain"), ) } From 8eba12593b82646805573b3a5af8398bd8914c75 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 22 Jan 2024 11:05:25 +0100 Subject: [PATCH 05/10] Ensure there is no timestamp in RoomListRoomSummary if lastMessage is null. --- .../roomlist/impl/model/RoomListRoomSummaryProvider.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryProvider.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryProvider.kt index 89a902f7dc..e312d2bf14 100644 --- a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryProvider.kt +++ b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryProvider.kt @@ -28,10 +28,10 @@ open class RoomListRoomSummaryProvider : PreviewParameterProvider Date: Mon, 22 Jan 2024 11:11:44 +0100 Subject: [PATCH 06/10] Remove default value for constructor of RoomListRoomSummary. --- .../impl/datasource/RoomListDataSource.kt | 1 + .../impl/model/RoomListRoomSummary.kt | 19 +++++++++---------- .../model/RoomListRoomSummaryPlaceholders.kt | 6 +++++- .../roomlist/impl/RoomListPresenterTests.kt | 3 +++ 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/datasource/RoomListDataSource.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/datasource/RoomListDataSource.kt index 37f26e37ea..c25759ebd8 100644 --- a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/datasource/RoomListDataSource.kt +++ b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/datasource/RoomListDataSource.kt @@ -160,6 +160,7 @@ class RoomListDataSource @Inject constructor( roomLastMessageFormatter.format(message.event, roomSummary.details.isDirect) }.orEmpty(), avatarData = avatarData, + isPlaceholder = false, userDefinedNotificationMode = roomSummary.details.userDefinedNotificationMode, hasRoomCall = roomSummary.details.hasRoomCall, isDm = roomSummary.details.isDm, diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummary.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummary.kt index 629013d26e..81638ee2e3 100644 --- a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummary.kt +++ b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummary.kt @@ -18,7 +18,6 @@ package io.element.android.features.roomlist.impl.model import androidx.compose.runtime.Immutable import io.element.android.libraries.designsystem.components.avatar.AvatarData -import io.element.android.libraries.designsystem.components.avatar.AvatarSize import io.element.android.libraries.matrix.api.core.RoomId import io.element.android.libraries.matrix.api.room.RoomNotificationMode @@ -26,13 +25,13 @@ import io.element.android.libraries.matrix.api.room.RoomNotificationMode data class RoomListRoomSummary( val id: String, val roomId: RoomId, - val name: String = "", - val hasUnread: Boolean = false, - val timestamp: String? = null, - val lastMessage: CharSequence? = null, - val avatarData: AvatarData = AvatarData(id, name, size = AvatarSize.RoomListItem), - val isPlaceholder: Boolean = false, - val userDefinedNotificationMode: RoomNotificationMode? = null, - val hasRoomCall: Boolean = false, - val isDm: Boolean = false, + val name: String, + val hasUnread: Boolean, + val timestamp: String?, + val lastMessage: CharSequence?, + val avatarData: AvatarData, + val isPlaceholder: Boolean, + val userDefinedNotificationMode: RoomNotificationMode?, + val hasRoomCall: Boolean, + val isDm: Boolean, ) diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryPlaceholders.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryPlaceholders.kt index f5976d7d1c..64a91b11e3 100644 --- a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryPlaceholders.kt +++ b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryPlaceholders.kt @@ -29,7 +29,11 @@ object RoomListRoomSummaryPlaceholders { name = "Short name", timestamp = "hh:mm", lastMessage = "Last message for placeholder", - avatarData = AvatarData(id, "S", size = AvatarSize.RoomListItem) + avatarData = AvatarData(id, "S", size = AvatarSize.RoomListItem), + hasUnread = false, + userDefinedNotificationMode = null, + hasRoomCall = false, + isDm = false, ) } diff --git a/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListPresenterTests.kt b/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListPresenterTests.kt index f4e944e96d..2af3b666db 100644 --- a/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListPresenterTests.kt +++ b/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListPresenterTests.kt @@ -442,4 +442,7 @@ private val aRoomListRoomSummary = RoomListRoomSummary( lastMessage = "", avatarData = AvatarData(id = A_ROOM_ID.value, name = A_ROOM_NAME, size = AvatarSize.RoomListItem), isPlaceholder = false, + userDefinedNotificationMode = null, + hasRoomCall = false, + isDm = false, ) From 5caebaaa1b3c95df04e409269cf3abe4f97554ed Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 22 Jan 2024 11:25:05 +0100 Subject: [PATCH 07/10] Introduce RoomListRoomSummaryFactory and remove RoomListRoomSummaryPlaceholders. --- .../roomlist/impl/RoomListStateProvider.kt | 11 ++- .../impl/datasource/RoomListDataSource.kt | 40 +-------- .../datasource/RoomListRoomSummaryFactory.kt | 81 +++++++++++++++++++ .../model/RoomListRoomSummaryPlaceholders.kt | 47 ----------- .../roomlist/impl/RoomListPresenterTests.kt | 9 ++- 5 files changed, 99 insertions(+), 89 deletions(-) create mode 100644 features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/datasource/RoomListRoomSummaryFactory.kt delete mode 100644 features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryPlaceholders.kt diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListStateProvider.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListStateProvider.kt index e1e105afeb..33736ab592 100644 --- a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListStateProvider.kt +++ b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListStateProvider.kt @@ -19,7 +19,6 @@ package io.element.android.features.roomlist.impl import androidx.compose.ui.tooling.preview.PreviewParameterProvider import io.element.android.features.leaveroom.api.aLeaveRoomState import io.element.android.features.roomlist.impl.model.RoomListRoomSummary -import io.element.android.features.roomlist.impl.model.RoomListRoomSummaryPlaceholders import io.element.android.features.roomlist.impl.model.aRoomListRoomSummary import io.element.android.libraries.designsystem.components.avatar.AvatarData import io.element.android.libraries.designsystem.components.avatar.AvatarSize @@ -88,7 +87,13 @@ internal fun aRoomListRoomSummaryList(): ImmutableList { avatarData = AvatarData("!id", "Z", size = AvatarSize.RoomListItem), id = "!roomId2:domain", ), - RoomListRoomSummaryPlaceholders.create("!roomId3:domain"), - RoomListRoomSummaryPlaceholders.create("!roomId4:domain"), + aRoomListRoomSummary( + id = "!roomId3:domain", + isPlaceholder = true, + ), + aRoomListRoomSummary( + id = "!roomId4:domain", + isPlaceholder = true, + ), ) } diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/datasource/RoomListDataSource.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/datasource/RoomListDataSource.kt index c25759ebd8..a255767d7e 100644 --- a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/datasource/RoomListDataSource.kt +++ b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/datasource/RoomListDataSource.kt @@ -17,16 +17,9 @@ package io.element.android.features.roomlist.impl.datasource import io.element.android.features.roomlist.impl.model.RoomListRoomSummary -import io.element.android.features.roomlist.impl.model.RoomListRoomSummaryPlaceholders import io.element.android.libraries.androidutils.diff.DiffCacheUpdater import io.element.android.libraries.androidutils.diff.MutableListDiffCache import io.element.android.libraries.core.coroutine.CoroutineDispatchers -import io.element.android.libraries.core.extensions.orEmpty -import io.element.android.libraries.dateformatter.api.LastMessageTimestampFormatter -import io.element.android.libraries.designsystem.components.avatar.AvatarData -import io.element.android.libraries.designsystem.components.avatar.AvatarSize -import io.element.android.libraries.eventformatter.api.RoomLastMessageFormatter -import io.element.android.libraries.matrix.api.core.RoomId import io.element.android.libraries.matrix.api.notificationsettings.NotificationSettingsService import io.element.android.libraries.matrix.api.roomlist.RoomListService import io.element.android.libraries.matrix.api.roomlist.RoomSummary @@ -49,8 +42,7 @@ import kotlin.time.Duration.Companion.seconds class RoomListDataSource @Inject constructor( private val roomListService: RoomListService, - private val lastMessageTimestampFormatter: LastMessageTimestampFormatter, - private val roomLastMessageFormatter: RoomLastMessageFormatter, + private val roomListRoomSummaryFactory: RoomListRoomSummaryFactory, private val coroutineDispatchers: CoroutineDispatchers, private val notificationSettingsService: NotificationSettingsService, private val appScope: CoroutineScope, @@ -121,7 +113,7 @@ class RoomListDataSource @Inject constructor( private suspend fun buildAndEmitAllRooms(roomSummaries: List) { if (diffCache.isEmpty()) { _allRooms.emit( - RoomListRoomSummaryPlaceholders.createFakeList(16).toImmutableList() + roomListRoomSummaryFactory.createFakeList() ) } else { val roomListRoomSummaries = ArrayList() @@ -141,34 +133,10 @@ class RoomListDataSource @Inject constructor( private fun buildAndCacheItem(roomSummaries: List, index: Int): RoomListRoomSummary? { val roomListRoomSummary = when (val roomSummary = roomSummaries.getOrNull(index)) { - is RoomSummary.Empty -> RoomListRoomSummaryPlaceholders.create(roomSummary.identifier) - is RoomSummary.Filled -> { - val avatarData = AvatarData( - id = roomSummary.identifier(), - name = roomSummary.details.name, - url = roomSummary.details.avatarUrl, - size = AvatarSize.RoomListItem, - ) - val roomIdentifier = roomSummary.identifier() - RoomListRoomSummary( - id = roomSummary.identifier(), - roomId = RoomId(roomIdentifier), - name = roomSummary.details.name, - hasUnread = roomSummary.details.unreadNotificationCount > 0, - timestamp = lastMessageTimestampFormatter.format(roomSummary.details.lastMessageTimestamp), - lastMessage = roomSummary.details.lastMessage?.let { message -> - roomLastMessageFormatter.format(message.event, roomSummary.details.isDirect) - }.orEmpty(), - avatarData = avatarData, - isPlaceholder = false, - userDefinedNotificationMode = roomSummary.details.userDefinedNotificationMode, - hasRoomCall = roomSummary.details.hasRoomCall, - isDm = roomSummary.details.isDm, - ) - } + is RoomSummary.Empty -> roomListRoomSummaryFactory.createPlaceholder(roomSummary.identifier) + is RoomSummary.Filled -> roomListRoomSummaryFactory.create(roomSummary) null -> null } - diffCache[index] = roomListRoomSummary return roomListRoomSummary } diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/datasource/RoomListRoomSummaryFactory.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/datasource/RoomListRoomSummaryFactory.kt new file mode 100644 index 0000000000..da430d7b73 --- /dev/null +++ b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/datasource/RoomListRoomSummaryFactory.kt @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2024 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.element.android.features.roomlist.impl.datasource + +import io.element.android.features.roomlist.impl.model.RoomListRoomSummary +import io.element.android.libraries.core.extensions.orEmpty +import io.element.android.libraries.dateformatter.api.LastMessageTimestampFormatter +import io.element.android.libraries.designsystem.components.avatar.AvatarData +import io.element.android.libraries.designsystem.components.avatar.AvatarSize +import io.element.android.libraries.eventformatter.api.RoomLastMessageFormatter +import io.element.android.libraries.matrix.api.core.RoomId +import io.element.android.libraries.matrix.api.roomlist.RoomSummary +import kotlinx.collections.immutable.ImmutableList +import kotlinx.collections.immutable.toImmutableList +import javax.inject.Inject + +class RoomListRoomSummaryFactory @Inject constructor( + private val lastMessageTimestampFormatter: LastMessageTimestampFormatter, + private val roomLastMessageFormatter: RoomLastMessageFormatter, +) { + fun createPlaceholder(id: String): RoomListRoomSummary { + return RoomListRoomSummary( + id = id, + roomId = RoomId("!aRoom:domain"), + isPlaceholder = true, + name = "Short name", + timestamp = "hh:mm", + lastMessage = "Last message for placeholder", + avatarData = AvatarData(id, "S", size = AvatarSize.RoomListItem), + hasUnread = false, + userDefinedNotificationMode = null, + hasRoomCall = false, + isDm = false, + ) + } + + fun createFakeList(): ImmutableList { + return List(16) { + createPlaceholder("!fakeRoom$it:domain") + }.toImmutableList() + } + + fun create(roomSummary: RoomSummary.Filled): RoomListRoomSummary { + val roomIdentifier = roomSummary.identifier() + val avatarData = AvatarData( + id = roomIdentifier, + name = roomSummary.details.name, + url = roomSummary.details.avatarUrl, + size = AvatarSize.RoomListItem, + ) + return RoomListRoomSummary( + id = roomIdentifier, + roomId = RoomId(roomIdentifier), + name = roomSummary.details.name, + hasUnread = roomSummary.details.unreadNotificationCount > 0, + timestamp = lastMessageTimestampFormatter.format(roomSummary.details.lastMessageTimestamp), + lastMessage = roomSummary.details.lastMessage?.let { message -> + roomLastMessageFormatter.format(message.event, roomSummary.details.isDirect) + }.orEmpty(), + avatarData = avatarData, + isPlaceholder = false, + userDefinedNotificationMode = roomSummary.details.userDefinedNotificationMode, + hasRoomCall = roomSummary.details.hasRoomCall, + isDm = roomSummary.details.isDm, + ) + } +} diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryPlaceholders.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryPlaceholders.kt deleted file mode 100644 index 64a91b11e3..0000000000 --- a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryPlaceholders.kt +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2023 New Vector Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.element.android.features.roomlist.impl.model - -import io.element.android.libraries.designsystem.components.avatar.AvatarData -import io.element.android.libraries.designsystem.components.avatar.AvatarSize -import io.element.android.libraries.matrix.api.core.RoomId - -object RoomListRoomSummaryPlaceholders { - fun create(id: String): RoomListRoomSummary { - return RoomListRoomSummary( - id = id, - roomId = RoomId("!aRoom:domain"), - isPlaceholder = true, - name = "Short name", - timestamp = "hh:mm", - lastMessage = "Last message for placeholder", - avatarData = AvatarData(id, "S", size = AvatarSize.RoomListItem), - hasUnread = false, - userDefinedNotificationMode = null, - hasRoomCall = false, - isDm = false, - ) - } - - fun createFakeList(size: Int): List { - return mutableListOf().apply { - repeat(size) { - add(create("!fakeRoom$it:domain")) - } - } - } -} diff --git a/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListPresenterTests.kt b/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListPresenterTests.kt index 2af3b666db..b868c950e5 100644 --- a/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListPresenterTests.kt +++ b/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListPresenterTests.kt @@ -28,6 +28,7 @@ import io.element.android.features.networkmonitor.test.FakeNetworkMonitor import io.element.android.features.roomlist.impl.datasource.FakeInviteDataSource import io.element.android.features.roomlist.impl.datasource.InviteStateDataSource import io.element.android.features.roomlist.impl.datasource.RoomListDataSource +import io.element.android.features.roomlist.impl.datasource.RoomListRoomSummaryFactory import io.element.android.features.roomlist.impl.model.RoomListRoomSummary import io.element.android.libraries.dateformatter.api.LastMessageTimestampFormatter import io.element.android.libraries.dateformatter.test.FakeLastMessageTimestampFormatter @@ -414,9 +415,11 @@ class RoomListPresenterTests { inviteStateDataSource = inviteStateDataSource, leaveRoomPresenter = leaveRoomPresenter, roomListDataSource = RoomListDataSource( - client.roomListService, - lastMessageTimestampFormatter, - roomLastMessageFormatter, + roomListService = client.roomListService, + roomListRoomSummaryFactory = RoomListRoomSummaryFactory( + lastMessageTimestampFormatter = lastMessageTimestampFormatter, + roomLastMessageFormatter = roomLastMessageFormatter, + ), coroutineDispatchers = testCoroutineDispatchers(), notificationSettingsService = client.notificationSettingsService(), appScope = coroutineScope From 9460bcdeb6476c7ad34445c2fa67ec1b0e86588d Mon Sep 17 00:00:00 2001 From: ElementBot Date: Mon, 22 Jan 2024 10:36:08 +0000 Subject: [PATCH 08/10] Update screenshots --- ...ow_null_RoomSummaryRow-Day-9_10_null_0,NEXUS_5,1.0,en].png | 4 ++-- ...ow_null_RoomSummaryRow-Day-9_10_null_1,NEXUS_5,1.0,en].png | 4 ++-- ...ow_null_RoomSummaryRow-Day-9_10_null_2,NEXUS_5,1.0,en].png | 4 ++-- ...ow_null_RoomSummaryRow-Day-9_10_null_3,NEXUS_5,1.0,en].png | 4 ++-- ...ow_null_RoomSummaryRow-Day-9_10_null_4,NEXUS_5,1.0,en].png | 4 ++-- ...ow_null_RoomSummaryRow-Day-9_10_null_5,NEXUS_5,1.0,en].png | 4 ++-- ...ow_null_RoomSummaryRow-Day-9_10_null_7,NEXUS_5,1.0,en].png | 4 ++-- ...ow_null_RoomSummaryRow-Day-9_10_null_8,NEXUS_5,1.0,en].png | 4 ++-- ..._null_RoomSummaryRow-Night-9_11_null_0,NEXUS_5,1.0,en].png | 4 ++-- ..._null_RoomSummaryRow-Night-9_11_null_1,NEXUS_5,1.0,en].png | 4 ++-- ..._null_RoomSummaryRow-Night-9_11_null_2,NEXUS_5,1.0,en].png | 4 ++-- ..._null_RoomSummaryRow-Night-9_11_null_3,NEXUS_5,1.0,en].png | 4 ++-- ..._null_RoomSummaryRow-Night-9_11_null_4,NEXUS_5,1.0,en].png | 4 ++-- ..._null_RoomSummaryRow-Night-9_11_null_5,NEXUS_5,1.0,en].png | 4 ++-- ..._null_RoomSummaryRow-Night-9_11_null_7,NEXUS_5,1.0,en].png | 4 ++-- ..._null_RoomSummaryRow-Night-9_11_null_8,NEXUS_5,1.0,en].png | 4 ++-- 16 files changed, 32 insertions(+), 32 deletions(-) diff --git a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_0,NEXUS_5,1.0,en].png b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_0,NEXUS_5,1.0,en].png index 040f9a72b8..ded89c6b2a 100644 --- a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_0,NEXUS_5,1.0,en].png +++ b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_0,NEXUS_5,1.0,en].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cf71e045231208529eb524abce7b246a0ac6283c422f9695d560071fda7085f2 -size 12820 +oid sha256:57e0c90fa627974aba0d62363906bcc7911a6ada7d9d7db00db0df1d51fed54c +size 12911 diff --git a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_1,NEXUS_5,1.0,en].png b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_1,NEXUS_5,1.0,en].png index a83f9527ef..94306b9d92 100644 --- a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_1,NEXUS_5,1.0,en].png +++ b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_1,NEXUS_5,1.0,en].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:34972a9257a96b4ac77edf06e5f29ebc2d8e581dcaef131ecba9730cb0f48c1c -size 10176 +oid sha256:fcf2f25bbcb2f43d70a8a3228ba97426dbb98b533b74dd13ef6459f96a711db5 +size 8877 diff --git a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_2,NEXUS_5,1.0,en].png b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_2,NEXUS_5,1.0,en].png index 10d75c6a5b..12df0ea671 100644 --- a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_2,NEXUS_5,1.0,en].png +++ b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_2,NEXUS_5,1.0,en].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7ef683a74c785d57190508952f18ed5c669ff32a38cbc4f5b66d02330115843b -size 14103 +oid sha256:d1d8c374c7c3f8ad66b3936e8eda3161a93281aa3107027516ab671958f10980 +size 14187 diff --git a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_3,NEXUS_5,1.0,en].png b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_3,NEXUS_5,1.0,en].png index ac31b4c341..0af38a4878 100644 --- a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_3,NEXUS_5,1.0,en].png +++ b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_3,NEXUS_5,1.0,en].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:28b9ccdc834d9643694f72ce1c01fb988685a7b0300912bada032be1e426b467 -size 13539 +oid sha256:352b75021319958e86affa3d44c38cf72151d32796d70a0920ef63d73984ad72 +size 13627 diff --git a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_4,NEXUS_5,1.0,en].png b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_4,NEXUS_5,1.0,en].png index 961345501b..ea9b3053bf 100644 --- a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_4,NEXUS_5,1.0,en].png +++ b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_4,NEXUS_5,1.0,en].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3ada109a4f7b3b3bfae402eaddcdc240fd5f08aad41e7f1e70878baa8e257f2b -size 13288 +oid sha256:14e33bc8286952b7608adfa9864a1649c817992d35e9e0de8edc9957b8f4a6c6 +size 13388 diff --git a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_5,NEXUS_5,1.0,en].png b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_5,NEXUS_5,1.0,en].png index 15fba97e39..356b3a6d1e 100644 --- a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_5,NEXUS_5,1.0,en].png +++ b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_5,NEXUS_5,1.0,en].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0b18e5991be70ab16f983b929d08e566c85483e6d79f4de7a4191a800f4cae35 -size 13305 +oid sha256:d8442308cab3c75f64559bcd67dc39ce6d95a546ae33a7eb885c775349ab36f5 +size 13378 diff --git a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_7,NEXUS_5,1.0,en].png b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_7,NEXUS_5,1.0,en].png index 547657fe23..ae1e098362 100644 --- a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_7,NEXUS_5,1.0,en].png +++ b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_7,NEXUS_5,1.0,en].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:950e80e7e4be904967d35aaffe196548fa4f5ae9afdf2b86e65611ccdb14bf80 -size 22203 +oid sha256:a1dfe518ad4ee77539f017a39c684e0ce7bfb733a33161639fdf606a188b13d0 +size 22406 diff --git a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_8,NEXUS_5,1.0,en].png b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_8,NEXUS_5,1.0,en].png index 7c302dc03f..fcf6f86a3e 100644 --- a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_8,NEXUS_5,1.0,en].png +++ b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Day-9_10_null_8,NEXUS_5,1.0,en].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9c90561dc7355b1917ebe96bebc717de14aac5c4897ef3e8dd0b2aca8c51c362 -size 13610 +oid sha256:b044aa278ad070f75ffcf3d0d895c93bd784eb9c3e19e6aa842bbc1170bc92b4 +size 13688 diff --git a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_0,NEXUS_5,1.0,en].png b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_0,NEXUS_5,1.0,en].png index 22cb212645..d83d063b86 100644 --- a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_0,NEXUS_5,1.0,en].png +++ b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_0,NEXUS_5,1.0,en].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7fcbdfc3e45fa0f111cc384c54c40980913e52ff755e9380fba262a4c659a5c5 -size 12715 +oid sha256:1d914ad609cda9e94ba793027c17f3b7289fec71e65e1880b837615203f7718e +size 12907 diff --git a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_1,NEXUS_5,1.0,en].png b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_1,NEXUS_5,1.0,en].png index 3daf9dec9f..d93b2c752f 100644 --- a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_1,NEXUS_5,1.0,en].png +++ b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_1,NEXUS_5,1.0,en].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:063d4415a254eef251f4c0f63827062259f76c0d8a1e309e64a4e7376fc04a9b -size 10101 +oid sha256:e05f294579b4420e6671f268d10fae8fb49e93e5ae5b0f0d4548f7cdfeb82742 +size 8928 diff --git a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_2,NEXUS_5,1.0,en].png b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_2,NEXUS_5,1.0,en].png index c329163b6f..904b3a0b95 100644 --- a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_2,NEXUS_5,1.0,en].png +++ b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_2,NEXUS_5,1.0,en].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fd40343c425b1c7499e72d0d4119f36d06200b54e72034f97c172e5c2dad57af -size 13756 +oid sha256:4fcbb393a93d6a04e0415d2bb7bed4c002ec82907fbccf6070a4880a6b208e3c +size 13942 diff --git a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_3,NEXUS_5,1.0,en].png b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_3,NEXUS_5,1.0,en].png index f8e1416ce2..3b2e01f9b5 100644 --- a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_3,NEXUS_5,1.0,en].png +++ b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_3,NEXUS_5,1.0,en].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:584487de266a9b3e9cdefee0378023a946b309e19b09acffc5bf1a08dfc0d390 -size 13335 +oid sha256:811d95287c12d59fa1014b62ac8ae755f6355dbbd0700c2adc331293adfcc7a4 +size 13535 diff --git a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_4,NEXUS_5,1.0,en].png b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_4,NEXUS_5,1.0,en].png index 11cdbfc582..7c71f03c1b 100644 --- a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_4,NEXUS_5,1.0,en].png +++ b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_4,NEXUS_5,1.0,en].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8bda8b4f6a84b37548e3926f180ddb282d220b8ff581a60e69e0e309ad3ae06a -size 13119 +oid sha256:435737296b59d70210fc93ba70d2fa228ba4bab645fb9a6366609197a97f87c0 +size 13305 diff --git a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_5,NEXUS_5,1.0,en].png b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_5,NEXUS_5,1.0,en].png index 057f4f914c..4e88d5c639 100644 --- a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_5,NEXUS_5,1.0,en].png +++ b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_5,NEXUS_5,1.0,en].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2c17e87f046bbdd7a0300262737508cd1ffab4b54da9df7e7a7803237e070243 -size 13032 +oid sha256:d5a2d15ec2b36255963bc2514df0ff2dc8588c177d06c5431ca457af4de916e6 +size 13210 diff --git a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_7,NEXUS_5,1.0,en].png b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_7,NEXUS_5,1.0,en].png index 58ef0ec934..0f0d5353fb 100644 --- a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_7,NEXUS_5,1.0,en].png +++ b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_7,NEXUS_5,1.0,en].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:06df893c35c81609b46317f4de733db0bed4f5888eac189d09078ad7bd411cf0 -size 21340 +oid sha256:b5f274b1ad4ca31aaf585d34ce48c2898fbb9ada8294b211fe1440a097da21f6 +size 21626 diff --git a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_8,NEXUS_5,1.0,en].png b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_8,NEXUS_5,1.0,en].png index 4e9d41b689..2e19344be7 100644 --- a/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_8,NEXUS_5,1.0,en].png +++ b/tests/uitests/src/test/snapshots/images/ui_S_t[f.roomlist.impl.components_RoomSummaryRow_null_RoomSummaryRow-Night-9_11_null_8,NEXUS_5,1.0,en].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5efc2679fc43f952d1a41ffff7c5400baeb6f46e7faba0faef6409ea178c08de -size 13319 +oid sha256:a13837fffa77d7f95d6f4f163fb2e674070777caf02cce74b6a52e91f3103224 +size 13500 From 473922240ea7dde1b44a60abb0d98537d7e1529b Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 22 Jan 2024 14:03:40 +0100 Subject: [PATCH 09/10] Fix compilation of sample app. --- .../android/samples/minimal/RoomListScreen.kt | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/samples/minimal/src/main/kotlin/io/element/android/samples/minimal/RoomListScreen.kt b/samples/minimal/src/main/kotlin/io/element/android/samples/minimal/RoomListScreen.kt index 7706cdbb5d..286a80d71d 100644 --- a/samples/minimal/src/main/kotlin/io/element/android/samples/minimal/RoomListScreen.kt +++ b/samples/minimal/src/main/kotlin/io/element/android/samples/minimal/RoomListScreen.kt @@ -27,6 +27,7 @@ import io.element.android.features.roomlist.impl.RoomListPresenter import io.element.android.features.roomlist.impl.RoomListView import io.element.android.features.roomlist.impl.datasource.DefaultInviteStateDataSource import io.element.android.features.roomlist.impl.datasource.RoomListDataSource +import io.element.android.features.roomlist.impl.datasource.RoomListRoomSummaryFactory import io.element.android.libraries.core.coroutine.CoroutineDispatchers import io.element.android.libraries.dateformatter.impl.DateFormatters import io.element.android.libraries.dateformatter.impl.DefaultLastMessageTimestampFormatter @@ -76,12 +77,20 @@ class RoomListScreen( leaveRoomPresenter = LeaveRoomPresenterImpl(matrixClient, RoomMembershipObserver(), coroutineDispatchers), roomListDataSource = RoomListDataSource( roomListService = matrixClient.roomListService, - lastMessageTimestampFormatter = DefaultLastMessageTimestampFormatter(dateTimeProvider, dateFormatters), - roomLastMessageFormatter = DefaultRoomLastMessageFormatter( - sp = stringProvider, - roomMembershipContentFormatter = RoomMembershipContentFormatter(matrixClient, stringProvider), - profileChangeContentFormatter = ProfileChangeContentFormatter(stringProvider), - stateContentFormatter = StateContentFormatter(stringProvider), + roomListRoomSummaryFactory = RoomListRoomSummaryFactory( + lastMessageTimestampFormatter = DefaultLastMessageTimestampFormatter( + localDateTimeProvider = dateTimeProvider, + dateFormatters = dateFormatters + ), + roomLastMessageFormatter = DefaultRoomLastMessageFormatter( + sp = stringProvider, + roomMembershipContentFormatter = RoomMembershipContentFormatter( + matrixClient = matrixClient, + sp = stringProvider + ), + profileChangeContentFormatter = ProfileChangeContentFormatter(stringProvider), + stateContentFormatter = StateContentFormatter(stringProvider), + ), ), coroutineDispatchers = coroutineDispatchers, notificationSettingsService = matrixClient.notificationSettingsService(), From bbd871031a03cf06156d10bfb1242b5351e1287a Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 22 Jan 2024 14:21:49 +0100 Subject: [PATCH 10/10] Fix detekt issue: Use `?.let {}` instead of if/else with a null block when checking for nullable values [UseLet] --- .../features/roomlist/impl/model/RoomListRoomSummaryProvider.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryProvider.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryProvider.kt index e312d2bf14..0a45aa10f9 100644 --- a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryProvider.kt +++ b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryProvider.kt @@ -49,7 +49,7 @@ internal fun aRoomListRoomSummary( name: String = "Room name", hasUnread: Boolean = false, lastMessage: String? = "Last message", - timestamp: String? = if (lastMessage != null) "88:88" else null, + timestamp: String? = lastMessage?.let { "88:88" }, isPlaceholder: Boolean = false, notificationMode: RoomNotificationMode? = null, hasRoomCall: Boolean = false,