damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit ffe27848731ce9a2dffe7c7ef0524207ef7b58ea
parent 5f450ca9360757e3ba34a56f40e585232225b66f
Author: William Casarin <jb55@jb55.com>
Date:   Sun, 30 Oct 2022 23:20:17 -0700

lightning_uri: small cleanup

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mdamus/Nostr/Nostr.swift | 15+++------------
1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/damus/Nostr/Nostr.swift b/damus/Nostr/Nostr.swift @@ -18,15 +18,7 @@ struct Profile: Decodable { let lud16: String? var lightning_uri: URL? { - if let url = (self.lud06.flatMap { URL(string: "lightning:" + $0) }) { - return url - } - - if let url = (self.lud16.flatMap { URL(string: "lightning:" + $0) }) { - return url - } - - return nil + return make_ln_url(self.lud06) ?? make_ln_url(self.lud16) } static func displayName(profile: Profile?, pubkey: String) -> String { @@ -34,9 +26,8 @@ struct Profile: Decodable { } } -enum NostrTag { - case other_event(OtherEvent) - case key_event(KeyEvent) +func make_ln_url(_ str: String?) -> URL? { + return str.flatMap { URL(string: "lightning:" + $0) } } struct NostrSubscription {