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