From 40a6feab8a4a36813644c19ca034333b73e98132 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Wed, 8 Mar 2023 09:59:19 -0500 Subject: [PATCH] Fixes Clickable tag for addresses (naddr) --- .../amethyst/ui/components/RichTextViewer.kt | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/RichTextViewer.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/RichTextViewer.kt index 7ef0dafce..59e223fe9 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/RichTextViewer.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/RichTextViewer.kt @@ -184,17 +184,9 @@ private fun isArabic(text: String): Boolean { } fun isBechLink(word: String): Boolean { - return word.startsWith("nostr:", true) || - word.startsWith("npub1", true) || - word.startsWith("naddr1", true) || - word.startsWith("note1", true) || - word.startsWith("nprofile1", true) || - word.startsWith("nevent1", true) || - word.startsWith("@npub1", true) || - word.startsWith("@note1", true) || - word.startsWith("@addr1", true) || - word.startsWith("@nprofile1", true) || - word.startsWith("@nevent1", true) + val cleaned = word.removePrefix("@").removePrefix("nostr:").removePrefix("@") + + return listOf("npub1", "naddr1", "note1", "nprofile1", "nevent1").any { cleaned.startsWith(it, true) } } @Composable