mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-03-26 17:52:29 +01:00
Adds support for pronouns when the user makes them available.
This commit is contained in:
parent
b3e3b70dd0
commit
4a80a16473
@ -1149,6 +1149,7 @@ class Account(
|
||||
picture: String? = null,
|
||||
banner: String? = null,
|
||||
website: String? = null,
|
||||
pronouns: String? = null,
|
||||
about: String? = null,
|
||||
nip05: String? = null,
|
||||
lnAddress: String? = null,
|
||||
@ -1165,6 +1166,7 @@ class Account(
|
||||
picture = picture,
|
||||
banner = banner,
|
||||
website = website,
|
||||
pronouns = pronouns,
|
||||
about = about,
|
||||
nip05 = nip05,
|
||||
lnAddress = lnAddress,
|
||||
|
@ -189,6 +189,22 @@ fun NewUserMetadataView(
|
||||
|
||||
Spacer(modifier = Modifier.height(10.dp))
|
||||
|
||||
OutlinedTextField(
|
||||
label = { Text(text = stringRes(R.string.pronouns)) },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
value = postViewModel.pronouns.value,
|
||||
onValueChange = { postViewModel.pronouns.value = it },
|
||||
placeholder = {
|
||||
Text(
|
||||
text = "they/them, ...",
|
||||
color = MaterialTheme.colorScheme.placeholderText,
|
||||
)
|
||||
},
|
||||
singleLine = true,
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(10.dp))
|
||||
|
||||
OutlinedTextField(
|
||||
label = { Text(text = stringRes(R.string.website_url)) },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
|
@ -51,6 +51,7 @@ class NewUserMetadataViewModel : ViewModel() {
|
||||
val banner = mutableStateOf("")
|
||||
|
||||
val website = mutableStateOf("")
|
||||
val pronouns = mutableStateOf("")
|
||||
val nip05 = mutableStateOf("")
|
||||
val lnAddress = mutableStateOf("")
|
||||
val lnURL = mutableStateOf("")
|
||||
@ -72,6 +73,7 @@ class NewUserMetadataViewModel : ViewModel() {
|
||||
picture.value = it.info?.picture ?: ""
|
||||
banner.value = it.info?.banner ?: ""
|
||||
website.value = it.info?.website ?: ""
|
||||
pronouns.value = it.info?.pronouns ?: ""
|
||||
nip05.value = it.info?.nip05 ?: ""
|
||||
lnAddress.value = it.info?.lud16 ?: ""
|
||||
lnURL.value = it.info?.lud06 ?: ""
|
||||
@ -99,6 +101,7 @@ class NewUserMetadataViewModel : ViewModel() {
|
||||
picture = picture.value,
|
||||
banner = banner.value,
|
||||
website = website.value,
|
||||
pronouns = pronouns.value,
|
||||
about = about.value,
|
||||
nip05 = nip05.value,
|
||||
lnAddress = lnAddress.value,
|
||||
|
@ -1016,6 +1016,14 @@ private fun DrawAdditionalInfo(
|
||||
fontSize = 25.sp,
|
||||
)
|
||||
Spacer(StdHorzSpacer)
|
||||
user.info?.pronouns.let {
|
||||
Text(
|
||||
text = "($it)",
|
||||
modifier = Modifier,
|
||||
)
|
||||
Spacer(StdHorzSpacer)
|
||||
}
|
||||
|
||||
DrawPlayName(it)
|
||||
}
|
||||
}
|
||||
|
@ -121,6 +121,7 @@
|
||||
<string name="avatar_url">Avatar URL</string>
|
||||
<string name="banner_url">Banner URL</string>
|
||||
<string name="website_url">Website URL</string>
|
||||
<string name="pronouns">Pronouns</string>
|
||||
<string name="ln_address">LN Address</string>
|
||||
<string name="ln_url_outdated">LN URL (outdated)</string>
|
||||
<string name="save_to_gallery">Save to Gallery</string>
|
||||
|
@ -434,6 +434,7 @@ class UserMetadata {
|
||||
var website: String? = null
|
||||
var about: String? = null
|
||||
var bot: Boolean? = null
|
||||
var pronouns: String? = null
|
||||
|
||||
var nip05: String? = null
|
||||
var nip05Verified: Boolean = false
|
||||
@ -471,6 +472,7 @@ class UserMetadata {
|
||||
if (username?.isNotEmpty() == true) username = username?.trim()
|
||||
if (lud06?.isNotEmpty() == true) lud06 = lud06?.trim()
|
||||
if (lud16?.isNotEmpty() == true) lud16 = lud16?.trim()
|
||||
if (pronouns?.isNotEmpty() == true) pronouns = pronouns?.trim()
|
||||
|
||||
if (banner?.isNotEmpty() == true) banner = banner?.trim()
|
||||
if (website?.isNotEmpty() == true) website = website?.trim()
|
||||
@ -487,6 +489,7 @@ class UserMetadata {
|
||||
if (banner?.isBlank() == true) banner = null
|
||||
if (website?.isBlank() == true) website = null
|
||||
if (domain?.isBlank() == true) domain = null
|
||||
if (pronouns?.isBlank() == true) pronouns = null
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,6 +208,7 @@ class MetadataEvent(
|
||||
nip05: String?,
|
||||
lnAddress: String?,
|
||||
lnURL: String?,
|
||||
pronouns: String?,
|
||||
twitter: String?,
|
||||
mastodon: String?,
|
||||
github: String?,
|
||||
@ -231,6 +232,7 @@ class MetadataEvent(
|
||||
picture?.let { addIfNotBlank(currentJson, "picture", it.trim()) }
|
||||
banner?.let { addIfNotBlank(currentJson, "banner", it.trim()) }
|
||||
website?.let { addIfNotBlank(currentJson, "website", it.trim()) }
|
||||
pronouns?.let { addIfNotBlank(currentJson, "pronouns", it.trim()) }
|
||||
about?.let { addIfNotBlank(currentJson, "about", it.trim()) }
|
||||
nip05?.let { addIfNotBlank(currentJson, "nip05", it.trim()) }
|
||||
lnAddress?.let { addIfNotBlank(currentJson, "lud16", it.trim()) }
|
||||
|
Loading…
x
Reference in New Issue
Block a user