EditUserProfileState.userId cannot be null.
It simplifies a bit the codebase.
This commit is contained in:
parent
176c7c8bc6
commit
0b9724af84
3 changed files with 13 additions and 17 deletions
|
|
@ -24,7 +24,7 @@ import io.element.android.libraries.permissions.api.PermissionsState
|
|||
import kotlinx.collections.immutable.ImmutableList
|
||||
|
||||
data class EditUserProfileState(
|
||||
val userId: UserId?,
|
||||
val userId: UserId,
|
||||
val displayName: String,
|
||||
val userAvatarUrl: Uri?,
|
||||
val avatarActions: ImmutableList<AvatarAction>,
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ fun EditUserProfileView(
|
|||
) {
|
||||
Spacer(modifier = Modifier.height(24.dp))
|
||||
EditableAvatarView(
|
||||
matrixId = state.userId?.value,
|
||||
matrixId = state.userId.value,
|
||||
displayName = state.displayName,
|
||||
avatarUrl = state.userAvatarUrl,
|
||||
avatarSize = AvatarSize.RoomHeader,
|
||||
|
|
@ -122,14 +122,12 @@ fun EditUserProfileView(
|
|||
modifier = Modifier.align(Alignment.CenterHorizontally),
|
||||
)
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
state.userId?.let {
|
||||
Text(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
text = it.value,
|
||||
style = ElementTheme.typography.fontBodyLgRegular,
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
}
|
||||
Text(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
text = state.userId.value,
|
||||
style = ElementTheme.typography.fontBodyLgRegular,
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
Spacer(modifier = Modifier.height(40.dp))
|
||||
LabelledOutlinedTextField(
|
||||
label = stringResource(R.string.screen_edit_profile_display_name),
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ import io.element.android.libraries.designsystem.theme.components.Icon
|
|||
|
||||
@Composable
|
||||
fun EditableAvatarView(
|
||||
matrixId: String?,
|
||||
matrixId: String,
|
||||
displayName: String?,
|
||||
avatarUrl: Uri?,
|
||||
avatarSize: AvatarSize,
|
||||
|
|
@ -65,12 +65,10 @@ fun EditableAvatarView(
|
|||
) {
|
||||
when (avatarUrl?.scheme) {
|
||||
null, "mxc" -> {
|
||||
matrixId?.let {
|
||||
Avatar(
|
||||
avatarData = AvatarData(it, displayName, avatarUrl?.toString(), size = avatarSize),
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
)
|
||||
}
|
||||
Avatar(
|
||||
avatarData = AvatarData(matrixId, displayName, avatarUrl?.toString(), size = avatarSize),
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
)
|
||||
}
|
||||
else -> {
|
||||
UnsavedAvatar(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue