mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-28 06:57:10 +02:00
Moving aTag check to the ATag class
This commit is contained in:
@@ -77,7 +77,7 @@ object LocalCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun checkGetOrCreateNote(key: String): Note? {
|
fun checkGetOrCreateNote(key: String): Note? {
|
||||||
if (key.startsWith("naddr1") || key.contains(":")) {
|
if (ATag.isATag(key)) {
|
||||||
return checkGetOrCreateAddressableNote(key)
|
return checkGetOrCreateAddressableNote(key)
|
||||||
}
|
}
|
||||||
return try {
|
return try {
|
||||||
|
@@ -34,6 +34,10 @@ data class ATag(val kind: Int, val pubKeyHex: String, val dTag: String, val rela
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
fun isATag(key: String): Boolean {
|
||||||
|
return key.startsWith("naddr1") || key.contains(":")
|
||||||
|
}
|
||||||
|
|
||||||
fun parse(address: String, relay: String?): ATag? {
|
fun parse(address: String, relay: String?): ATag? {
|
||||||
return if (address.startsWith("naddr") || address.startsWith("nostr:naddr"))
|
return if (address.startsWith("naddr") || address.startsWith("nostr:naddr"))
|
||||||
parseNAddr(address)
|
parseNAddr(address)
|
||||||
|
Reference in New Issue
Block a user