Navigate from people view to configuration view
This commit is contained in:
parent
018a5c540a
commit
1c6e088d5c
14 changed files with 306 additions and 9 deletions
|
|
@ -19,6 +19,7 @@
|
|||
plugins {
|
||||
id("io.element.android-compose-library")
|
||||
alias(libs.plugins.ksp)
|
||||
id("kotlin-parcelize")
|
||||
}
|
||||
|
||||
android {
|
||||
|
|
|
|||
|
|
@ -16,15 +16,20 @@
|
|||
|
||||
package io.element.android.libraries.designsystem.components.avatar
|
||||
|
||||
import android.os.Parcelable
|
||||
import androidx.compose.runtime.Immutable
|
||||
import kotlinx.parcelize.IgnoredOnParcel
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Immutable
|
||||
@Parcelize
|
||||
data class AvatarData(
|
||||
val id: String,
|
||||
val name: String?,
|
||||
val url: String? = null,
|
||||
@IgnoredOnParcel
|
||||
val size: AvatarSize = AvatarSize.MEDIUM
|
||||
) {
|
||||
) : Parcelable {
|
||||
fun getInitial(): String {
|
||||
val firstChar = name?.firstOrNull() ?: id.getOrNull(1) ?: '?'
|
||||
return firstChar.uppercase()
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ plugins {
|
|||
id("io.element.android-compose-library")
|
||||
alias(libs.plugins.anvil)
|
||||
alias(libs.plugins.ksp)
|
||||
id("kotlin-parcelize")
|
||||
}
|
||||
|
||||
android {
|
||||
|
|
|
|||
|
|
@ -16,16 +16,19 @@
|
|||
|
||||
package io.element.android.libraries.matrix.ui.model
|
||||
|
||||
import android.os.Parcelable
|
||||
import androidx.compose.runtime.Immutable
|
||||
import io.element.android.libraries.designsystem.components.avatar.AvatarData
|
||||
import io.element.android.libraries.matrix.api.core.UserId
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
@Immutable
|
||||
data class MatrixUser(
|
||||
val id: UserId,
|
||||
val username: String? = null,
|
||||
val avatarData: AvatarData = AvatarData(id.value, username),
|
||||
)
|
||||
) : Parcelable
|
||||
|
||||
fun MatrixUser.getBestName(): String {
|
||||
return username?.takeIf { it.isNotEmpty() } ?: id.value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue