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
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import io.element.android.compound.theme.ElementTheme import io.element.android.compound.theme.ElementTheme
import io.element.android.compound.tokens.generated.CompoundIcons 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.RoomListEvents
import io.element.android.features.roomlist.impl.model.RoomListRoomSummary 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.RoomListRoomSummaryProvider
@ -122,6 +123,30 @@ internal fun RoomSummaryRow(
LastMessageAndIndicatorRow(room = room) 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(
inviteSender = roomInfo.inviter?.toInviteSender(), inviteSender = roomInfo.inviter?.toInviteSender(),
isDm = roomInfo.isDm, isDm = roomInfo.isDm,
canonicalAlias = roomInfo.canonicalAlias, canonicalAlias = roomInfo.canonicalAlias,
displayType = if (roomInfo.currentUserMembership == CurrentUserMembership.INVITED) { displayType = when (roomInfo.currentUserMembership) {
RoomSummaryDisplayType.INVITE CurrentUserMembership.INVITED -> {
} else { RoomSummaryDisplayType.INVITE
RoomSummaryDisplayType.ROOM }
CurrentUserMembership.KNOCKED -> {
RoomSummaryDisplayType.KNOCKED
}
else -> {
RoomSummaryDisplayType.ROOM
}
}, },
heroes = roomInfo.heroes.map { user -> heroes = roomInfo.heroes.map { user ->
user.getAvatarData(size = AvatarSize.RoomListItem) 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
displayName = "Bob", displayName = "Bob",
), ),
), ),
aRoomListRoomSummary(
name = "A knocked room",
displayType = RoomSummaryDisplayType.KNOCKED,
)
), ),
).flatten() ).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
enum class RoomSummaryDisplayType { enum class RoomSummaryDisplayType {
PLACEHOLDER, PLACEHOLDER,
ROOM, ROOM,
INVITE INVITE,
KNOCKED,
} }

Loading…
Cancel
Save