damus

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

commit 3651ac67148c49a7fdf6278018db99abff45d1bb
parent 8a15265f842a0a5fce721285edf5c04bfa6cf1f8
Author: William Casarin <jb55@jb55.com>
Date:   Sun, 30 Oct 2022 23:14:27 -0700

Show lud06 lightning tip button

If the profile has a lud06 or lud16 field, render a lightning tipping
button

Changelog-Added: Add lightning tipping button for lud06 profiles
Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mdamus/Views/ProfilePicView.swift | 2+-
Mdamus/Views/ProfileView.swift | 16+++++++++++++++-
2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/damus/Views/ProfilePicView.swift b/damus/Views/ProfilePicView.swift @@ -90,7 +90,7 @@ struct ProfilePicView: View { func make_preview_profiles(_ pubkey: String) -> Profiles { let profiles = Profiles() let picture = "http://cdn.jb55.com/img/red-me.jpg" - let profile = Profile(name: "jb55", display_name: "William Casarin", about: "It's me", picture: picture) + let profile = Profile(name: "jb55", display_name: "William Casarin", about: "It's me", picture: picture, website: "https://jb55.com", lud06: nil, lud16: nil) let ts_profile = TimestampedProfile(profile: profile, timestamp: 0) profiles.add(id: pubkey, profile: ts_profile) return profiles diff --git a/damus/Views/ProfileView.swift b/damus/Views/ProfileView.swift @@ -78,6 +78,15 @@ struct ProfileView: View { //@EnvironmentObject var profile: ProfileModel + func LNButton(_ url: URL) -> some View { + Button(action: { + UIApplication.shared.open(url) + }) { + Label("", systemImage: "bolt.fill") + .foregroundColor(.orange) + } + } + var DMButton: some View { let dm_model = damus_state.dms.lookup_or_create(profile.pubkey) let dmview = DMChatView(damus_state: damus_state, pubkey: profile.pubkey) @@ -99,6 +108,11 @@ struct ProfileView: View { Spacer() + if let lnuri = data?.lightning_uri { + LNButton(lnuri) + .padding([.trailing], 20) + } + DMButton .padding([.trailing], 20) @@ -183,7 +197,7 @@ func test_damus_state() -> DamusState { let pubkey = "3efdaebb1d8923ebd99c9e7ace3b4194ab45512e2be79c1b7d68d9243e0d2681" let damus = DamusState(pool: RelayPool(), keypair: Keypair(pubkey: pubkey, privkey: "privkey"), likes: EventCounter(our_pubkey: pubkey), boosts: EventCounter(our_pubkey: pubkey), contacts: Contacts(), tips: TipCounter(our_pubkey: pubkey), profiles: Profiles(), dms: DirectMessagesModel()) - let prof = Profile(name: "damus", display_name: "Damus", about: "iOS app!", picture: "https://damus.io/img/logo.png") + let prof = Profile(name: "damus", display_name: "Damus", about: "iOS app!", picture: "https://damus.io/img/logo.png", website: "https://damus.io", lud06: nil, lud16: "jb55@sendsats.lol") let tsprof = TimestampedProfile(profile: prof, timestamp: 0) damus.profiles.add(id: pubkey, profile: tsprof) return damus