change (preferences) : some more final tweaks after review.
This commit is contained in:
parent
034b68c930
commit
4982d933d8
5 changed files with 36 additions and 18 deletions
|
|
@ -96,7 +96,9 @@ class JoinRoomPresenter @AssistedInject constructor(
|
||||||
val forgetRoomAction: MutableState<AsyncAction<Unit>> = remember { mutableStateOf(AsyncAction.Uninitialized) }
|
val forgetRoomAction: MutableState<AsyncAction<Unit>> = remember { mutableStateOf(AsyncAction.Uninitialized) }
|
||||||
var knockMessage by rememberSaveable { mutableStateOf("") }
|
var knockMessage by rememberSaveable { mutableStateOf("") }
|
||||||
var isDismissingContent by remember { mutableStateOf(false) }
|
var isDismissingContent by remember { mutableStateOf(false) }
|
||||||
val shouldHideAvatars by appPreferencesStore.getHideInviteAvatarsFlow().collectAsState(initial = false)
|
val hideInviteAvatars by remember {
|
||||||
|
appPreferencesStore.getHideInviteAvatarsFlow()
|
||||||
|
}.collectAsState(initial = false)
|
||||||
val contentState by produceState<ContentState>(
|
val contentState by produceState<ContentState>(
|
||||||
initialValue = ContentState.Loading,
|
initialValue = ContentState.Loading,
|
||||||
key1 = roomInfo,
|
key1 = roomInfo,
|
||||||
|
|
@ -205,7 +207,7 @@ class JoinRoomPresenter @AssistedInject constructor(
|
||||||
cancelKnockAction = cancelKnockAction.value,
|
cancelKnockAction = cancelKnockAction.value,
|
||||||
applicationName = buildMeta.applicationName,
|
applicationName = buildMeta.applicationName,
|
||||||
knockMessage = knockMessage,
|
knockMessage = knockMessage,
|
||||||
shouldHideAvatars = shouldHideAvatars,
|
hideInviteAvatars = hideInviteAvatars,
|
||||||
eventSink = ::handleEvents
|
eventSink = ::handleEvents
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ data class JoinRoomState(
|
||||||
val cancelKnockAction: AsyncAction<Unit>,
|
val cancelKnockAction: AsyncAction<Unit>,
|
||||||
private val applicationName: String,
|
private val applicationName: String,
|
||||||
val knockMessage: String,
|
val knockMessage: String,
|
||||||
val shouldHideAvatars: Boolean,
|
val hideInviteAvatars: Boolean,
|
||||||
val eventSink: (JoinRoomEvents) -> Unit
|
val eventSink: (JoinRoomEvents) -> Unit
|
||||||
) {
|
) {
|
||||||
val isJoinActionUnauthorized = joinAction is AsyncAction.Failure && joinAction.error is JoinRoomFailures.UnauthorizedJoin
|
val isJoinActionUnauthorized = joinAction is AsyncAction.Failure && joinAction.error is JoinRoomFailures.UnauthorizedJoin
|
||||||
|
|
@ -58,6 +58,8 @@ data class JoinRoomState(
|
||||||
}
|
}
|
||||||
else -> JoinAuthorisationStatus.None
|
else -> JoinAuthorisationStatus.None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val hideAvatarsImages = hideInviteAvatars && joinAuthorisationStatus is JoinAuthorisationStatus.IsInvited
|
||||||
}
|
}
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ fun aJoinRoomState(
|
||||||
forgetAction: AsyncAction<Unit> = AsyncAction.Uninitialized,
|
forgetAction: AsyncAction<Unit> = AsyncAction.Uninitialized,
|
||||||
cancelKnockAction: AsyncAction<Unit> = AsyncAction.Uninitialized,
|
cancelKnockAction: AsyncAction<Unit> = AsyncAction.Uninitialized,
|
||||||
knockMessage: String = "",
|
knockMessage: String = "",
|
||||||
shouldHideAvatars: Boolean = false,
|
hideInviteAvatars: Boolean = false,
|
||||||
eventSink: (JoinRoomEvents) -> Unit = {}
|
eventSink: (JoinRoomEvents) -> Unit = {}
|
||||||
) = JoinRoomState(
|
) = JoinRoomState(
|
||||||
roomIdOrAlias = roomIdOrAlias,
|
roomIdOrAlias = roomIdOrAlias,
|
||||||
|
|
@ -183,7 +183,7 @@ fun aJoinRoomState(
|
||||||
forgetAction = forgetAction,
|
forgetAction = forgetAction,
|
||||||
applicationName = "AppName",
|
applicationName = "AppName",
|
||||||
knockMessage = knockMessage,
|
knockMessage = knockMessage,
|
||||||
shouldHideAvatars = shouldHideAvatars,
|
hideInviteAvatars = hideInviteAvatars,
|
||||||
eventSink = eventSink
|
eventSink = eventSink
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ fun JoinRoomView(
|
||||||
roomIdOrAlias = state.roomIdOrAlias,
|
roomIdOrAlias = state.roomIdOrAlias,
|
||||||
contentState = state.contentState,
|
contentState = state.contentState,
|
||||||
knockMessage = state.knockMessage,
|
knockMessage = state.knockMessage,
|
||||||
shouldHideAvatars = state.shouldHideAvatars,
|
hideAvatarsImages = state.hideAvatarsImages,
|
||||||
onKnockMessageUpdate = { state.eventSink(JoinRoomEvents.UpdateKnockMessage(it)) },
|
onKnockMessageUpdate = { state.eventSink(JoinRoomEvents.UpdateKnockMessage(it)) },
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
@ -372,7 +372,7 @@ private fun JoinRoomContent(
|
||||||
roomIdOrAlias: RoomIdOrAlias,
|
roomIdOrAlias: RoomIdOrAlias,
|
||||||
contentState: ContentState,
|
contentState: ContentState,
|
||||||
knockMessage: String,
|
knockMessage: String,
|
||||||
shouldHideAvatars: Boolean,
|
hideAvatarsImages: Boolean,
|
||||||
onKnockMessageUpdate: (String) -> Unit,
|
onKnockMessageUpdate: (String) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
|
|
@ -387,14 +387,14 @@ private fun JoinRoomContent(
|
||||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||||
val inviteSender = (contentState.joinAuthorisationStatus as? JoinAuthorisationStatus.IsInvited)?.inviteSender
|
val inviteSender = (contentState.joinAuthorisationStatus as? JoinAuthorisationStatus.IsInvited)?.inviteSender
|
||||||
if (inviteSender != null) {
|
if (inviteSender != null) {
|
||||||
InviteSenderView(inviteSender = inviteSender, hideAvatarImage = shouldHideAvatars)
|
InviteSenderView(inviteSender = inviteSender, hideAvatarImage = hideAvatarsImages)
|
||||||
Spacer(modifier = Modifier.height(32.dp))
|
Spacer(modifier = Modifier.height(32.dp))
|
||||||
}
|
}
|
||||||
DefaultLoadedContent(
|
DefaultLoadedContent(
|
||||||
modifier = Modifier.verticalScroll(rememberScrollState()),
|
modifier = Modifier.verticalScroll(rememberScrollState()),
|
||||||
contentState = contentState,
|
contentState = contentState,
|
||||||
knockMessage = knockMessage,
|
knockMessage = knockMessage,
|
||||||
shouldHideAvatars = shouldHideAvatars,
|
hideAvatarImage = hideAvatarsImages,
|
||||||
onKnockMessageUpdate = onKnockMessageUpdate
|
onKnockMessageUpdate = onKnockMessageUpdate
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -477,14 +477,14 @@ private fun IsKnockedLoadedContent(modifier: Modifier = Modifier) {
|
||||||
private fun DefaultLoadedContent(
|
private fun DefaultLoadedContent(
|
||||||
contentState: ContentState.Loaded,
|
contentState: ContentState.Loaded,
|
||||||
knockMessage: String,
|
knockMessage: String,
|
||||||
shouldHideAvatars: Boolean,
|
hideAvatarImage: Boolean,
|
||||||
onKnockMessageUpdate: (String) -> Unit,
|
onKnockMessageUpdate: (String) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
RoomPreviewOrganism(
|
RoomPreviewOrganism(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
avatar = {
|
avatar = {
|
||||||
Avatar(contentState.avatarData(AvatarSize.RoomHeader), hideImage = shouldHideAvatars)
|
Avatar(contentState.avatarData(AvatarSize.RoomHeader), hideImage = hideAvatarImage)
|
||||||
},
|
},
|
||||||
title = {
|
title = {
|
||||||
if (contentState.name != null) {
|
if (contentState.name != null) {
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,16 @@ import im.vector.app.features.analytics.plan.Interaction
|
||||||
import io.element.android.compound.theme.Theme
|
import io.element.android.compound.theme.Theme
|
||||||
import io.element.android.compound.theme.themes
|
import io.element.android.compound.theme.themes
|
||||||
import io.element.android.features.preferences.impl.R
|
import io.element.android.features.preferences.impl.R
|
||||||
|
import io.element.android.libraries.architecture.coverage.ExcludeFromCoverage
|
||||||
import io.element.android.libraries.designsystem.components.dialogs.ListOption
|
import io.element.android.libraries.designsystem.components.dialogs.ListOption
|
||||||
import io.element.android.libraries.designsystem.components.dialogs.SingleSelectionDialog
|
import io.element.android.libraries.designsystem.components.dialogs.SingleSelectionDialog
|
||||||
import io.element.android.libraries.designsystem.components.list.ListItemContent
|
import io.element.android.libraries.designsystem.components.list.ListItemContent
|
||||||
import io.element.android.libraries.designsystem.components.preferences.PreferenceCategory
|
import io.element.android.libraries.designsystem.components.preferences.PreferenceCategory
|
||||||
import io.element.android.libraries.designsystem.components.preferences.PreferencePage
|
import io.element.android.libraries.designsystem.components.preferences.PreferencePage
|
||||||
import io.element.android.libraries.designsystem.components.preferences.PreferenceSwitch
|
import io.element.android.libraries.designsystem.components.preferences.PreferenceSwitch
|
||||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
||||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
import io.element.android.libraries.designsystem.preview.ElementPreviewLight
|
||||||
|
import io.element.android.libraries.designsystem.preview.PreviewWithLargeHeight
|
||||||
import io.element.android.libraries.designsystem.theme.components.ListItem
|
import io.element.android.libraries.designsystem.theme.components.ListItem
|
||||||
import io.element.android.libraries.designsystem.theme.components.ListSectionHeader
|
import io.element.android.libraries.designsystem.theme.components.ListSectionHeader
|
||||||
import io.element.android.libraries.designsystem.theme.components.ListSupportingText
|
import io.element.android.libraries.designsystem.theme.components.ListSupportingText
|
||||||
|
|
@ -192,9 +194,21 @@ private fun Theme.toHumanReadable(): String {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreviewsDayNight
|
@PreviewWithLargeHeight
|
||||||
@Composable
|
@Composable
|
||||||
internal fun AdvancedSettingsViewPreview(@PreviewParameter(AdvancedSettingsStateProvider::class) state: AdvancedSettingsState) =
|
internal fun AdvancedSettingsViewLightPreview(@PreviewParameter(AdvancedSettingsStateProvider::class) state: AdvancedSettingsState) =
|
||||||
ElementPreview {
|
ElementPreviewLight { ContentToPreview(state) }
|
||||||
AdvancedSettingsView(state = state, onBackClick = { })
|
|
||||||
|
@PreviewWithLargeHeight
|
||||||
|
@Composable
|
||||||
|
internal fun AdvancedSettingsViewDarkPreview(@PreviewParameter(AdvancedSettingsStateProvider::class) state: AdvancedSettingsState) =
|
||||||
|
ElementPreviewDark { ContentToPreview(state) }
|
||||||
|
|
||||||
|
@ExcludeFromCoverage
|
||||||
|
@Composable
|
||||||
|
private fun ContentToPreview(state: AdvancedSettingsState) {
|
||||||
|
AdvancedSettingsView(
|
||||||
|
state = state,
|
||||||
|
onBackClick = { }
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue