lightning_uri: small cleanup
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -18,15 +18,7 @@ struct Profile: Decodable {
|
|||||||
let lud16: String?
|
let lud16: String?
|
||||||
|
|
||||||
var lightning_uri: URL? {
|
var lightning_uri: URL? {
|
||||||
if let url = (self.lud06.flatMap { URL(string: "lightning:" + $0) }) {
|
return make_ln_url(self.lud06) ?? make_ln_url(self.lud16)
|
||||||
return url
|
|
||||||
}
|
|
||||||
|
|
||||||
if let url = (self.lud16.flatMap { URL(string: "lightning:" + $0) }) {
|
|
||||||
return url
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static func displayName(profile: Profile?, pubkey: String) -> String {
|
static func displayName(profile: Profile?, pubkey: String) -> String {
|
||||||
@@ -34,9 +26,8 @@ struct Profile: Decodable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum NostrTag {
|
func make_ln_url(_ str: String?) -> URL? {
|
||||||
case other_event(OtherEvent)
|
return str.flatMap { URL(string: "lightning:" + $0) }
|
||||||
case key_event(KeyEvent)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct NostrSubscription {
|
struct NostrSubscription {
|
||||||
|
|||||||
Reference in New Issue
Block a user