damus

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

commit 907f0d236f93eae27b896ed8459806969bf9ca51
parent 4b8f536a9b7b4d92ebadd387e926bdaf1988de60
Author: William Casarin <jb55@jb55.com>
Date:   Wed, 11 Jan 2023 14:49:14 -0800

Rename boost to repost and removed nip05 domain from them

Changelog-Changed: Renamed boost to repost
Changelog-Changed: Removed nip05 domain from boosts/reposts

Diffstat:
Mdamus.xcodeproj/project.pbxproj | 4++++
Adamus/Components/Reposted.swift | 34++++++++++++++++++++++++++++++++++
Mdamus/Nostr/Nostr.swift | 21++-------------------
Mdamus/Views/EventView.swift | 12+-----------
Mdamus/Views/ProfileName.swift | 2--
5 files changed, 41 insertions(+), 32 deletions(-)

diff --git a/damus.xcodeproj/project.pbxproj b/damus.xcodeproj/project.pbxproj @@ -117,6 +117,7 @@ 4CB55EF5295E679D007FD187 /* UserRelaysView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CB55EF4295E679D007FD187 /* UserRelaysView.swift */; }; 4CB8838629656C8B00DC99E7 /* NIP05.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CB8838529656C8B00DC99E7 /* NIP05.swift */; }; 4CB8838B296F6E1E00DC99E7 /* NIP05Badge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CB8838A296F6E1E00DC99E7 /* NIP05Badge.swift */; }; + 4CB8838D296F710400DC99E7 /* Reposted.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CB8838C296F710400DC99E7 /* Reposted.swift */; }; 4CD7641B28A1641400B6928F /* EndBlock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CD7641A28A1641400B6928F /* EndBlock.swift */; }; 4CE4F8CD281352B30009DFBB /* Notifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CE4F8CC281352B30009DFBB /* Notifications.swift */; }; 4CE4F9DE2852768D00C00DD9 /* ConfigView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CE4F9DD2852768D00C00DD9 /* ConfigView.swift */; }; @@ -310,6 +311,7 @@ 4CB55EF4295E679D007FD187 /* UserRelaysView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserRelaysView.swift; sourceTree = "<group>"; }; 4CB8838529656C8B00DC99E7 /* NIP05.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NIP05.swift; sourceTree = "<group>"; }; 4CB8838A296F6E1E00DC99E7 /* NIP05Badge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NIP05Badge.swift; sourceTree = "<group>"; }; + 4CB8838C296F710400DC99E7 /* Reposted.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Reposted.swift; sourceTree = "<group>"; }; 4CD7641A28A1641400B6928F /* EndBlock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EndBlock.swift; sourceTree = "<group>"; }; 4CE4F8CC281352B30009DFBB /* Notifications.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Notifications.swift; sourceTree = "<group>"; }; 4CE4F9DD2852768D00C00DD9 /* ConfigView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigView.swift; sourceTree = "<group>"; }; @@ -573,6 +575,7 @@ 4C3EA67C28FFBBA200C48A62 /* InvoicesView.swift */, 4C3EA67E28FFC01D00C48A62 /* InvoiceView.swift */, 4CB8838A296F6E1E00DC99E7 /* NIP05Badge.swift */, + 4CB8838C296F710400DC99E7 /* Reposted.swift */, ); path = Components; sourceTree = "<group>"; @@ -815,6 +818,7 @@ 4C363A8C28236B92006E126D /* PubkeyView.swift in Sources */, 4C5C7E68284ED36500A22DF5 /* SearchHomeModel.swift in Sources */, 4C75EFB728049D990006080F /* RelayPool.swift in Sources */, + 4CB8838D296F710400DC99E7 /* Reposted.swift in Sources */, 4C3EA67728FF7A9800C48A62 /* talstr.c in Sources */, 4CE6DEE927F7A08100C66700 /* ContentView.swift in Sources */, 4CEE2AF5280B29E600AB5EEF /* TimeAgo.swift in Sources */, diff --git a/damus/Components/Reposted.swift b/damus/Components/Reposted.swift @@ -0,0 +1,34 @@ +// +// Reposted.swift +// damus +// +// Created by William Casarin on 2023-01-11. +// + +import SwiftUI + +struct Reposted: View { + let damus: DamusState + let pubkey: String + let profile: Profile? + + var body: some View { + HStack(alignment: .center) { + Image(systemName: "arrow.2.squarepath") + .font(.footnote) + .foregroundColor(Color.gray) + ProfileName(pubkey: pubkey, profile: profile, damus: damus, show_friend_confirmed: true, show_nip5_domain: false) + .foregroundColor(Color.gray) + Text("Reposted", comment: "Text indicating that the post was reposted (i.e. re-shared).") + .font(.footnote) + .foregroundColor(Color.gray) + } + } +} + +struct Reposted_Previews: PreviewProvider { + static var previews: some View { + let test_state = test_damus_state() + Reposted(damus: test_state, pubkey: test_state.pubkey, profile: make_test_profile()) + } +} diff --git a/damus/Nostr/Nostr.swift b/damus/Nostr/Nostr.swift @@ -94,26 +94,9 @@ struct Profile: Codable { } } -/* -struct Profile: Decodable { - let name: String? - let display_name: String? - let about: String? - let picture: String? - let website: String? - let nip05: String? - let lud06: String? - let lud16: String? - - var lightning_uri: URL? { - return make_ln_url(self.lud06) ?? make_ln_url(self.lud16) - } - - static func displayName(profile: Profile?, pubkey: String) -> String { - return profile?.name ?? abbrev_pubkey(pubkey) - } +func make_test_profile() -> Profile { + return Profile(name: "jb55", display_name: "Will", about: "Its a me", picture: "https://cdn.jb55.com/img/red-me.jpg", website: "jb55.com", lud06: "jb55@jb55.com", lud16: nil, nip05: "jb55@jb55.com") } - */ func make_ln_url(_ str: String?) -> URL? { return str.flatMap { URL(string: "lightning:" + $0) } diff --git a/damus/Views/EventView.swift b/damus/Views/EventView.swift @@ -172,17 +172,7 @@ struct EventView: View { let booster_profile = ProfileView(damus_state: damus, profile: prof_model, followers: follow_model) NavigationLink(destination: booster_profile) { - HStack { - Image(systemName: "arrow.2.squarepath") - .font(.footnote.weight(.bold)) - .foregroundColor(Color.gray) - ProfileName(pubkey: event.pubkey, profile: prof, damus: damus, show_friend_confirmed: true) - .font(.footnote.weight(.bold)) - .foregroundColor(Color.gray) - Text("Boosted", comment: "Text indicating that the post was boosted (i.e. re-shared).") - .font(.footnote.weight(.bold)) - .foregroundColor(Color.gray) - } + Reposted(damus: damus, pubkey: event.pubkey, profile: prof) } .buttonStyle(PlainButtonStyle()) TextEvent(inner_ev, pubkey: inner_ev.pubkey) diff --git a/damus/Views/ProfileName.swift b/damus/Views/ProfileName.swift @@ -34,8 +34,6 @@ struct ProfileName: View { @State var display_name: String? @State var nip05: NIP05? - - @Environment(\.openURL) var openURL init(pubkey: String, profile: Profile?, damus: DamusState, show_friend_confirmed: Bool, show_nip5_domain: Bool = true) { self.pubkey = pubkey