Merge pull request #2080 from element-hq/feature/bma/roomListBadges
Room list badges
This commit is contained in:
1
.idea/dictionaries/shared.xml
generated
1
.idea/dictionaries/shared.xml
generated
@@ -16,6 +16,7 @@
|
||||
<w>snackbar</w>
|
||||
<w>swipeable</w>
|
||||
<w>textfields</w>
|
||||
<w>tombstoned</w>
|
||||
</words>
|
||||
</dictionary>
|
||||
</component>
|
||||
|
||||
@@ -170,7 +170,7 @@ class InviteListPresenter @Inject constructor(
|
||||
AvatarData(
|
||||
id = roomId.value,
|
||||
name = name,
|
||||
url = avatarURLString,
|
||||
url = avatarUrl,
|
||||
size = AvatarSize.RoomInviteItem,
|
||||
)
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ import io.element.android.libraries.matrix.api.core.RoomId
|
||||
import io.element.android.libraries.matrix.api.room.RoomMember
|
||||
import io.element.android.libraries.matrix.api.room.RoomMembershipState
|
||||
import io.element.android.libraries.matrix.api.roomlist.RoomSummary
|
||||
import io.element.android.libraries.matrix.api.roomlist.RoomSummaryDetails
|
||||
import io.element.android.libraries.matrix.test.AN_AVATAR_URL
|
||||
import io.element.android.libraries.matrix.test.A_ROOM_ID
|
||||
import io.element.android.libraries.matrix.test.A_ROOM_ID_2
|
||||
@@ -39,6 +38,7 @@ import io.element.android.libraries.matrix.test.A_USER_ID
|
||||
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.room.FakeMatrixRoom
|
||||
import io.element.android.libraries.matrix.test.room.aRoomSummaryDetails
|
||||
import io.element.android.libraries.matrix.test.roomlist.FakeRoomListService
|
||||
import io.element.android.libraries.push.api.notifications.NotificationDrawerManager
|
||||
import io.element.android.libraries.push.test.notifications.FakeNotificationDrawerManager
|
||||
@@ -425,14 +425,12 @@ class InviteListPresenterTests {
|
||||
postInviteRooms(
|
||||
listOf(
|
||||
RoomSummary.Filled(
|
||||
RoomSummaryDetails(
|
||||
aRoomSummaryDetails(
|
||||
roomId = A_ROOM_ID,
|
||||
name = A_ROOM_NAME,
|
||||
avatarURLString = null,
|
||||
avatarUrl = null,
|
||||
isDirect = false,
|
||||
lastMessage = null,
|
||||
lastMessageTimestamp = null,
|
||||
unreadNotificationCount = 0,
|
||||
inviter = RoomMember(
|
||||
userId = A_USER_ID,
|
||||
displayName = A_USER_NAME,
|
||||
@@ -454,14 +452,12 @@ class InviteListPresenterTests {
|
||||
postInviteRooms(
|
||||
listOf(
|
||||
RoomSummary.Filled(
|
||||
RoomSummaryDetails(
|
||||
aRoomSummaryDetails(
|
||||
roomId = A_ROOM_ID,
|
||||
name = A_ROOM_NAME,
|
||||
avatarURLString = null,
|
||||
avatarUrl = null,
|
||||
isDirect = true,
|
||||
lastMessage = null,
|
||||
lastMessageTimestamp = null,
|
||||
unreadNotificationCount = 0,
|
||||
inviter = RoomMember(
|
||||
userId = A_USER_ID,
|
||||
displayName = A_USER_NAME,
|
||||
@@ -480,14 +476,12 @@ class InviteListPresenterTests {
|
||||
}
|
||||
|
||||
private fun aRoomSummary(id: RoomId = A_ROOM_ID) = RoomSummary.Filled(
|
||||
RoomSummaryDetails(
|
||||
aRoomSummaryDetails(
|
||||
roomId = id,
|
||||
name = A_ROOM_NAME,
|
||||
avatarURLString = null,
|
||||
avatarUrl = null,
|
||||
isDirect = false,
|
||||
lastMessage = null,
|
||||
lastMessageTimestamp = null,
|
||||
unreadNotificationCount = 0,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -18,9 +18,6 @@ package io.element.android.features.messages.impl.forward
|
||||
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
||||
import io.element.android.libraries.matrix.api.core.RoomId
|
||||
import io.element.android.libraries.matrix.api.room.RoomMember
|
||||
import io.element.android.libraries.matrix.api.room.message.RoomMessage
|
||||
import io.element.android.libraries.matrix.api.roomlist.RoomSummaryDetails
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
|
||||
@@ -51,30 +48,3 @@ fun aForwardMessagesState(
|
||||
forwardingSucceeded = forwardingSucceeded,
|
||||
eventSink = {}
|
||||
)
|
||||
|
||||
internal fun aForwardMessagesRoomList() = persistentListOf(
|
||||
aRoomDetailsState(),
|
||||
aRoomDetailsState(roomId = RoomId("!room2:domain"), canonicalAlias = "#element-x-room:matrix.org"),
|
||||
)
|
||||
|
||||
fun aRoomDetailsState(
|
||||
roomId: RoomId = RoomId("!room:domain"),
|
||||
name: String = "roomName",
|
||||
canonicalAlias: String? = null,
|
||||
isDirect: Boolean = true,
|
||||
avatarURLString: String? = null,
|
||||
lastMessage: RoomMessage? = null,
|
||||
lastMessageTimestamp: Long? = null,
|
||||
unreadNotificationCount: Int = 0,
|
||||
inviter: RoomMember? = null,
|
||||
) = RoomSummaryDetails(
|
||||
roomId = roomId,
|
||||
name = name,
|
||||
canonicalAlias = canonicalAlias,
|
||||
isDirect = isDirect,
|
||||
avatarURLString = avatarURLString,
|
||||
lastMessage = lastMessage,
|
||||
lastMessageTimestamp = lastMessageTimestamp,
|
||||
unreadNotificationCount = unreadNotificationCount,
|
||||
inviter = inviter,
|
||||
)
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.google.common.truth.Truth.assertThat
|
||||
import io.element.android.libraries.matrix.api.core.EventId
|
||||
import io.element.android.libraries.matrix.test.AN_EVENT_ID
|
||||
import io.element.android.libraries.matrix.test.room.FakeMatrixRoom
|
||||
import io.element.android.libraries.matrix.test.room.aRoomSummaryDetail
|
||||
import io.element.android.libraries.matrix.test.room.aRoomSummaryDetails
|
||||
import io.element.android.tests.testutils.WarmUpRule
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.test.runTest
|
||||
@@ -55,7 +55,7 @@ class ForwardMessagesPresenterTests {
|
||||
presenter.present()
|
||||
}.test {
|
||||
skipItems(1)
|
||||
val summary = aRoomSummaryDetail()
|
||||
val summary = aRoomSummaryDetails()
|
||||
presenter.onRoomSelected(listOf(summary.roomId))
|
||||
val forwardingState = awaitItem()
|
||||
assertThat(forwardingState.isForwarding).isTrue()
|
||||
@@ -75,7 +75,7 @@ class ForwardMessagesPresenterTests {
|
||||
// Test failed forwarding
|
||||
room.givenForwardEventResult(Result.failure(Throwable("error")))
|
||||
skipItems(1)
|
||||
val summary = aRoomSummaryDetail()
|
||||
val summary = aRoomSummaryDetails()
|
||||
presenter.onRoomSelected(listOf(summary.roomId))
|
||||
skipItems(1)
|
||||
val failedForwardState = awaitItem()
|
||||
|
||||
@@ -24,7 +24,7 @@ import io.element.android.libraries.matrix.api.roomlist.RoomSummary
|
||||
import io.element.android.libraries.matrix.api.roomlist.RoomSummaryDetails
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
|
||||
open class EditDefaultNotificationSettingStateProvider: PreviewParameterProvider<EditDefaultNotificationSettingState> {
|
||||
open class EditDefaultNotificationSettingStateProvider : PreviewParameterProvider<EditDefaultNotificationSettingState> {
|
||||
override val values: Sequence<EditDefaultNotificationSettingState>
|
||||
get() = sequenceOf(
|
||||
anEditDefaultNotificationSettingsState(),
|
||||
@@ -52,11 +52,14 @@ private fun aRoomSummary() = RoomSummary.Filled(
|
||||
RoomSummaryDetails(
|
||||
roomId = RoomId("!roomId:domain"),
|
||||
name = "Room",
|
||||
avatarURLString = null,
|
||||
avatarUrl = null,
|
||||
isDirect = false,
|
||||
lastMessage = null,
|
||||
lastMessageTimestamp = null,
|
||||
unreadNotificationCount = 0,
|
||||
notificationMode = RoomNotificationMode.MENTIONS_AND_KEYWORDS_ONLY,
|
||||
userDefinedNotificationMode = RoomNotificationMode.MENTIONS_AND_KEYWORDS_ONLY,
|
||||
canonicalAlias = null,
|
||||
inviter = null,
|
||||
hasRoomCall = false,
|
||||
numUnreadMentions = 0,
|
||||
numUnreadMessages = 0,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -86,7 +86,7 @@ fun EditDefaultNotificationSettingView(
|
||||
if (state.roomsWithUserDefinedMode.isNotEmpty()) {
|
||||
PreferenceCategory(title = stringResource(id = R.string.screen_notification_settings_edit_custom_settings_section_title)) {
|
||||
state.roomsWithUserDefinedMode.forEach { summary ->
|
||||
val subtitle = when (summary.details.notificationMode) {
|
||||
val subtitle = when (summary.details.userDefinedNotificationMode) {
|
||||
RoomNotificationMode.ALL_MESSAGES -> stringResource(id = R.string.screen_notification_settings_edit_mode_all_messages)
|
||||
RoomNotificationMode.MENTIONS_AND_KEYWORDS_ONLY -> {
|
||||
stringResource(id = R.string.screen_notification_settings_edit_mode_mentions_and_keywords)
|
||||
@@ -97,7 +97,7 @@ fun EditDefaultNotificationSettingView(
|
||||
val avatarData = AvatarData(
|
||||
id = summary.identifier(),
|
||||
name = summary.details.name,
|
||||
url = summary.details.avatarURLString,
|
||||
url = summary.details.avatarUrl,
|
||||
size = AvatarSize.CustomRoomNotificationSetting,
|
||||
)
|
||||
ListItem(
|
||||
|
||||
@@ -29,7 +29,7 @@ import io.element.android.libraries.matrix.test.A_THROWABLE
|
||||
import io.element.android.libraries.matrix.test.FakeMatrixClient
|
||||
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.aRoomSummaryDetail
|
||||
import io.element.android.libraries.matrix.test.room.aRoomSummaryDetails
|
||||
import io.element.android.libraries.matrix.test.roomlist.FakeRoomListService
|
||||
import io.element.android.tests.testutils.awaitLastSequentialItem
|
||||
import io.element.android.tests.testutils.consumeItemsUntilPredicate
|
||||
@@ -72,11 +72,11 @@ class EditDefaultNotificationSettingsPresenterTests {
|
||||
moleculeFlow(RecompositionMode.Immediate) {
|
||||
presenter.present()
|
||||
}.test {
|
||||
roomListService.postAllRooms(listOf(RoomSummary.Filled(aRoomSummaryDetail(notificationMode = RoomNotificationMode.ALL_MESSAGES))))
|
||||
roomListService.postAllRooms(listOf(RoomSummary.Filled(aRoomSummaryDetails(notificationMode = RoomNotificationMode.ALL_MESSAGES))))
|
||||
val loadedState = consumeItemsUntilPredicate { state ->
|
||||
state.roomsWithUserDefinedMode.any { it.details.notificationMode == RoomNotificationMode.ALL_MESSAGES }
|
||||
state.roomsWithUserDefinedMode.any { it.details.userDefinedNotificationMode == RoomNotificationMode.ALL_MESSAGES }
|
||||
}.last()
|
||||
assertThat(loadedState.roomsWithUserDefinedMode.any { it.details.notificationMode == RoomNotificationMode.ALL_MESSAGES }).isTrue()
|
||||
assertThat(loadedState.roomsWithUserDefinedMode.any { it.details.userDefinedNotificationMode == RoomNotificationMode.ALL_MESSAGES }).isTrue()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ internal fun aRoomListRoomSummaryList(): ImmutableList<RoomListRoomSummary> {
|
||||
return persistentListOf(
|
||||
RoomListRoomSummary(
|
||||
name = "Room",
|
||||
hasUnread = true,
|
||||
numberOfUnreadMessages = 1,
|
||||
timestamp = "14:18",
|
||||
lastMessage = "A very very very very long message which suites on two lines",
|
||||
avatarData = AvatarData("!id", "R", size = AvatarSize.RoomListItem),
|
||||
@@ -80,7 +80,7 @@ internal fun aRoomListRoomSummaryList(): ImmutableList<RoomListRoomSummary> {
|
||||
),
|
||||
RoomListRoomSummary(
|
||||
name = "Room#2",
|
||||
hasUnread = false,
|
||||
numberOfUnreadMessages = 0,
|
||||
timestamp = "14:16",
|
||||
lastMessage = "A short message",
|
||||
avatarData = AvatarData("!id", "Z", size = AvatarSize.RoomListItem),
|
||||
|
||||
@@ -43,6 +43,7 @@ import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.compound.tokens.generated.CompoundIcons
|
||||
import io.element.android.features.roomlist.impl.model.RoomListRoomSummary
|
||||
import io.element.android.features.roomlist.impl.model.RoomListRoomSummaryProvider
|
||||
import io.element.android.features.roomlist.impl.model.isTimestampHighlighted
|
||||
import io.element.android.libraries.core.extensions.orEmpty
|
||||
import io.element.android.libraries.designsystem.atomic.atoms.UnreadIndicatorAtom
|
||||
import io.element.android.libraries.designsystem.components.avatar.Avatar
|
||||
@@ -141,7 +142,7 @@ private fun RowScope.NameAndTimestampRow(room: RoomListRoomSummary) {
|
||||
Text(
|
||||
text = room.timestamp ?: "",
|
||||
style = ElementTheme.typography.fontBodySmMedium,
|
||||
color = if (room.hasUnread) {
|
||||
color = if (room.isTimestampHighlighted()) {
|
||||
ElementTheme.colors.unreadIndicator
|
||||
} else {
|
||||
MaterialTheme.roomListRoomMessageDate()
|
||||
@@ -173,40 +174,77 @@ private fun RowScope.LastMessageAndIndicatorRow(room: RoomListRoomSummary) {
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
// Video call
|
||||
if (room.hasOngoingCall) {
|
||||
Icon(
|
||||
modifier = Modifier.size(16.dp),
|
||||
imageVector = CompoundIcons.VideoCallSolid,
|
||||
contentDescription = null,
|
||||
tint = ElementTheme.colors.unreadIndicator,
|
||||
)
|
||||
}
|
||||
NotificationIcon(room)
|
||||
if (room.hasUnread) {
|
||||
UnreadIndicatorAtom()
|
||||
}
|
||||
OnGoingCallIcon(
|
||||
room.hasRoomCall,
|
||||
)
|
||||
// Other indicators
|
||||
NotificationIcons(
|
||||
room.userDefinedNotificationMode,
|
||||
room.numberOfUnreadMessages,
|
||||
room.numberOfUnreadMentions,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun NotificationIcon(room: RoomListRoomSummary) {
|
||||
val tint = if (room.hasUnread) ElementTheme.colors.unreadIndicator else ElementTheme.colors.iconQuaternary
|
||||
when (room.notificationMode) {
|
||||
null, RoomNotificationMode.ALL_MESSAGES -> return
|
||||
RoomNotificationMode.MENTIONS_AND_KEYWORDS_ONLY ->
|
||||
Icon(
|
||||
modifier = Modifier.size(16.dp),
|
||||
contentDescription = null,
|
||||
imageVector = CompoundIcons.Mention,
|
||||
tint = tint,
|
||||
)
|
||||
RoomNotificationMode.MUTE ->
|
||||
private fun OnGoingCallIcon(
|
||||
hasRoomCall: Boolean,
|
||||
) {
|
||||
if (hasRoomCall) {
|
||||
Icon(
|
||||
modifier = Modifier.size(16.dp),
|
||||
imageVector = CompoundIcons.VideoCallSolid,
|
||||
contentDescription = null,
|
||||
tint = ElementTheme.colors.unreadIndicator,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun RowScope.NotificationIcons(
|
||||
userDefinedNotificationMode: RoomNotificationMode?,
|
||||
numberOfUnreadMessages: Int,
|
||||
numberOfUnreadMentions: Int,
|
||||
) {
|
||||
when (userDefinedNotificationMode) {
|
||||
null,
|
||||
RoomNotificationMode.ALL_MESSAGES -> {
|
||||
if (numberOfUnreadMentions > 0) {
|
||||
Icon(
|
||||
modifier = Modifier.size(16.dp),
|
||||
contentDescription = null,
|
||||
imageVector = CompoundIcons.Mention,
|
||||
tint = ElementTheme.colors.unreadIndicator,
|
||||
)
|
||||
UnreadIndicatorAtom()
|
||||
} else if (numberOfUnreadMessages > 0) {
|
||||
UnreadIndicatorAtom()
|
||||
}
|
||||
}
|
||||
RoomNotificationMode.MENTIONS_AND_KEYWORDS_ONLY -> {
|
||||
if (numberOfUnreadMentions > 0) {
|
||||
Icon(
|
||||
modifier = Modifier.size(16.dp),
|
||||
contentDescription = null,
|
||||
imageVector = CompoundIcons.Mention,
|
||||
tint = ElementTheme.colors.unreadIndicator,
|
||||
)
|
||||
UnreadIndicatorAtom()
|
||||
} else if (numberOfUnreadMessages > 0) {
|
||||
UnreadIndicatorAtom(color = ElementTheme.colors.iconQuaternary)
|
||||
}
|
||||
}
|
||||
RoomNotificationMode.MUTE -> {
|
||||
Icon(
|
||||
modifier = Modifier.size(16.dp),
|
||||
contentDescription = null,
|
||||
imageVector = CompoundIcons.NotificationsSolidOff,
|
||||
tint = tint,
|
||||
tint = ElementTheme.colors.iconQuaternary,
|
||||
)
|
||||
if (numberOfUnreadMessages > 0 || numberOfUnreadMentions > 0) {
|
||||
UnreadIndicatorAtom(color = ElementTheme.colors.iconQuaternary)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ class RoomListDataSource @Inject constructor(
|
||||
val avatarData = AvatarData(
|
||||
id = roomSummary.identifier(),
|
||||
name = roomSummary.details.name,
|
||||
url = roomSummary.details.avatarURLString,
|
||||
url = roomSummary.details.avatarUrl,
|
||||
size = AvatarSize.RoomListItem,
|
||||
)
|
||||
val roomIdentifier = roomSummary.identifier()
|
||||
@@ -154,14 +154,15 @@ class RoomListDataSource @Inject constructor(
|
||||
id = roomSummary.identifier(),
|
||||
roomId = RoomId(roomIdentifier),
|
||||
name = roomSummary.details.name,
|
||||
hasUnread = roomSummary.details.unreadNotificationCount > 0,
|
||||
numberOfUnreadMessages = roomSummary.details.numUnreadMessages,
|
||||
numberOfUnreadMentions = roomSummary.details.numUnreadMentions,
|
||||
timestamp = lastMessageTimestampFormatter.format(roomSummary.details.lastMessageTimestamp),
|
||||
lastMessage = roomSummary.details.lastMessage?.let { message ->
|
||||
roomLastMessageFormatter.format(message.event, roomSummary.details.isDirect)
|
||||
}.orEmpty(),
|
||||
avatarData = avatarData,
|
||||
notificationMode = roomSummary.details.notificationMode,
|
||||
hasOngoingCall = roomSummary.details.hasOngoingCall,
|
||||
userDefinedNotificationMode = roomSummary.details.userDefinedNotificationMode,
|
||||
hasRoomCall = roomSummary.details.hasRoomCall,
|
||||
)
|
||||
}
|
||||
null -> null
|
||||
|
||||
@@ -27,11 +27,22 @@ 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 notificationMode: RoomNotificationMode? = null,
|
||||
val hasOngoingCall: Boolean = false,
|
||||
val userDefinedNotificationMode: RoomNotificationMode? = null,
|
||||
val numberOfUnreadMessages: Int = 0,
|
||||
val numberOfUnreadMentions: Int = 0,
|
||||
val hasRoomCall: Boolean = false,
|
||||
)
|
||||
|
||||
fun RoomListRoomSummary.isTimestampHighlighted(): Boolean {
|
||||
return hasRoomCall ||
|
||||
when (userDefinedNotificationMode) {
|
||||
null,
|
||||
RoomNotificationMode.ALL_MESSAGES -> numberOfUnreadMessages > 0 || numberOfUnreadMentions > 0
|
||||
RoomNotificationMode.MENTIONS_AND_KEYWORDS_ONLY -> numberOfUnreadMentions > 0
|
||||
RoomNotificationMode.MUTE -> false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,32 +25,83 @@ import io.element.android.libraries.matrix.api.room.RoomNotificationMode
|
||||
open class RoomListRoomSummaryProvider : PreviewParameterProvider<RoomListRoomSummary> {
|
||||
override val values: Sequence<RoomListRoomSummary>
|
||||
get() = sequenceOf(
|
||||
aRoomListRoomSummary(),
|
||||
aRoomListRoomSummary().copy(lastMessage = null),
|
||||
aRoomListRoomSummary().copy(hasUnread = true, notificationMode = RoomNotificationMode.MENTIONS_AND_KEYWORDS_ONLY),
|
||||
aRoomListRoomSummary().copy(timestamp = "88:88", notificationMode = RoomNotificationMode.MENTIONS_AND_KEYWORDS_ONLY),
|
||||
aRoomListRoomSummary().copy(timestamp = "88:88", notificationMode = RoomNotificationMode.MUTE),
|
||||
aRoomListRoomSummary().copy(timestamp = "88:88", hasUnread = true),
|
||||
aRoomListRoomSummary().copy(isPlaceholder = true, timestamp = "88:88"),
|
||||
aRoomListRoomSummary().copy(
|
||||
name = "A very long room name that should be truncated",
|
||||
lastMessage = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt" +
|
||||
" ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea com" +
|
||||
"modo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.",
|
||||
timestamp = "yesterday",
|
||||
hasUnread = true,
|
||||
listOf(
|
||||
aRoomListRoomSummary(isPlaceholder = true),
|
||||
aRoomListRoomSummary(timestamp = null),
|
||||
aRoomListRoomSummary(lastMessage = "Last message"),
|
||||
aRoomListRoomSummary(
|
||||
name = "A very long room name that should be truncated",
|
||||
lastMessage = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt" +
|
||||
" ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea com" +
|
||||
"modo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.",
|
||||
timestamp = "yesterday",
|
||||
numberOfUnreadMessages = 1,
|
||||
),
|
||||
),
|
||||
aRoomListRoomSummary().copy(hasUnread = true, hasOngoingCall = true),
|
||||
)
|
||||
listOf(false, true).map { hasCall ->
|
||||
listOf(
|
||||
RoomNotificationMode.ALL_MESSAGES,
|
||||
RoomNotificationMode.MENTIONS_AND_KEYWORDS_ONLY,
|
||||
RoomNotificationMode.MUTE,
|
||||
).map { roomNotificationMode ->
|
||||
listOf(
|
||||
aRoomListRoomSummary(
|
||||
name = roomNotificationMode.name,
|
||||
lastMessage = "No activity" + if (hasCall) ", call" else "",
|
||||
notificationMode = roomNotificationMode,
|
||||
numberOfUnreadMessages = 0,
|
||||
numberOfUnreadMentions = 0,
|
||||
hasOngoingCall = hasCall,
|
||||
),
|
||||
aRoomListRoomSummary(
|
||||
name = roomNotificationMode.name,
|
||||
lastMessage = "New messages" + if (hasCall) ", call" else "",
|
||||
notificationMode = roomNotificationMode,
|
||||
numberOfUnreadMessages = 1,
|
||||
numberOfUnreadMentions = 0,
|
||||
hasOngoingCall = hasCall,
|
||||
),
|
||||
aRoomListRoomSummary(
|
||||
name = roomNotificationMode.name,
|
||||
lastMessage = "New messages, mentions" + if (hasCall) ", call" else "",
|
||||
notificationMode = roomNotificationMode,
|
||||
numberOfUnreadMessages = 1,
|
||||
numberOfUnreadMentions = 1,
|
||||
hasOngoingCall = hasCall,
|
||||
),
|
||||
aRoomListRoomSummary(
|
||||
name = roomNotificationMode.name,
|
||||
lastMessage = "New mentions" + if (hasCall) ", call" else "",
|
||||
notificationMode = roomNotificationMode,
|
||||
numberOfUnreadMessages = 0,
|
||||
numberOfUnreadMentions = 1,
|
||||
hasOngoingCall = hasCall,
|
||||
),
|
||||
)
|
||||
}.flatten()
|
||||
}.flatten(),
|
||||
).flatten()
|
||||
}
|
||||
|
||||
fun aRoomListRoomSummary() = RoomListRoomSummary(
|
||||
fun aRoomListRoomSummary(
|
||||
lastMessage: String? = null,
|
||||
notificationMode: RoomNotificationMode? = null,
|
||||
numberOfUnreadMessages: Int = 0,
|
||||
numberOfUnreadMentions: Int = 0,
|
||||
timestamp: String? = "88:88",
|
||||
hasOngoingCall: Boolean = false,
|
||||
isPlaceholder: Boolean = false,
|
||||
name: String = "Room name",
|
||||
) = RoomListRoomSummary(
|
||||
id = "!roomId",
|
||||
roomId = RoomId("!roomId:domain"),
|
||||
name = "Room name",
|
||||
hasUnread = false,
|
||||
timestamp = null,
|
||||
lastMessage = "Last message",
|
||||
name = name,
|
||||
numberOfUnreadMessages = numberOfUnreadMessages,
|
||||
numberOfUnreadMentions = numberOfUnreadMentions,
|
||||
timestamp = timestamp,
|
||||
lastMessage = lastMessage,
|
||||
avatarData = AvatarData("!roomId", "Room name", size = AvatarSize.RoomListItem),
|
||||
isPlaceholder = false,
|
||||
isPlaceholder = isPlaceholder,
|
||||
userDefinedNotificationMode = notificationMode,
|
||||
hasRoomCall = hasOngoingCall,
|
||||
)
|
||||
|
||||
@@ -123,7 +123,7 @@ class RoomListPresenterTests {
|
||||
fun `present - should start with no user and then load user with error`() = runTest {
|
||||
val matrixClient = FakeMatrixClient(
|
||||
userDisplayName = Result.failure(AN_EXCEPTION),
|
||||
userAvatarURLString = Result.failure(AN_EXCEPTION),
|
||||
userAvatarUrl = Result.failure(AN_EXCEPTION),
|
||||
)
|
||||
val scope = CoroutineScope(coroutineContext + SupervisorJob())
|
||||
val presenter = createRoomListPresenter(client = matrixClient, coroutineScope = scope)
|
||||
@@ -385,11 +385,11 @@ class RoomListPresenterTests {
|
||||
notificationSettingsService.setRoomNotificationMode(A_ROOM_ID, userDefinedMode)
|
||||
|
||||
val updatedState = consumeItemsUntilPredicate { state ->
|
||||
state.roomList.any { it.id == A_ROOM_ID.value && it.notificationMode == userDefinedMode }
|
||||
state.roomList.any { it.id == A_ROOM_ID.value && it.userDefinedNotificationMode == userDefinedMode }
|
||||
}.last()
|
||||
|
||||
val room = updatedState.roomList.find { it.id == A_ROOM_ID.value }
|
||||
assertThat(room?.notificationMode).isEqualTo(userDefinedMode)
|
||||
assertThat(room?.userDefinedNotificationMode).isEqualTo(userDefinedMode)
|
||||
cancelAndIgnoreRemainingEvents()
|
||||
scope.cancel()
|
||||
}
|
||||
@@ -439,7 +439,8 @@ private val aRoomListRoomSummary = RoomListRoomSummary(
|
||||
id = A_ROOM_ID.value,
|
||||
roomId = A_ROOM_ID,
|
||||
name = A_ROOM_NAME,
|
||||
hasUnread = true,
|
||||
numberOfUnreadMentions = 1,
|
||||
numberOfUnreadMessages = 2,
|
||||
timestamp = A_FORMATTED_DATE,
|
||||
lastMessage = "",
|
||||
avatarData = AvatarData(id = A_ROOM_ID.value, name = A_ROOM_NAME, size = AvatarSize.RoomListItem),
|
||||
|
||||
@@ -72,7 +72,7 @@ interface MatrixClient : Closeable {
|
||||
*/
|
||||
suspend fun logout(ignoreSdkError: Boolean): String?
|
||||
suspend fun loadUserDisplayName(): Result<String>
|
||||
suspend fun loadUserAvatarURLString(): Result<String?>
|
||||
suspend fun loadUserAvatarUrl(): Result<String?>
|
||||
suspend fun getAccountManagementUrl(action: AccountManagementAction?): Result<String?>
|
||||
suspend fun uploadMedia(mimeType: String, data: ByteArray, progressCallback: ProgressCallback?): Result<String>
|
||||
fun roomMembershipObserver(): RoomMembershipObserver
|
||||
|
||||
@@ -36,13 +36,15 @@ sealed interface RoomSummary {
|
||||
data class RoomSummaryDetails(
|
||||
val roomId: RoomId,
|
||||
val name: String,
|
||||
val canonicalAlias: String? = null,
|
||||
val canonicalAlias: String?,
|
||||
val isDirect: Boolean,
|
||||
val avatarURLString: String?,
|
||||
val avatarUrl: String?,
|
||||
val lastMessage: RoomMessage?,
|
||||
val lastMessageTimestamp: Long?,
|
||||
val unreadNotificationCount: Int,
|
||||
val inviter: RoomMember? = null,
|
||||
val notificationMode: RoomNotificationMode? = null,
|
||||
val hasOngoingCall: Boolean = false,
|
||||
)
|
||||
val numUnreadMessages: Int,
|
||||
val numUnreadMentions: Int,
|
||||
val inviter: RoomMember?,
|
||||
val userDefinedNotificationMode: RoomNotificationMode?,
|
||||
val hasRoomCall: Boolean,
|
||||
) {
|
||||
val lastMessageTimestamp = lastMessage?.originServerTs
|
||||
}
|
||||
|
||||
@@ -19,11 +19,11 @@ package io.element.android.libraries.matrix.api.user
|
||||
import io.element.android.libraries.matrix.api.MatrixClient
|
||||
|
||||
/**
|
||||
* Get the current user, as [MatrixUser], using [MatrixClient.loadUserAvatarURLString]
|
||||
* Get the current user, as [MatrixUser], using [MatrixClient.loadUserAvatarUrl]
|
||||
* and [MatrixClient.loadUserDisplayName].
|
||||
*/
|
||||
suspend fun MatrixClient.getCurrentUser(): MatrixUser {
|
||||
val userAvatarUrl = loadUserAvatarURLString().getOrNull()
|
||||
val userAvatarUrl = loadUserAvatarUrl().getOrNull()
|
||||
val userDisplayName = loadUserDisplayName().getOrNull()
|
||||
return MatrixUser(
|
||||
userId = sessionId,
|
||||
|
||||
@@ -412,7 +412,7 @@ class RustMatrixClient(
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun loadUserAvatarURLString(): Result<String?> = withContext(sessionDispatcher) {
|
||||
override suspend fun loadUserAvatarUrl(): Result<String?> = withContext(sessionDispatcher) {
|
||||
runCatching {
|
||||
client.avatarUrl()
|
||||
}
|
||||
|
||||
@@ -35,13 +35,13 @@ class RoomSummaryDetailsFactory(private val roomMessageFactory: RoomMessageFacto
|
||||
name = roomInfo.name ?: roomInfo.id,
|
||||
canonicalAlias = roomInfo.canonicalAlias,
|
||||
isDirect = roomInfo.isDirect,
|
||||
avatarURLString = roomInfo.avatarUrl,
|
||||
unreadNotificationCount = roomInfo.notificationCount.toInt(),
|
||||
avatarUrl = roomInfo.avatarUrl,
|
||||
lastMessage = latestRoomMessage,
|
||||
lastMessageTimestamp = latestRoomMessage?.originServerTs,
|
||||
inviter = roomInfo.inviter?.let(RoomMemberMapper::map),
|
||||
notificationMode = roomInfo.userDefinedNotificationMode?.let(RoomNotificationSettingsMapper::mapMode),
|
||||
hasOngoingCall = roomInfo.hasRoomCall,
|
||||
userDefinedNotificationMode = roomInfo.userDefinedNotificationMode?.let(RoomNotificationSettingsMapper::mapMode),
|
||||
hasRoomCall = roomInfo.hasRoomCall,
|
||||
numUnreadMentions = roomInfo.numUnreadMentions.toInt(),
|
||||
numUnreadMessages = roomInfo.numUnreadMessages.toInt(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ import kotlinx.coroutines.delay
|
||||
class FakeMatrixClient(
|
||||
override val sessionId: SessionId = A_SESSION_ID,
|
||||
private val userDisplayName: Result<String> = Result.success(A_USER_NAME),
|
||||
private val userAvatarURLString: Result<String> = Result.success(AN_AVATAR_URL),
|
||||
private val userAvatarUrl: Result<String> = Result.success(AN_AVATAR_URL),
|
||||
override val roomListService: RoomListService = FakeRoomListService(),
|
||||
override val mediaLoader: MatrixMediaLoader = FakeMediaLoader(),
|
||||
private val sessionVerificationService: FakeSessionVerificationService = FakeSessionVerificationService(),
|
||||
@@ -136,8 +136,8 @@ class FakeMatrixClient(
|
||||
return userDisplayName
|
||||
}
|
||||
|
||||
override suspend fun loadUserAvatarURLString(): Result<String?> {
|
||||
return userAvatarURLString
|
||||
override suspend fun loadUserAvatarUrl(): Result<String?> {
|
||||
return userAvatarUrl
|
||||
}
|
||||
|
||||
override suspend fun getAccountManagementUrl(action: AccountManagementAction?): Result<String?> {
|
||||
|
||||
@@ -19,6 +19,7 @@ package io.element.android.libraries.matrix.test.room
|
||||
import io.element.android.libraries.matrix.api.core.EventId
|
||||
import io.element.android.libraries.matrix.api.core.RoomId
|
||||
import io.element.android.libraries.matrix.api.core.UserId
|
||||
import io.element.android.libraries.matrix.api.room.RoomMember
|
||||
import io.element.android.libraries.matrix.api.room.RoomNotificationMode
|
||||
import io.element.android.libraries.matrix.api.room.message.RoomMessage
|
||||
import io.element.android.libraries.matrix.api.roomlist.RoomSummary
|
||||
@@ -34,42 +35,48 @@ fun aRoomSummaryFilled(
|
||||
roomId: RoomId = A_ROOM_ID,
|
||||
name: String = A_ROOM_NAME,
|
||||
isDirect: Boolean = false,
|
||||
avatarURLString: String? = null,
|
||||
avatarUrl: String? = null,
|
||||
lastMessage: RoomMessage? = aRoomMessage(),
|
||||
lastMessageTimestamp: Long? = null,
|
||||
unreadNotificationCount: Int = 2,
|
||||
numUnreadMentions: Int = 1,
|
||||
numUnreadMessages: Int = 2,
|
||||
notificationMode: RoomNotificationMode? = null,
|
||||
) = RoomSummary.Filled(
|
||||
aRoomSummaryDetail(
|
||||
aRoomSummaryDetails(
|
||||
roomId = roomId,
|
||||
name = name,
|
||||
isDirect = isDirect,
|
||||
avatarURLString = avatarURLString,
|
||||
avatarUrl = avatarUrl,
|
||||
lastMessage = lastMessage,
|
||||
lastMessageTimestamp = lastMessageTimestamp,
|
||||
unreadNotificationCount = unreadNotificationCount,
|
||||
numUnreadMentions = numUnreadMentions,
|
||||
numUnreadMessages = numUnreadMessages,
|
||||
notificationMode = notificationMode,
|
||||
)
|
||||
)
|
||||
|
||||
fun aRoomSummaryDetail(
|
||||
fun aRoomSummaryDetails(
|
||||
roomId: RoomId = A_ROOM_ID,
|
||||
name: String = A_ROOM_NAME,
|
||||
isDirect: Boolean = false,
|
||||
avatarURLString: String? = null,
|
||||
avatarUrl: String? = null,
|
||||
lastMessage: RoomMessage? = aRoomMessage(),
|
||||
lastMessageTimestamp: Long? = null,
|
||||
unreadNotificationCount: Int = 2,
|
||||
notificationMode: RoomNotificationMode? = null,
|
||||
inviter: RoomMember? = null,
|
||||
canonicalAlias: String? = null,
|
||||
hasOngoingCall: Boolean = false,
|
||||
numUnreadMentions: Int = 0,
|
||||
numUnreadMessages: Int = 0,
|
||||
) = RoomSummaryDetails(
|
||||
roomId = roomId,
|
||||
name = name,
|
||||
isDirect = isDirect,
|
||||
avatarURLString = avatarURLString,
|
||||
avatarUrl = avatarUrl,
|
||||
lastMessage = lastMessage,
|
||||
lastMessageTimestamp = lastMessageTimestamp,
|
||||
unreadNotificationCount = unreadNotificationCount,
|
||||
notificationMode = notificationMode
|
||||
userDefinedNotificationMode = notificationMode,
|
||||
canonicalAlias = canonicalAlias,
|
||||
inviter = inviter,
|
||||
hasRoomCall = hasOngoingCall,
|
||||
numUnreadMentions = numUnreadMentions,
|
||||
numUnreadMessages = numUnreadMessages,
|
||||
)
|
||||
|
||||
fun aRoomMessage(
|
||||
|
||||
@@ -44,6 +44,9 @@ import io.element.android.libraries.designsystem.theme.components.Icon
|
||||
import io.element.android.libraries.designsystem.theme.components.Surface
|
||||
import io.element.android.libraries.designsystem.theme.components.Text
|
||||
import io.element.android.libraries.matrix.api.core.RoomId
|
||||
import io.element.android.libraries.matrix.api.room.RoomMember
|
||||
import io.element.android.libraries.matrix.api.room.RoomNotificationMode
|
||||
import io.element.android.libraries.matrix.api.room.message.RoomMessage
|
||||
import io.element.android.libraries.matrix.api.roomlist.RoomSummaryDetails
|
||||
import io.element.android.libraries.ui.strings.CommonStrings
|
||||
|
||||
@@ -60,7 +63,7 @@ fun SelectedRoom(
|
||||
Column(
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
) {
|
||||
Avatar(AvatarData(roomSummary.roomId.value, roomSummary.name, roomSummary.avatarURLString, AvatarSize.SelectedRoom))
|
||||
Avatar(AvatarData(roomSummary.roomId.value, roomSummary.name, roomSummary.avatarUrl, AvatarSize.SelectedRoom))
|
||||
Text(
|
||||
text = roomSummary.name,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
@@ -94,17 +97,33 @@ fun SelectedRoom(
|
||||
@Composable
|
||||
internal fun SelectedRoomPreview() = ElementPreview {
|
||||
SelectedRoom(
|
||||
roomSummary = RoomSummaryDetails(
|
||||
roomId = RoomId("!room:domain"),
|
||||
name = "roomName",
|
||||
canonicalAlias = null,
|
||||
isDirect = true,
|
||||
avatarURLString = null,
|
||||
lastMessage = null,
|
||||
lastMessageTimestamp = null,
|
||||
unreadNotificationCount = 0,
|
||||
inviter = null,
|
||||
),
|
||||
roomSummary = aRoomSummaryDetails(),
|
||||
onRoomRemoved = {},
|
||||
)
|
||||
}
|
||||
|
||||
fun aRoomSummaryDetails(
|
||||
roomId: RoomId = RoomId("!room:domain"),
|
||||
name: String = "roomName",
|
||||
canonicalAlias: String? = null,
|
||||
isDirect: Boolean = true,
|
||||
avatarUrl: String? = null,
|
||||
lastMessage: RoomMessage? = null,
|
||||
inviter: RoomMember? = null,
|
||||
notificationMode: RoomNotificationMode? = null,
|
||||
hasOngoingCall: Boolean = false,
|
||||
numUnreadMentions: Int = 0,
|
||||
numUnreadMessages: Int = 0,
|
||||
) = RoomSummaryDetails(
|
||||
roomId = roomId,
|
||||
name = name,
|
||||
canonicalAlias = canonicalAlias,
|
||||
isDirect = isDirect,
|
||||
avatarUrl = avatarUrl,
|
||||
lastMessage = lastMessage,
|
||||
inviter = inviter,
|
||||
userDefinedNotificationMode = notificationMode,
|
||||
hasRoomCall = hasOngoingCall,
|
||||
numUnreadMentions = numUnreadMentions,
|
||||
numUnreadMessages = numUnreadMessages,
|
||||
)
|
||||
|
||||
@@ -297,7 +297,7 @@ class DefaultNotificationDrawerManager @Inject constructor(
|
||||
operation = {
|
||||
// myUserDisplayName cannot be empty else NotificationCompat.MessagingStyle() will crash
|
||||
val myUserDisplayName = client.loadUserDisplayName().getOrNull() ?: sessionId.value
|
||||
val userAvatarUrl = client.loadUserAvatarURLString().getOrNull()
|
||||
val userAvatarUrl = client.loadUserAvatarUrl().getOrNull()
|
||||
MatrixUser(
|
||||
userId = sessionId,
|
||||
displayName = myUserDisplayName,
|
||||
|
||||
@@ -19,9 +19,8 @@ package io.element.android.libraries.roomselect.impl
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
||||
import io.element.android.libraries.designsystem.theme.components.SearchBarResultState
|
||||
import io.element.android.libraries.matrix.api.core.RoomId
|
||||
import io.element.android.libraries.matrix.api.room.RoomMember
|
||||
import io.element.android.libraries.matrix.api.room.message.RoomMessage
|
||||
import io.element.android.libraries.matrix.api.roomlist.RoomSummaryDetails
|
||||
import io.element.android.libraries.matrix.ui.components.aRoomSummaryDetails
|
||||
import io.element.android.libraries.roomselect.api.RoomSelectMode
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
@@ -41,7 +40,7 @@ open class RoomSelectStateProvider : PreviewParameterProvider<RoomSelectState> {
|
||||
resultState = SearchBarResultState.Results(aForwardMessagesRoomList()),
|
||||
query = "Test",
|
||||
isSearchActive = true,
|
||||
selectedRooms = persistentListOf(aRoomDetailsState(roomId = RoomId("!room2:domain")))
|
||||
selectedRooms = persistentListOf(aRoomSummaryDetails(roomId = RoomId("!room2:domain")))
|
||||
),
|
||||
// Add other states here
|
||||
)
|
||||
@@ -62,32 +61,10 @@ private fun aRoomSelectState(
|
||||
)
|
||||
|
||||
private fun aForwardMessagesRoomList() = persistentListOf(
|
||||
aRoomDetailsState(),
|
||||
aRoomDetailsState(
|
||||
aRoomSummaryDetails(),
|
||||
aRoomSummaryDetails(
|
||||
roomId = RoomId("!room2:domain"),
|
||||
name = "Room with alias",
|
||||
canonicalAlias = "#alias:example.org",
|
||||
),
|
||||
)
|
||||
|
||||
private fun aRoomDetailsState(
|
||||
roomId: RoomId = RoomId("!room:domain"),
|
||||
name: String = "roomName",
|
||||
canonicalAlias: String? = null,
|
||||
isDirect: Boolean = true,
|
||||
avatarURLString: String? = null,
|
||||
lastMessage: RoomMessage? = null,
|
||||
lastMessageTimestamp: Long? = null,
|
||||
unreadNotificationCount: Int = 0,
|
||||
inviter: RoomMember? = null,
|
||||
) = RoomSummaryDetails(
|
||||
roomId = roomId,
|
||||
name = name,
|
||||
canonicalAlias = canonicalAlias,
|
||||
isDirect = isDirect,
|
||||
avatarURLString = avatarURLString,
|
||||
lastMessage = lastMessage,
|
||||
lastMessageTimestamp = lastMessageTimestamp,
|
||||
unreadNotificationCount = unreadNotificationCount,
|
||||
inviter = inviter,
|
||||
)
|
||||
|
||||
@@ -222,7 +222,7 @@ private fun RoomSummaryView(
|
||||
avatarData = AvatarData(
|
||||
id = summary.roomId.value,
|
||||
name = summary.name,
|
||||
url = summary.avatarURLString,
|
||||
url = summary.avatarUrl,
|
||||
size = AvatarSize.RoomSelectRoomListItem,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -24,7 +24,7 @@ import io.element.android.libraries.roomselect.api.RoomSelectMode
|
||||
import io.element.android.libraries.designsystem.theme.components.SearchBarResultState
|
||||
import io.element.android.libraries.matrix.api.roomlist.RoomSummary
|
||||
import io.element.android.libraries.matrix.test.FakeMatrixClient
|
||||
import io.element.android.libraries.matrix.test.room.aRoomSummaryDetail
|
||||
import io.element.android.libraries.matrix.test.room.aRoomSummaryDetails
|
||||
import io.element.android.libraries.matrix.test.roomlist.FakeRoomListService
|
||||
import io.element.android.tests.testutils.WarmUpRule
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
@@ -73,7 +73,7 @@ class RoomSelectPresenterTests {
|
||||
@Test
|
||||
fun `present - update query`() = runTest {
|
||||
val roomListService = FakeRoomListService().apply {
|
||||
postAllRooms(listOf(RoomSummary.Filled(aRoomSummaryDetail())))
|
||||
postAllRooms(listOf(RoomSummary.Filled(aRoomSummaryDetails())))
|
||||
}
|
||||
val client = FakeMatrixClient(roomListService = roomListService)
|
||||
val presenter = aPresenter(client = client)
|
||||
@@ -81,7 +81,7 @@ class RoomSelectPresenterTests {
|
||||
presenter.present()
|
||||
}.test {
|
||||
val initialState = awaitItem()
|
||||
assertThat(awaitItem().resultState as? SearchBarResultState.Results).isEqualTo(SearchBarResultState.Results(listOf(aRoomSummaryDetail())))
|
||||
assertThat(awaitItem().resultState as? SearchBarResultState.Results).isEqualTo(SearchBarResultState.Results(listOf(aRoomSummaryDetails())))
|
||||
|
||||
initialState.eventSink(RoomSelectEvents.UpdateQuery("string not contained"))
|
||||
assertThat(awaitItem().query).isEqualTo("string not contained")
|
||||
@@ -97,7 +97,7 @@ class RoomSelectPresenterTests {
|
||||
}.test {
|
||||
val initialState = awaitItem()
|
||||
skipItems(1)
|
||||
val summary = aRoomSummaryDetail()
|
||||
val summary = aRoomSummaryDetails()
|
||||
|
||||
initialState.eventSink(RoomSelectEvents.SetSelectedRoom(summary))
|
||||
assertThat(awaitItem().selectedRooms).isEqualTo(persistentListOf(summary))
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user