mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
change (preferences) : hide invite avatars (room and sender)
This commit is contained in:
+4
@@ -117,6 +117,9 @@ class RoomListPresenter @Inject constructor(
|
||||
|
||||
// Avatar indicator
|
||||
val showAvatarIndicator by indicatorService.showRoomListTopBarIndicator()
|
||||
val hideInvitesAvatar by remember {
|
||||
appPreferencesStore.getHideInviteAvatarsFlow()
|
||||
}.collectAsState(initial = false)
|
||||
|
||||
val contextMenu = remember { mutableStateOf<RoomListState.ContextMenu>(RoomListState.ContextMenu.Hidden) }
|
||||
|
||||
@@ -171,6 +174,7 @@ class RoomListPresenter @Inject constructor(
|
||||
contentState = contentState,
|
||||
acceptDeclineInviteState = acceptDeclineInviteState,
|
||||
directLogoutState = directLogoutState,
|
||||
hideInvitesAvatars = hideInvitesAvatar,
|
||||
eventSink = ::handleEvents,
|
||||
)
|
||||
}
|
||||
|
||||
+1
@@ -34,6 +34,7 @@ data class RoomListState(
|
||||
val contentState: RoomListContentState,
|
||||
val acceptDeclineInviteState: AcceptDeclineInviteState,
|
||||
val directLogoutState: DirectLogoutState,
|
||||
val hideInvitesAvatars: Boolean,
|
||||
val eventSink: (RoomListEvents) -> Unit,
|
||||
) {
|
||||
val displayFilters = contentState is RoomListContentState.Rooms
|
||||
|
||||
+2
@@ -61,6 +61,7 @@ internal fun aRoomListState(
|
||||
contentState: RoomListContentState = aRoomsContentState(),
|
||||
acceptDeclineInviteState: AcceptDeclineInviteState = anAcceptDeclineInviteState(),
|
||||
directLogoutState: DirectLogoutState = aDirectLogoutState(),
|
||||
hideInvitesAvatars: Boolean = false,
|
||||
eventSink: (RoomListEvents) -> Unit = {}
|
||||
) = RoomListState(
|
||||
matrixUser = matrixUser,
|
||||
@@ -75,6 +76,7 @@ internal fun aRoomListState(
|
||||
contentState = contentState,
|
||||
acceptDeclineInviteState = acceptDeclineInviteState,
|
||||
directLogoutState = directLogoutState,
|
||||
hideInvitesAvatars = hideInvitesAvatars,
|
||||
eventSink = eventSink,
|
||||
)
|
||||
|
||||
|
||||
+2
@@ -81,6 +81,7 @@ fun RoomListView(
|
||||
RoomListSearchView(
|
||||
state = state.searchState,
|
||||
eventSink = state.eventSink,
|
||||
hideInvitesAvatars = state.hideInvitesAvatars,
|
||||
onRoomClick = onRoomClick,
|
||||
modifier = Modifier
|
||||
.statusBarsPadding()
|
||||
@@ -134,6 +135,7 @@ private fun RoomListScaffold(
|
||||
RoomListContentView(
|
||||
contentState = state.contentState,
|
||||
filtersState = state.filtersState,
|
||||
hideInvitesAvatars = state.hideInvitesAvatars,
|
||||
eventSink = state.eventSink,
|
||||
onSetUpRecoveryClick = onSetUpRecoveryClick,
|
||||
onConfirmRecoveryKeyClick = onConfirmRecoveryKeyClick,
|
||||
|
||||
+7
@@ -59,6 +59,7 @@ import kotlinx.collections.immutable.ImmutableList
|
||||
fun RoomListContentView(
|
||||
contentState: RoomListContentState,
|
||||
filtersState: RoomListFiltersState,
|
||||
hideInvitesAvatars: Boolean,
|
||||
eventSink: (RoomListEvents) -> Unit,
|
||||
onSetUpRecoveryClick: () -> Unit,
|
||||
onConfirmRecoveryKeyClick: () -> Unit,
|
||||
@@ -85,6 +86,7 @@ fun RoomListContentView(
|
||||
is RoomListContentState.Rooms -> {
|
||||
RoomsView(
|
||||
state = contentState,
|
||||
hideInvitesAvatars = hideInvitesAvatars,
|
||||
filtersState = filtersState,
|
||||
eventSink = eventSink,
|
||||
onSetUpRecoveryClick = onSetUpRecoveryClick,
|
||||
@@ -155,6 +157,7 @@ private fun EmptyView(
|
||||
@Composable
|
||||
private fun RoomsView(
|
||||
state: RoomListContentState.Rooms,
|
||||
hideInvitesAvatars: Boolean,
|
||||
filtersState: RoomListFiltersState,
|
||||
eventSink: (RoomListEvents) -> Unit,
|
||||
onSetUpRecoveryClick: () -> Unit,
|
||||
@@ -170,6 +173,7 @@ private fun RoomsView(
|
||||
} else {
|
||||
RoomsViewList(
|
||||
state = state,
|
||||
hideInvitesAvatars = hideInvitesAvatars,
|
||||
eventSink = eventSink,
|
||||
onSetUpRecoveryClick = onSetUpRecoveryClick,
|
||||
onConfirmRecoveryKeyClick = onConfirmRecoveryKeyClick,
|
||||
@@ -182,6 +186,7 @@ private fun RoomsView(
|
||||
@Composable
|
||||
private fun RoomsViewList(
|
||||
state: RoomListContentState.Rooms,
|
||||
hideInvitesAvatars: Boolean,
|
||||
eventSink: (RoomListEvents) -> Unit,
|
||||
onSetUpRecoveryClick: () -> Unit,
|
||||
onConfirmRecoveryKeyClick: () -> Unit,
|
||||
@@ -239,6 +244,7 @@ private fun RoomsViewList(
|
||||
) { index, room ->
|
||||
RoomSummaryRow(
|
||||
room = room,
|
||||
hideInviteAvatars = hideInvitesAvatars,
|
||||
onClick = onRoomClick,
|
||||
eventSink = eventSink,
|
||||
)
|
||||
@@ -300,6 +306,7 @@ internal fun RoomListContentViewPreview(@PreviewParameter(RoomListContentStatePr
|
||||
filtersState = aRoomListFiltersState(
|
||||
filterSelectionStates = RoomListFilter.entries.map { FilterSelectionState(it, isSelected = true) }
|
||||
),
|
||||
hideInvitesAvatars = false,
|
||||
eventSink = {},
|
||||
onSetUpRecoveryClick = {},
|
||||
onConfirmRecoveryKeyClick = {},
|
||||
|
||||
+7
@@ -68,10 +68,12 @@ internal val minHeight = 84.dp
|
||||
@Composable
|
||||
internal fun RoomSummaryRow(
|
||||
room: RoomListRoomSummary,
|
||||
hideInviteAvatars: Boolean,
|
||||
onClick: (RoomListRoomSummary) -> Unit,
|
||||
eventSink: (RoomListEvents) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
|
||||
Box(modifier = modifier) {
|
||||
when (room.displayType) {
|
||||
RoomSummaryDisplayType.PLACEHOLDER -> {
|
||||
@@ -80,6 +82,7 @@ internal fun RoomSummaryRow(
|
||||
RoomSummaryDisplayType.INVITE -> {
|
||||
RoomSummaryScaffoldRow(
|
||||
room = room,
|
||||
hideAvatarImage = hideInviteAvatars,
|
||||
onClick = onClick,
|
||||
onLongClick = {
|
||||
Timber.d("Long click on invite room")
|
||||
@@ -92,6 +95,7 @@ internal fun RoomSummaryRow(
|
||||
InviteSenderView(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
inviteSender = room.inviteSender,
|
||||
hideAvatarImage = hideInviteAvatars
|
||||
)
|
||||
}
|
||||
Spacer(modifier = Modifier.height(12.dp))
|
||||
@@ -164,6 +168,7 @@ private fun RoomSummaryScaffoldRow(
|
||||
onClick: (RoomListRoomSummary) -> Unit,
|
||||
onLongClick: (RoomListRoomSummary) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
hideAvatarImage: Boolean = false,
|
||||
content: @Composable ColumnScope.() -> Unit
|
||||
) {
|
||||
val clickModifier = Modifier.combinedClickable(
|
||||
@@ -184,6 +189,7 @@ private fun RoomSummaryScaffoldRow(
|
||||
CompositeAvatar(
|
||||
avatarData = room.avatarData,
|
||||
heroes = room.heroes,
|
||||
hideAvatarImages = hideAvatarImage,
|
||||
)
|
||||
Spacer(modifier = Modifier.width(16.dp))
|
||||
Column(
|
||||
@@ -384,6 +390,7 @@ private fun MentionIndicatorAtom() {
|
||||
internal fun RoomSummaryRowPreview(@PreviewParameter(RoomListRoomSummaryProvider::class) data: RoomListRoomSummary) = ElementPreview {
|
||||
RoomSummaryRow(
|
||||
room = data,
|
||||
hideInviteAvatars = false,
|
||||
onClick = {},
|
||||
eventSink = {},
|
||||
)
|
||||
|
||||
+5
@@ -54,6 +54,7 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||
@Composable
|
||||
internal fun RoomListSearchView(
|
||||
state: RoomListSearchState,
|
||||
hideInvitesAvatars: Boolean,
|
||||
eventSink: (RoomListEvents) -> Unit,
|
||||
onRoomClick: (RoomId) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
@@ -80,6 +81,7 @@ internal fun RoomListSearchView(
|
||||
if (state.isSearchActive) {
|
||||
RoomListSearchContent(
|
||||
state = state,
|
||||
hideInvitesAvatars = hideInvitesAvatars,
|
||||
onRoomClick = onRoomClick,
|
||||
eventSink = eventSink,
|
||||
)
|
||||
@@ -92,6 +94,7 @@ internal fun RoomListSearchView(
|
||||
@Composable
|
||||
private fun RoomListSearchContent(
|
||||
state: RoomListSearchState,
|
||||
hideInvitesAvatars: Boolean,
|
||||
eventSink: (RoomListEvents) -> Unit,
|
||||
onRoomClick: (RoomId) -> Unit,
|
||||
) {
|
||||
@@ -173,6 +176,7 @@ private fun RoomListSearchContent(
|
||||
) { room ->
|
||||
RoomSummaryRow(
|
||||
room = room,
|
||||
hideInviteAvatars = hideInvitesAvatars,
|
||||
onClick = ::onRoomClick,
|
||||
eventSink = eventSink,
|
||||
)
|
||||
@@ -187,6 +191,7 @@ private fun RoomListSearchContent(
|
||||
internal fun RoomListSearchContentPreview(@PreviewParameter(RoomListSearchStateProvider::class) state: RoomListSearchState) = ElementPreview {
|
||||
RoomListSearchContent(
|
||||
state = state,
|
||||
hideInvitesAvatars = false,
|
||||
onRoomClick = {},
|
||||
eventSink = {},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user