Remove 1 indentation level from uriToRoute()
This commit is contained in:
@@ -14,13 +14,13 @@ class Nip19 {
|
|||||||
enum class Type {
|
enum class Type {
|
||||||
USER, NOTE, RELAY, ADDRESS
|
USER, NOTE, RELAY, ADDRESS
|
||||||
}
|
}
|
||||||
|
|
||||||
data class Return(val type: Type, val hex: String)
|
data class Return(val type: Type, val hex: String)
|
||||||
|
|
||||||
fun uriToRoute(uri: String?): Return? {
|
fun uriToRoute(uri: String?): Return? {
|
||||||
try {
|
try {
|
||||||
val key = uri?.removePrefix("nostr:")
|
val key = uri?.removePrefix("nostr:") ?: return null
|
||||||
|
|
||||||
if (key != null) {
|
|
||||||
val bytes = key.bechToBytes()
|
val bytes = key.bechToBytes()
|
||||||
if (key.startsWith("npub")) {
|
if (key.startsWith("npub")) {
|
||||||
return Return(Type.USER, bytes.toHexKey())
|
return Return(Type.USER, bytes.toHexKey())
|
||||||
@@ -55,7 +55,6 @@ class Nip19 {
|
|||||||
if (d != null)
|
if (d != null)
|
||||||
return Return(Type.ADDRESS, "$kind:$author:$d")
|
return Return(Type.ADDRESS, "$kind:$author:$d")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
println("Issue trying to Decode NIP19 ${uri}: ${e.message}")
|
println("Issue trying to Decode NIP19 ${uri}: ${e.message}")
|
||||||
//e.printStackTrace()
|
//e.printStackTrace()
|
||||||
|
|||||||
Reference in New Issue
Block a user