feature(security&privacy): check SpaceSettings ff
This commit is contained in:
@@ -72,6 +72,10 @@ class SecurityAndPrivacyPresenter(
|
|||||||
val isKnockEnabled by remember {
|
val isKnockEnabled by remember {
|
||||||
featureFlagService.isFeatureEnabledFlow(FeatureFlags.Knock)
|
featureFlagService.isFeatureEnabledFlow(FeatureFlags.Knock)
|
||||||
}.collectAsState(false)
|
}.collectAsState(false)
|
||||||
|
val isSpaceSettingsEnabled by remember {
|
||||||
|
featureFlagService.isFeatureEnabledFlow(FeatureFlags.SpaceSettings)
|
||||||
|
}.collectAsState(false)
|
||||||
|
|
||||||
val saveAction = remember { mutableStateOf<AsyncAction<Unit>>(AsyncAction.Uninitialized) }
|
val saveAction = remember { mutableStateOf<AsyncAction<Unit>>(AsyncAction.Uninitialized) }
|
||||||
val homeserverName = remember { matrixClient.userIdServerName() }
|
val homeserverName = remember { matrixClient.userIdServerName() }
|
||||||
val roomInfo by room.roomInfoFlow.collectAsState()
|
val roomInfo by room.roomInfoFlow.collectAsState()
|
||||||
@@ -210,6 +214,7 @@ class SecurityAndPrivacyPresenter(
|
|||||||
saveAction = saveAction.value,
|
saveAction = saveAction.value,
|
||||||
permissions = permissions,
|
permissions = permissions,
|
||||||
isSpace = roomInfo.isSpace,
|
isSpace = roomInfo.isSpace,
|
||||||
|
isSpaceSettingsEnabled = isSpaceSettingsEnabled,
|
||||||
selectableJoinedSpaces = selectableJoinedSpaces,
|
selectableJoinedSpaces = selectableJoinedSpaces,
|
||||||
spaceSelection = spaceSelection,
|
spaceSelection = spaceSelection,
|
||||||
eventSink = ::handleEvent,
|
eventSink = ::handleEvent,
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ data class SecurityAndPrivacyState(
|
|||||||
val homeserverName: String,
|
val homeserverName: String,
|
||||||
val showEnableEncryptionConfirmation: Boolean,
|
val showEnableEncryptionConfirmation: Boolean,
|
||||||
val isKnockEnabled: Boolean,
|
val isKnockEnabled: Boolean,
|
||||||
|
val isSpaceSettingsEnabled: Boolean,
|
||||||
val saveAction: AsyncAction<Unit>,
|
val saveAction: AsyncAction<Unit>,
|
||||||
val isSpace: Boolean,
|
val isSpace: Boolean,
|
||||||
private val permissions: SecurityAndPrivacyPermissions,
|
private val permissions: SecurityAndPrivacyPermissions,
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ fun aSecurityAndPrivacyState(
|
|||||||
isSpace: Boolean = false,
|
isSpace: Boolean = false,
|
||||||
selectableJoinedSpaces: Set<SpaceRoom> = emptySet(),
|
selectableJoinedSpaces: Set<SpaceRoom> = emptySet(),
|
||||||
spaceSelection: SpaceSelection = SpaceSelection.None,
|
spaceSelection: SpaceSelection = SpaceSelection.None,
|
||||||
|
isSpaceSettingsEnabled: Boolean = true,
|
||||||
eventSink: (SecurityAndPrivacyEvent) -> Unit = {}
|
eventSink: (SecurityAndPrivacyEvent) -> Unit = {}
|
||||||
) = SecurityAndPrivacyState(
|
) = SecurityAndPrivacyState(
|
||||||
editedSettings = editedSettings,
|
editedSettings = editedSettings,
|
||||||
@@ -135,5 +136,6 @@ fun aSecurityAndPrivacyState(
|
|||||||
isSpace = isSpace,
|
isSpace = isSpace,
|
||||||
selectableJoinedSpaces = selectableJoinedSpaces.toImmutableSet(),
|
selectableJoinedSpaces = selectableJoinedSpaces.toImmutableSet(),
|
||||||
spaceSelection = SpaceSelection.None,
|
spaceSelection = SpaceSelection.None,
|
||||||
|
isSpaceSettingsEnabled = isSpaceSettingsEnabled,
|
||||||
eventSink = eventSink,
|
eventSink = eventSink,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ import io.element.android.libraries.designsystem.text.stringWithLink
|
|||||||
import io.element.android.libraries.designsystem.theme.components.CircularProgressIndicator
|
import io.element.android.libraries.designsystem.theme.components.CircularProgressIndicator
|
||||||
import io.element.android.libraries.designsystem.theme.components.IconSource
|
import io.element.android.libraries.designsystem.theme.components.IconSource
|
||||||
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.Scaffold
|
import io.element.android.libraries.designsystem.theme.components.Scaffold
|
||||||
import io.element.android.libraries.designsystem.theme.components.Text
|
import io.element.android.libraries.designsystem.theme.components.Text
|
||||||
import io.element.android.libraries.designsystem.theme.components.TextButton
|
import io.element.android.libraries.designsystem.theme.components.TextButton
|
||||||
@@ -95,6 +94,7 @@ fun SecurityAndPrivacyView(
|
|||||||
edited = state.editedSettings.roomAccess,
|
edited = state.editedSettings.roomAccess,
|
||||||
saved = state.savedSettings.roomAccess,
|
saved = state.savedSettings.roomAccess,
|
||||||
isKnockEnabled = state.isKnockEnabled,
|
isKnockEnabled = state.isKnockEnabled,
|
||||||
|
isSpaceSettingsEnabled = state.isSpaceSettingsEnabled,
|
||||||
onSelectOption = { state.eventSink(SecurityAndPrivacyEvent.ChangeRoomAccess(it)) },
|
onSelectOption = { state.eventSink(SecurityAndPrivacyEvent.ChangeRoomAccess(it)) },
|
||||||
onManageSpacesClick = { state.eventSink(SecurityAndPrivacyEvent.ManageAuthorizedSpaces) },
|
onManageSpacesClick = { state.eventSink(SecurityAndPrivacyEvent.ManageAuthorizedSpaces) },
|
||||||
onSpaceMemberAccessClick = { state.eventSink(SecurityAndPrivacyEvent.SelectSpaceMemberAccess) }
|
onSpaceMemberAccessClick = { state.eventSink(SecurityAndPrivacyEvent.SelectSpaceMemberAccess) }
|
||||||
@@ -214,6 +214,7 @@ private fun RoomAccessSection(
|
|||||||
edited: SecurityAndPrivacyRoomAccess,
|
edited: SecurityAndPrivacyRoomAccess,
|
||||||
saved: SecurityAndPrivacyRoomAccess,
|
saved: SecurityAndPrivacyRoomAccess,
|
||||||
isKnockEnabled: Boolean,
|
isKnockEnabled: Boolean,
|
||||||
|
isSpaceSettingsEnabled: Boolean,
|
||||||
onSelectOption: (SecurityAndPrivacyRoomAccess) -> Unit,
|
onSelectOption: (SecurityAndPrivacyRoomAccess) -> Unit,
|
||||||
onSpaceMemberAccessClick: () -> Unit,
|
onSpaceMemberAccessClick: () -> Unit,
|
||||||
onManageSpacesClick: () -> Unit,
|
onManageSpacesClick: () -> Unit,
|
||||||
@@ -230,7 +231,10 @@ private fun RoomAccessSection(
|
|||||||
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Public())),
|
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Public())),
|
||||||
onClick = { onSelectOption(SecurityAndPrivacyRoomAccess.Anyone) },
|
onClick = { onSelectOption(SecurityAndPrivacyRoomAccess.Anyone) },
|
||||||
)
|
)
|
||||||
// Show space member option, but disabled as we don't support this option for now.
|
// Show SpaceMember option in two cases:
|
||||||
|
// - the SpaceSettings FF is enabled
|
||||||
|
// - SpaceMember is the current saved value
|
||||||
|
if (saved is SecurityAndPrivacyRoomAccess.SpaceMember || isSpaceSettingsEnabled)
|
||||||
ListItem(
|
ListItem(
|
||||||
headlineContent = { Text(text = stringResource(R.string.screen_security_and_privacy_room_access_space_members_option_title)) },
|
headlineContent = { Text(text = stringResource(R.string.screen_security_and_privacy_room_access_space_members_option_title)) },
|
||||||
supportingContent = {
|
supportingContent = {
|
||||||
@@ -239,6 +243,7 @@ private fun RoomAccessSection(
|
|||||||
trailingContent = ListItemContent.RadioButton(selected = edited is SecurityAndPrivacyRoomAccess.SpaceMember),
|
trailingContent = ListItemContent.RadioButton(selected = edited is SecurityAndPrivacyRoomAccess.SpaceMember),
|
||||||
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Space())),
|
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Space())),
|
||||||
onClick = onSpaceMemberAccessClick,
|
onClick = onSpaceMemberAccessClick,
|
||||||
|
enabled = isSpaceSettingsEnabled,
|
||||||
)
|
)
|
||||||
// Show Ask to join option in two cases:
|
// Show Ask to join option in two cases:
|
||||||
// - the Knock FF is enabled
|
// - the Knock FF is enabled
|
||||||
@@ -264,7 +269,7 @@ private fun RoomAccessSection(
|
|||||||
val footerText = stringWithLink(
|
val footerText = stringWithLink(
|
||||||
textRes = R.string.screen_security_and_privacy_room_access_footer,
|
textRes = R.string.screen_security_and_privacy_room_access_footer,
|
||||||
url = stringResource(R.string.screen_security_and_privacy_room_access_footer_manage_spaces_action),
|
url = stringResource(R.string.screen_security_and_privacy_room_access_footer_manage_spaces_action),
|
||||||
onLinkClick = { onManageSpacesClick()},
|
onLinkClick = { onManageSpacesClick() },
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = footerText,
|
text = footerText,
|
||||||
|
|||||||
Reference in New Issue
Block a user