Browse Source

knock : display knocked room in the room list

pull/3725/head
ganfra 2 weeks ago
parent
commit
b0503978a1
  1. 25
      features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomSummaryRow.kt
  2. 14
      features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/datasource/RoomListRoomSummaryFactory.kt
  3. 4
      features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryProvider.kt
  4. 3
      features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomSummaryDisplayType.kt

25
features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomSummaryRow.kt

@ -38,6 +38,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter @@ -38,6 +38,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
import io.element.android.compound.theme.ElementTheme
import io.element.android.compound.tokens.generated.CompoundIcons
import io.element.android.features.roomlist.impl.R
import io.element.android.features.roomlist.impl.RoomListEvents
import io.element.android.features.roomlist.impl.model.RoomListRoomSummary
import io.element.android.features.roomlist.impl.model.RoomListRoomSummaryProvider
@ -122,6 +123,30 @@ internal fun RoomSummaryRow( @@ -122,6 +123,30 @@ internal fun RoomSummaryRow(
LastMessageAndIndicatorRow(room = room)
}
}
RoomSummaryDisplayType.KNOCKED -> {
RoomSummaryScaffoldRow(
room = room,
onClick = onClick,
onLongClick = {
Timber.d("Long click on knocked room")
},
modifier = modifier
) {
NameAndTimestampRow(
name = room.name,
timestamp = room.timestamp,
isHighlighted = room.isHighlighted
)
Text(
text = stringResource(id = R.string.screen_join_room_knock_sent_title),
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style = ElementTheme.typography.fontBodyMdRegular,
color = ElementTheme.colors.textSecondary,
modifier = modifier,
)
}
}
}
}

14
features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/datasource/RoomListRoomSummaryFactory.kt

@ -48,10 +48,16 @@ class RoomListRoomSummaryFactory @Inject constructor( @@ -48,10 +48,16 @@ class RoomListRoomSummaryFactory @Inject constructor(
inviteSender = roomInfo.inviter?.toInviteSender(),
isDm = roomInfo.isDm,
canonicalAlias = roomInfo.canonicalAlias,
displayType = if (roomInfo.currentUserMembership == CurrentUserMembership.INVITED) {
RoomSummaryDisplayType.INVITE
} else {
RoomSummaryDisplayType.ROOM
displayType = when (roomInfo.currentUserMembership) {
CurrentUserMembership.INVITED -> {
RoomSummaryDisplayType.INVITE
}
CurrentUserMembership.KNOCKED -> {
RoomSummaryDisplayType.KNOCKED
}
else -> {
RoomSummaryDisplayType.ROOM
}
},
heroes = roomInfo.heroes.map { user ->
user.getAvatarData(size = AvatarSize.RoomListItem)

4
features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryProvider.kt

@ -102,6 +102,10 @@ open class RoomListRoomSummaryProvider : PreviewParameterProvider<RoomListRoomSu @@ -102,6 +102,10 @@ open class RoomListRoomSummaryProvider : PreviewParameterProvider<RoomListRoomSu
displayName = "Bob",
),
),
aRoomListRoomSummary(
name = "A knocked room",
displayType = RoomSummaryDisplayType.KNOCKED,
)
),
).flatten()
}

3
features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomSummaryDisplayType.kt

@ -13,5 +13,6 @@ package io.element.android.features.roomlist.impl.model @@ -13,5 +13,6 @@ package io.element.android.features.roomlist.impl.model
enum class RoomSummaryDisplayType {
PLACEHOLDER,
ROOM,
INVITE
INVITE,
KNOCKED,
}

Loading…
Cancel
Save