create room : use user homeserver in the address field.
This commit is contained in:
parent
4582acd536
commit
c968bc6200
4 changed files with 7 additions and 1 deletions
|
|
@ -55,6 +55,7 @@ class ConfigureRoomPresenter @Inject constructor(
|
||||||
override fun present(): ConfigureRoomState {
|
override fun present(): ConfigureRoomState {
|
||||||
val cameraPermissionState = cameraPermissionPresenter.present()
|
val cameraPermissionState = cameraPermissionPresenter.present()
|
||||||
val createRoomConfig = dataStore.createRoomConfig.collectAsState(CreateRoomConfig())
|
val createRoomConfig = dataStore.createRoomConfig.collectAsState(CreateRoomConfig())
|
||||||
|
val homeserverName = remember { matrixClient.userIdServerName() }
|
||||||
|
|
||||||
val cameraPhotoPicker = mediaPickerProvider.registerCameraPhotoPicker(
|
val cameraPhotoPicker = mediaPickerProvider.registerCameraPhotoPicker(
|
||||||
onResult = { uri -> if (uri != null) dataStore.setAvatarUri(uri = uri, cached = true) },
|
onResult = { uri -> if (uri != null) dataStore.setAvatarUri(uri = uri, cached = true) },
|
||||||
|
|
@ -120,6 +121,7 @@ class ConfigureRoomPresenter @Inject constructor(
|
||||||
avatarActions = avatarActions,
|
avatarActions = avatarActions,
|
||||||
createRoomAction = createRoomAction.value,
|
createRoomAction = createRoomAction.value,
|
||||||
cameraPermissionState = cameraPermissionState,
|
cameraPermissionState = cameraPermissionState,
|
||||||
|
homeserverName = homeserverName,
|
||||||
eventSink = ::handleEvents,
|
eventSink = ::handleEvents,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ data class ConfigureRoomState(
|
||||||
val avatarActions: ImmutableList<AvatarAction>,
|
val avatarActions: ImmutableList<AvatarAction>,
|
||||||
val createRoomAction: AsyncAction<RoomId>,
|
val createRoomAction: AsyncAction<RoomId>,
|
||||||
val cameraPermissionState: PermissionsState,
|
val cameraPermissionState: PermissionsState,
|
||||||
|
val homeserverName: String,
|
||||||
val eventSink: (ConfigureRoomEvents) -> Unit
|
val eventSink: (ConfigureRoomEvents) -> Unit
|
||||||
) {
|
) {
|
||||||
val isCreateButtonEnabled: Boolean = config.roomName.isNullOrEmpty().not()
|
val isCreateButtonEnabled: Boolean = config.roomName.isNullOrEmpty().not()
|
||||||
|
|
|
||||||
|
|
@ -38,5 +38,6 @@ fun aConfigureRoomState() = ConfigureRoomState(
|
||||||
avatarActions = persistentListOf(),
|
avatarActions = persistentListOf(),
|
||||||
createRoomAction = AsyncAction.Uninitialized,
|
createRoomAction = AsyncAction.Uninitialized,
|
||||||
cameraPermissionState = aPermissionsState(showDialog = false),
|
cameraPermissionState = aPermissionsState(showDialog = false),
|
||||||
|
homeserverName = "matrix.org",
|
||||||
eventSink = { },
|
eventSink = { },
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -141,6 +141,7 @@ fun ConfigureRoomView(
|
||||||
RoomAddress(
|
RoomAddress(
|
||||||
modifier = Modifier.padding(horizontal = 16.dp),
|
modifier = Modifier.padding(horizontal = 16.dp),
|
||||||
address = state.config.roomVisibility.roomAddress,
|
address = state.config.roomVisibility.roomAddress,
|
||||||
|
homeserverName = state.homeserverName,
|
||||||
onAddressChange = { state.eventSink(ConfigureRoomEvents.RoomAddressChanged(it)) },
|
onAddressChange = { state.eventSink(ConfigureRoomEvents.RoomAddressChanged(it)) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -311,6 +312,7 @@ private fun RoomAccessOptions(
|
||||||
@Composable
|
@Composable
|
||||||
private fun RoomAddress(
|
private fun RoomAddress(
|
||||||
address: RoomAddress,
|
address: RoomAddress,
|
||||||
|
homeserverName: String,
|
||||||
onAddressChange: (String) -> Unit,
|
onAddressChange: (String) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
|
|
@ -340,7 +342,7 @@ private fun RoomAddress(
|
||||||
},
|
},
|
||||||
trailingIcon = {
|
trailingIcon = {
|
||||||
Text(
|
Text(
|
||||||
text = ":myserver.com",
|
text = homeserverName,
|
||||||
style = ElementTheme.typography.fontBodyLgMedium,
|
style = ElementTheme.typography.fontBodyLgMedium,
|
||||||
color = ElementTheme.colors.textSecondary,
|
color = ElementTheme.colors.textSecondary,
|
||||||
modifier = Modifier.padding(end = 16.dp)
|
modifier = Modifier.padding(end = 16.dp)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue