Skip to content

Commit

Permalink
create room : clean up after review.
Browse files Browse the repository at this point in the history
  • Loading branch information
ganfra committed Nov 6, 2024
1 parent 6f1de0c commit 24d4270
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 213 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class CreateRoomDataStore @Inject constructor(
field = value
}

val createRoomConfig: Flow<CreateRoomConfig> = combine(
val createRoomConfigWithInvites: Flow<CreateRoomConfig> = combine(
selectedUserListDataStore.selectedUsers(),
createRoomConfigFlow,
) { selectedUsers, config ->
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ConfigureRoomPresenter @Inject constructor(
@Composable
override fun present(): ConfigureRoomState {
val cameraPermissionState = cameraPermissionPresenter.present()
val createRoomConfig = dataStore.createRoomConfig.collectAsState(CreateRoomConfig())
val createRoomConfig = dataStore.createRoomConfigWithInvites.collectAsState(CreateRoomConfig())
val homeserverName = remember { matrixClient.userIdServerName() }
val isKnockFeatureEnabled by featureFlagService.isFeatureEnabledFlow(FeatureFlags.Knock).collectAsState(initial = false)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,18 @@ import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
import io.element.android.compound.theme.ElementTheme
import io.element.android.features.createroom.impl.R
import io.element.android.features.createroom.impl.components.RoomAccessOption
import io.element.android.features.createroom.impl.components.RoomVisibilityOption
import io.element.android.libraries.designsystem.atomic.atoms.RoundedIconAtom
import io.element.android.libraries.designsystem.atomic.atoms.RoundedIconAtomSize
import io.element.android.libraries.designsystem.components.LabelledTextField
import io.element.android.libraries.designsystem.components.async.AsyncActionView
import io.element.android.libraries.designsystem.components.async.AsyncActionViewDefaults
import io.element.android.libraries.designsystem.components.button.BackButton
import io.element.android.libraries.designsystem.components.list.ListItemContent
import io.element.android.libraries.designsystem.modifiers.clearFocusOnTap
import io.element.android.libraries.designsystem.preview.ElementPreview
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
import io.element.android.libraries.designsystem.theme.aliasScreenTitle
import io.element.android.libraries.designsystem.theme.components.ListItem
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
Expand Down Expand Up @@ -247,20 +249,17 @@ private fun RoomTopic(
@Composable
private fun ConfigureRoomOptions(
title: String,
verticalArrangement: Arrangement.Vertical,
modifier: Modifier = Modifier,
content: @Composable ColumnScope.() -> Unit,
) {
Column(
modifier = modifier
.selectableGroup()
.padding(horizontal = 12.dp),
verticalArrangement = verticalArrangement,
modifier = modifier.selectableGroup()
) {
Text(
text = title,
style = ElementTheme.typography.fontBodyLgMedium,
color = ElementTheme.colors.textPrimary,
modifier = Modifier.padding(horizontal = 16.dp),
)
content()
}
Expand All @@ -275,13 +274,21 @@ private fun RoomVisibilityOptions(
ConfigureRoomOptions(
title = stringResource(R.string.screen_create_room_room_visibility_section_title),
modifier = modifier,
verticalArrangement = Arrangement.spacedBy(16.dp),
) {
RoomVisibilityItem.entries.forEach { item ->
RoomVisibilityOption(
roomPrivacyItem = item,
isSelected = item == selected,
onOptionClick = onOptionClick,
val isSelected = item == selected
ListItem(
leadingContent = ListItemContent.Custom {
RoundedIconAtom(
size = RoundedIconAtomSize.Big,
resourceId = item.icon,
tint = if (isSelected) ElementTheme.colors.iconPrimary else ElementTheme.colors.iconSecondary,
)
},
headlineContent = { Text(text = stringResource(item.title)) },
supportingContent = { Text(text = stringResource(item.description)) },
trailingContent = ListItemContent.RadioButton(selected = isSelected),
onClick = { onOptionClick(item) },
)
}
}
Expand All @@ -296,13 +303,13 @@ private fun RoomAccessOptions(
ConfigureRoomOptions(
title = stringResource(R.string.screen_create_room_room_access_section_header),
modifier = modifier,
verticalArrangement = Arrangement.spacedBy(12.dp),
) {
RoomAccessItem.entries.forEach { item ->
RoomAccessOption(
roomAccessItem = item,
isSelected = item == selected,
onOptionClick = onOptionClick,
ListItem(
headlineContent = { Text(text = stringResource(item.title)) },
supportingContent = { Text(text = stringResource(item.description)) },
trailingContent = ListItemContent.RadioButton(selected = item == selected),
onClick = { onOptionClick(item) },
)
}
}
Expand Down

0 comments on commit 24d4270

Please sign in to comment.