Re-adds name to the profile edit page.
This commit is contained in:
+3
-2
@@ -50,6 +50,7 @@ class UserMetadataState(
|
||||
|
||||
suspend fun sendNewUserMetadata(
|
||||
name: String? = null,
|
||||
displayName: String? = null,
|
||||
picture: String? = null,
|
||||
banner: String? = null,
|
||||
website: String? = null,
|
||||
@@ -69,7 +70,7 @@ class UserMetadataState(
|
||||
MetadataEvent.updateFromPast(
|
||||
latest = latest,
|
||||
name = name,
|
||||
displayName = name,
|
||||
displayName = displayName,
|
||||
picture = picture,
|
||||
banner = banner,
|
||||
website = website,
|
||||
@@ -85,7 +86,7 @@ class UserMetadataState(
|
||||
} else {
|
||||
MetadataEvent.createNew(
|
||||
name = name,
|
||||
displayName = name,
|
||||
displayName = displayName,
|
||||
picture = picture,
|
||||
banner = banner,
|
||||
website = website,
|
||||
|
||||
+24
-3
@@ -70,11 +70,12 @@ fun NewUserMetadataScreen(
|
||||
SavingTopBar(
|
||||
titleRes = R.string.profile,
|
||||
onCancel = {
|
||||
postViewModel.clear()
|
||||
nav.popBack()
|
||||
},
|
||||
onPost = {
|
||||
postViewModel.create()
|
||||
accountViewModel.launchSigner {
|
||||
postViewModel.create()
|
||||
}
|
||||
nav.popBack()
|
||||
},
|
||||
)
|
||||
@@ -95,7 +96,27 @@ fun NewUserMetadataScreen(
|
||||
modifier = Modifier.padding(10.dp).verticalScroll(rememberScrollState()),
|
||||
) {
|
||||
OutlinedTextField(
|
||||
label = { Text(text = stringRes(R.string.profile_name)) },
|
||||
label = { Text(text = stringRes(R.string.profile_name_with_explainer)) },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
value = postViewModel.name.value,
|
||||
onValueChange = { postViewModel.name.value = it },
|
||||
placeholder = {
|
||||
Text(
|
||||
text = stringRes(R.string.my_name),
|
||||
color = MaterialTheme.colorScheme.placeholderText,
|
||||
)
|
||||
},
|
||||
keyboardOptions =
|
||||
KeyboardOptions.Default.copy(
|
||||
capitalization = KeyboardCapitalization.Sentences,
|
||||
),
|
||||
singleLine = true,
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(10.dp))
|
||||
|
||||
OutlinedTextField(
|
||||
label = { Text(text = stringRes(R.string.display_name)) },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
value = postViewModel.displayName.value,
|
||||
onValueChange = { postViewModel.displayName.value = it },
|
||||
|
||||
+23
-25
@@ -47,7 +47,7 @@ class NewUserMetadataViewModel : ViewModel() {
|
||||
private lateinit var accountViewModel: AccountViewModel
|
||||
private lateinit var account: Account
|
||||
|
||||
// val userName = mutableStateOf("")
|
||||
val name = mutableStateOf("")
|
||||
val displayName = mutableStateOf("")
|
||||
val about = mutableStateOf("")
|
||||
|
||||
@@ -74,8 +74,8 @@ class NewUserMetadataViewModel : ViewModel() {
|
||||
|
||||
fun load() {
|
||||
account.userProfile().let {
|
||||
// userName.value = it.bestUsername() ?: ""
|
||||
displayName.value = it.info?.bestName() ?: ""
|
||||
name.value = it.info?.name ?: ""
|
||||
displayName.value = it.info?.displayName ?: ""
|
||||
about.value = it.info?.about ?: ""
|
||||
picture.value = it.info?.picture ?: ""
|
||||
banner.value = it.info?.banner ?: ""
|
||||
@@ -100,33 +100,31 @@ class NewUserMetadataViewModel : ViewModel() {
|
||||
}
|
||||
}
|
||||
|
||||
fun create() {
|
||||
// Tries to not delete any existing attribute that we do not work with.
|
||||
accountViewModel.launchSigner {
|
||||
val metadata =
|
||||
account.userMetadata.sendNewUserMetadata(
|
||||
name = displayName.value,
|
||||
picture = picture.value,
|
||||
banner = banner.value,
|
||||
website = website.value,
|
||||
pronouns = pronouns.value,
|
||||
about = about.value,
|
||||
nip05 = nip05.value,
|
||||
lnAddress = lnAddress.value,
|
||||
lnURL = lnURL.value,
|
||||
twitter = twitter.value,
|
||||
mastodon = mastodon.value,
|
||||
github = github.value,
|
||||
)
|
||||
suspend fun create() {
|
||||
val metadata =
|
||||
account.userMetadata.sendNewUserMetadata(
|
||||
name = name.value,
|
||||
displayName = displayName.value,
|
||||
picture = picture.value,
|
||||
banner = banner.value,
|
||||
website = website.value,
|
||||
pronouns = pronouns.value,
|
||||
about = about.value,
|
||||
nip05 = nip05.value,
|
||||
lnAddress = lnAddress.value,
|
||||
lnURL = lnURL.value,
|
||||
twitter = twitter.value,
|
||||
mastodon = mastodon.value,
|
||||
github = github.value,
|
||||
)
|
||||
|
||||
account.sendLiterallyEverywhere(metadata)
|
||||
account.sendLiterallyEverywhere(metadata)
|
||||
|
||||
clear()
|
||||
}
|
||||
clear()
|
||||
}
|
||||
|
||||
fun clear() {
|
||||
// userName.value = ""
|
||||
name.value = ""
|
||||
displayName.value = ""
|
||||
about.value = ""
|
||||
picture.value = ""
|
||||
|
||||
@@ -147,6 +147,8 @@
|
||||
<string name="add_a_user">Add a User</string>
|
||||
<string name="add_a_relay">Add a Relay</string>
|
||||
<string name="profile_name">Name</string>
|
||||
<string name="profile_name_with_explainer">Name (for @tagging)</string>
|
||||
<string name="my_name">My @tag name</string>
|
||||
<string name="display_name">Display Name</string>
|
||||
<string name="my_display_name">My display name</string>
|
||||
<string name="my_awesome_name">Ostrich McAwesome</string>
|
||||
|
||||
Reference in New Issue
Block a user