Allows users to delete usernames
This commit is contained in:
@@ -61,7 +61,7 @@ fun NewUserMetadataView(onClose: () -> Unit, account: Account) {
|
|||||||
postViewModel.create()
|
postViewModel.create()
|
||||||
onClose()
|
onClose()
|
||||||
},
|
},
|
||||||
postViewModel.userName.value.isNotBlank()
|
true
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ fun ProfileContent(baseAccountUser: User, modifier: Modifier = Modifier, scaffol
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
if (accountUser.bestDisplayName() != null) {
|
||||||
Text(
|
Text(
|
||||||
accountUser.bestDisplayName() ?: "",
|
accountUser.bestDisplayName() ?: "",
|
||||||
modifier = Modifier.padding(top = 7.dp).clickable(onClick = {
|
modifier = Modifier.padding(top = 7.dp).clickable(onClick = {
|
||||||
@@ -163,6 +164,8 @@ fun ProfileContent(baseAccountUser: User, modifier: Modifier = Modifier, scaffol
|
|||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Bold,
|
||||||
fontSize = 18.sp
|
fontSize = 18.sp
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
if (accountUser.bestUsername() != null) {
|
||||||
Text(" @${accountUser.bestUsername()}", color = Color.LightGray,
|
Text(" @${accountUser.bestUsername()}", color = Color.LightGray,
|
||||||
modifier = Modifier.padding(top = 15.dp).clickable(onClick = {
|
modifier = Modifier.padding(top = 15.dp).clickable(onClick = {
|
||||||
accountUser.let {
|
accountUser.let {
|
||||||
@@ -171,7 +174,9 @@ fun ProfileContent(baseAccountUser: User, modifier: Modifier = Modifier, scaffol
|
|||||||
coroutineScope.launch {
|
coroutineScope.launch {
|
||||||
scaffoldState.drawerState.close()
|
scaffoldState.drawerState.close()
|
||||||
}
|
}
|
||||||
}))
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
Row(modifier = Modifier.padding(top = 15.dp).clickable(onClick = {
|
Row(modifier = Modifier.padding(top = 15.dp).clickable(onClick = {
|
||||||
accountUser.let {
|
accountUser.let {
|
||||||
navController.navigate("User/${it.pubkeyHex}")
|
navController.navigate("User/${it.pubkeyHex}")
|
||||||
|
|||||||
@@ -7,6 +7,6 @@ fun ByteArray.toShortenHex(): String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun String.toShortenHex(): String {
|
fun String.toShortenHex(): String {
|
||||||
return replaceRange(6, length-6, ":")
|
return replaceRange(8, length-8, ":")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,16 +29,7 @@ fun UsernameDisplay(baseUser: User, weight: Modifier = Modifier) {
|
|||||||
val userState by baseUser.live().metadata.observeAsState()
|
val userState by baseUser.live().metadata.observeAsState()
|
||||||
val user = userState?.user ?: return
|
val user = userState?.user ?: return
|
||||||
|
|
||||||
if (user.bestUsername() != null || user.bestDisplayName() != null) {
|
if (user.bestUsername() != null && user.bestDisplayName() != null) {
|
||||||
if (user.bestDisplayName().isNullOrBlank()) {
|
|
||||||
Text(
|
|
||||||
"@${(user.bestUsername() ?: "")}",
|
|
||||||
fontWeight = FontWeight.Bold,
|
|
||||||
maxLines = 1,
|
|
||||||
overflow = TextOverflow.Ellipsis,
|
|
||||||
modifier = weight
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
Text(
|
Text(
|
||||||
user.bestDisplayName() ?: "",
|
user.bestDisplayName() ?: "",
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Bold,
|
||||||
@@ -50,7 +41,22 @@ fun UsernameDisplay(baseUser: User, weight: Modifier = Modifier) {
|
|||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
modifier = weight
|
modifier = weight
|
||||||
)
|
)
|
||||||
}
|
} else if (user.bestDisplayName() != null) {
|
||||||
|
Text(
|
||||||
|
user.bestDisplayName() ?: "",
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
maxLines = 1,
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
modifier = weight
|
||||||
|
)
|
||||||
|
} else if (user.bestUsername() != null) {
|
||||||
|
Text(
|
||||||
|
"@${(user.bestUsername() ?: "")}",
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
maxLines = 1,
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
modifier = weight
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
Text(
|
Text(
|
||||||
user.pubkeyDisplayHex(),
|
user.pubkeyDisplayHex(),
|
||||||
|
|||||||
Reference in New Issue
Block a user