Fixes nprofile1 tags

This commit is contained in:
Vitor Pamplona
2023-04-07 18:26:13 -04:00
parent 234751a4b3
commit 80e58f72f8

View File

@@ -283,7 +283,7 @@ private fun isArabic(text: String): Boolean {
} }
fun isBechLink(word: String): Boolean { fun isBechLink(word: String): Boolean {
val cleaned = word.lowercase().removePrefix("@").removePrefix("nostr:").removePrefix("@").take(7) val cleaned = word.lowercase().removePrefix("@").removePrefix("nostr:").removePrefix("@")
return listOf("npub1", "naddr1", "note1", "nprofile1", "nevent1").any { cleaned.startsWith(it) } return listOf("npub1", "naddr1", "note1", "nprofile1", "nevent1").any { cleaned.startsWith(it) }
} }
@@ -331,13 +331,11 @@ fun BechLink(word: String, canPreview: Boolean, backgroundColor: Color, accountV
) )
} ?: nip19Route?.let { } ?: nip19Route?.let {
ClickableRoute(it, navController) ClickableRoute(it, navController)
} } ?: Text(text = "$word ")
?: Text(text = "$word ")
} else { } else {
nip19Route?.let { nip19Route?.let {
ClickableRoute(it, navController) ClickableRoute(it, navController)
} } ?: Text(text = "$word ")
?: Text(text = "$word ")
} }
} }
@@ -412,10 +410,11 @@ fun HashTag(word: String, accountViewModel: AccountViewModel, navController: Nav
inlineContent = inlineContent inlineContent = inlineContent
) )
} }
tagPair.second?.ifBlank { null }?.let { tagPair.second?.ifBlank { "" }?.let {
Text(text = "$it ") Text(text = "$it ")
} }
} ?: Text(text = "$word ") } ?: Text(text = "$word ")
} }
@Composable @Composable