Moving aTag check to the ATag class

This commit is contained in:
Vitor Pamplona
2023-03-07 13:53:03 -05:00
parent 1919dc5c81
commit 9720fdfce9
2 changed files with 5 additions and 1 deletions

View File

@@ -77,7 +77,7 @@ object LocalCache {
}
fun checkGetOrCreateNote(key: String): Note? {
if (key.startsWith("naddr1") || key.contains(":")) {
if (ATag.isATag(key)) {
return checkGetOrCreateAddressableNote(key)
}
return try {

View File

@@ -34,6 +34,10 @@ data class ATag(val kind: Int, val pubKeyHex: String, val dTag: String, val rela
}
companion object {
fun isATag(key: String): Boolean {
return key.startsWith("naddr1") || key.contains(":")
}
fun parse(address: String, relay: String?): ATag? {
return if (address.startsWith("naddr") || address.startsWith("nostr:naddr"))
parseNAddr(address)