Compare commits

...

7 Commits

Author SHA1 Message Date
94f21dbe2c Fix UX to open relay config view when navigating from personal profile 2023-02-06 10:57:28 -05:00
William Casarin
a2eb77a5e9 Hide incoming dms from blocked users
Changelog-Fixed: Hide incoming DMs from blocked users
2023-02-05 10:49:51 -08:00
William Casarin
29a8206586 Hide blocked users from search results
Changelog-Fixed: Hide blocked users from search results
2023-02-05 10:49:18 -08:00
William Casarin
07676a1f95 refactor: should_hide_event -> should_show_event 2023-02-05 10:45:02 -08:00
William Casarin
79ca3b2262 remove orangepill from bootstrap relay list 2023-02-05 10:38:54 -08:00
William Casarin
ba8425dedb Revert "Add remote image loading policy settings"
We still want to blur images from stranges if we set the everyone
policy. This is a regression.

This reverts commit ced5b4974f, reversing
changes made to 9be55b08fd.
2023-02-05 00:24:03 -08:00
Rob Seward
7d3d23def3 Add universal link for Cash App
Update the the Cash App wallet option to use a universal link that will start the payment process in Cash App.

Changelog-Fixed: Fix Cash App invoice payments
Closes: #454
2023-02-04 12:56:56 -08:00
26 changed files with 79 additions and 125 deletions

View File

@@ -121,8 +121,7 @@ struct TranslateView: View {
if let translated = translated_note {
// Render translated note.
let blocks = event.get_blocks(content: translated)
let show_images = should_show_images(contacts: damus_state.contacts, ev: event, our_pubkey: damus_state.pubkey)
translated_artifacts = render_blocks(blocks: blocks, profiles: damus_state.profiles, privkey: damus_state.keypair.privkey, show_images: show_images)
translated_artifacts = render_blocks(blocks: blocks, profiles: damus_state.profiles, privkey: damus_state.keypair.privkey)
}
checkingTranslationStatus = false

View File

@@ -17,7 +17,7 @@ struct UserView: View {
let pv = ProfileView(damus_state: damus_state, profile: pmodel, followers: followers)
NavigationLink(destination: pv) {
ProfilePicView(pubkey: pubkey, size: PFP_SIZE, highlight: .none, profiles: damus_state.profiles, contacts: damus_state.contacts)
ProfilePicView(pubkey: pubkey, size: PFP_SIZE, highlight: .none, profiles: damus_state.profiles)
VStack(alignment: .leading) {
let profile = damus_state.profiles.lookup(id: pubkey)

View File

@@ -13,7 +13,7 @@ var BOOTSTRAP_RELAYS = [
"wss://relay.damus.io",
"wss://eden.nostr.land",
"wss://relay.snort.social",
"wss://nostr.orangepill.dev",
"wss://nostr.bitcoiner.social",
"wss://nos.lol",
"wss://relay.current.fyi",
"wss://brb.io",
@@ -197,7 +197,7 @@ struct ContentView: View {
var MaybeSearchView: some View {
Group {
if let search = self.active_search {
SearchView(appstate: damus_state!, search: SearchModel(pool: damus_state!.pool, search: search))
SearchView(appstate: damus_state!, search: SearchModel(contacts: damus_state!.contacts, pool: damus_state!.pool, search: search))
} else {
EmptyView()
}
@@ -252,7 +252,7 @@ struct ContentView: View {
Button {
isSideBarOpened.toggle()
} label: {
ProfilePicView(pubkey: damus_state!.pubkey, size: 32, highlight: .none, profiles: damus_state!.profiles, contacts: damus_state!.contacts)
ProfilePicView(pubkey: damus_state!.pubkey, size: 32, highlight: .none, profiles: damus_state!.profiles)
}
}

View File

@@ -24,7 +24,6 @@
<string>zeusln</string>
<string>zebedee</string>
<string>lightning</string>
<string>squarecash</string>
<string>phoenix</string>
<string>lnlink</string>
<string>strike</string>

View File

@@ -464,7 +464,7 @@ class HomeModel: ObservableObject {
}
func handle_text_event(sub_id: String, _ ev: NostrEvent) {
if should_hide_event(contacts: damus_state.contacts, ev: ev) {
guard should_show_event(contacts: damus_state.contacts, ev: ev) else {
return
}
@@ -476,7 +476,7 @@ class HomeModel: ObservableObject {
}
func handle_dm(_ ev: NostrEvent) {
if let notifs = handle_incoming_dm(prev_events: self.new_events, dms: self.dms, our_pubkey: self.damus_state.pubkey, ev: ev) {
if let notifs = handle_incoming_dm(contacts: damus_state.contacts, prev_events: self.new_events, dms: self.dms, our_pubkey: self.damus_state.pubkey, ev: ev) {
self.new_events = notifs
}
}
@@ -707,7 +707,12 @@ func load_our_relays(contacts: Contacts, our_pubkey: String, pool: RelayPool, m_
}
}
func handle_incoming_dm(prev_events: NewEventsBits, dms: DirectMessagesModel, our_pubkey: String, ev: NostrEvent) -> NewEventsBits? {
func handle_incoming_dm(contacts: Contacts, prev_events: NewEventsBits, dms: DirectMessagesModel, our_pubkey: String, ev: NostrEvent) -> NewEventsBits? {
// hide blocked users
guard should_show_event(contacts: contacts, ev: ev) else {
return prev_events
}
var inserted = false
var found = false
let ours = ev.pubkey == our_pubkey
@@ -781,10 +786,10 @@ func event_has_our_pubkey(_ ev: NostrEvent, our_pubkey: String) -> Bool {
}
func should_hide_event(contacts: Contacts, ev: NostrEvent) -> Bool {
func should_show_event(contacts: Contacts, ev: NostrEvent) -> Bool {
if contacts.is_muted(ev.pubkey) {
return true
return false
}
return !ev.should_show_event
return ev.should_show_event
}

View File

@@ -31,7 +31,7 @@ class SearchHomeModel: ObservableObject {
}
func filter_muted() {
events = events.filter { !should_hide_event(contacts: damus_state.contacts, ev: $0) }
events = events.filter { should_show_event(contacts: damus_state.contacts, ev: $0) }
}
func subscribe() {
@@ -54,7 +54,7 @@ class SearchHomeModel: ObservableObject {
guard sub_id == self.base_subid || sub_id == self.profiles_subid else {
return
}
if ev.is_textlike && !should_hide_event(contacts: damus_state.contacts, ev: ev) && !ev.is_reply(nil) {
if ev.is_textlike && should_show_event(contacts: damus_state.contacts, ev: ev) && !ev.is_reply(nil) {
if seen_pubkey.contains(ev.pubkey) {
return
}

View File

@@ -15,14 +15,20 @@ class SearchModel: ObservableObject {
let pool: RelayPool
var search: NostrFilter
let contacts: Contacts
let sub_id = UUID().description
let limit: UInt32 = 500
init(pool: RelayPool, search: NostrFilter) {
init(contacts: Contacts, pool: RelayPool, search: NostrFilter) {
self.contacts = contacts
self.pool = pool
self.search = search
}
func filter_muted() {
self.events = self.events.filter { should_show_event(contacts: contacts, ev: $0) }
}
func subscribe() {
// since 1 month
search.limit = self.limit
@@ -47,6 +53,10 @@ class SearchModel: ObservableObject {
return
}
guard should_show_event(contacts: contacts, ev: ev) else {
return
}
if insert_uniq_sorted_event(events: &self.events, new_ev: ev, cmp: { $0.created_at > $1.created_at } ) {
objectWillChange.send()
}

View File

@@ -45,7 +45,7 @@ enum Wallet: String, CaseIterable, Identifiable {
return .init(index: 0, tag: "strike", displayName: NSLocalizedString("Strike", comment: "Dropdown option label for Lightning wallet, Strike."), link: "strike:",
appStoreLink: "https://apps.apple.com/us/app/strike-bitcoin-payments/id1488724463", image: "strike")
case .cashapp:
return .init(index: 1, tag: "cashapp", displayName: NSLocalizedString("Cash App", comment: "Dropdown option label for Lightning wallet, Cash App."), link: "squarecash://",
return .init(index: 1, tag: "cashapp", displayName: NSLocalizedString("Cash App", comment: "Dropdown option label for Lightning wallet, Cash App."), link: "https://cash.app/launch/lightning/",
appStoreLink: "https://apps.apple.com/us/app/cash-app/id711923939", image: "cashapp")
case .muun:
return .init(index: 2, tag: "muun", displayName: NSLocalizedString("Muun", comment: "Dropdown option label for Lightning wallet, Muun."), link: "muun:", appStoreLink: "https://apps.apple.com/us/app/muun-wallet/id1482037683", image: "muun")

View File

@@ -75,7 +75,7 @@ struct ChatView: View {
HStack {
VStack {
if is_active || just_started {
ProfilePicView(pubkey: event.pubkey, size: 32, highlight: is_active ? .main : .none, profiles: damus_state.profiles, contacts:damus_state.contacts)
ProfilePicView(pubkey: event.pubkey, size: 32, highlight: is_active ? .main : .none, profiles: damus_state.profiles)
}
Spacer()
@@ -97,7 +97,7 @@ struct ChatView: View {
if let ref_id = thread.replies.lookup(event.id) {
if !is_reply_to_prev() {
/*
ReplyQuoteView(keypair: damus_state.keypair, quoter: event, event_id: ref_id, profiles: damus_state.profiles, previews: damus_state.previews, contacts: damus_state.contacts)
ReplyQuoteView(keypair: damus_state.keypair, quoter: event, event_id: ref_id, profiles: damus_state.profiles, previews: damus_state.previews)
.frame(maxHeight: expand_reply ? nil : 100)
.environmentObject(thread)
.onTapGesture {

View File

@@ -8,26 +8,6 @@ import AVFoundation
import Kingfisher
import SwiftUI
enum RemoteImagePolicy: String, CaseIterable {
case everyone
case friendsOnly
case friendsOfFriends
case restricted
}
func remoteImagePolicyText(_ fs: RemoteImagePolicy) -> String {
switch fs {
case .everyone:
return "Everyone"
case .friendsOnly:
return "Friends Only"
case .friendsOfFriends:
return "Friends of Friends"
case .restricted:
return "Block Images"
}
}
struct ConfigView: View {
let state: DamusState
@Environment(\.dismiss) var dismiss
@@ -39,8 +19,8 @@ struct ConfigView: View {
@State var privkey_copied: Bool = false
@State var pubkey_copied: Bool = false
@State var delete_text: String = ""
@ObservedObject var settings: UserSettingsStore
@AppStorage("remote_image_policy") var remote_image_policy: RemoteImagePolicy = .everyone
let generator = UIImpactFeedbackGenerator(style: .light)
@@ -149,35 +129,7 @@ struct ConfigView: View {
KingfisherManager.shared.cache.cleanExpiredDiskCache()
}
}
Section(NSLocalizedString("Remote Image Loading Policy", comment: "Section title for remote image loading policy")) {
Menu {
Button {
self.remote_image_policy = .everyone
} label: {
Text(remoteImagePolicyText(.everyone))
}
Button {
self.remote_image_policy = .friendsOfFriends
} label: {
Text(remoteImagePolicyText(.friendsOfFriends))
}
Button {
self.remote_image_policy = .friendsOnly
} label: {
Text(remoteImagePolicyText(.friendsOnly))
}
Button {
self.remote_image_policy = .restricted
} label: {
Text(remoteImagePolicyText(.restricted))
}
} label: {
Text("\(remoteImagePolicyText(remote_image_policy))")
.frame(maxWidth: .infinity, alignment: .leading)
}
}
if state.is_privkey_user {
Section(NSLocalizedString("Delete", comment: "Section title for deleting the user")) {
Button(NSLocalizedString("Delete Account", comment: "Button to delete the user's account."), role: .destructive) {

View File

@@ -42,7 +42,7 @@ struct DMChatView: View {
let profile_page = ProfileView(damus_state: damus_state, profile: pmodel, followers: fmodel)
return NavigationLink(destination: profile_page) {
HStack {
ProfilePicView(pubkey: pubkey, size: 24, highlight: .none, profiles: damus_state.profiles, contacts:damus_state.contacts)
ProfilePicView(pubkey: pubkey, size: 24, highlight: .none, profiles: damus_state.profiles)
ProfileName(pubkey: pubkey, profile: profile, damus: damus_state, show_friend_confirmed: true)
}

View File

@@ -120,7 +120,7 @@ struct EditMetadataView: View {
let pfp_size: CGFloat = 90.0
HStack(alignment: .center) {
ProfilePicView(pubkey: damus_state.pubkey, size: pfp_size, highlight: .custom(imageBorderColor(), 4.0), profiles: damus_state.profiles, contacts: damus_state.contacts)
ProfilePicView(pubkey: damus_state.pubkey, size: pfp_size, highlight: .custom(imageBorderColor(), 4.0), profiles: damus_state.profiles)
.offset(y: -(pfp_size/2.0)) // Increase if set a frame
Spacer()

View File

@@ -98,18 +98,12 @@ func should_show_images(contacts: Contacts, ev: NostrEvent, our_pubkey: String,
if ev.pubkey == our_pubkey {
return true
}
let remote_image_policy: RemoteImagePolicy = RemoteImagePolicy(rawValue: UserDefaults.standard.string(forKey: "remote_image_policy") ?? "") ?? .friendsOfFriends
if remote_image_policy == .everyone ||
remote_image_policy == .friendsOnly && contacts.is_friend(ev.pubkey) ||
remote_image_policy == .friendsOfFriends && contacts.is_in_friendosphere(ev.pubkey) {
if contacts.is_in_friendosphere(ev.pubkey) {
return true
}
if let boost_key = booster_pubkey, contacts.is_in_friendosphere(boost_key) && remote_image_policy != .restricted {
if let boost_key = booster_pubkey, contacts.is_in_friendosphere(boost_key) {
return true
}
return false
}

View File

@@ -35,7 +35,7 @@ struct EventProfile: View {
let pv = ProfileView(damus_state: damus_state, profile: pmodel, followers: FollowersModel(damus_state: damus_state, target: pubkey))
NavigationLink(destination: pv) {
ProfilePicView(pubkey: pubkey, size: pfp_size, highlight: .none, profiles: damus_state.profiles, contacts: damus_state.contacts)
ProfilePicView(pubkey: pubkey, size: pfp_size, highlight: .none, profiles: damus_state.profiles)
}
}

View File

@@ -25,11 +25,11 @@ struct MutedEventView: View {
self.selected = selected
self._nav_target = nav_target
self._navigating = navigating
self._shown = State(initialValue: !should_hide_event(contacts: damus_state.contacts, ev: event))
self._shown = State(initialValue: should_show_event(contacts: damus_state.contacts, ev: event))
}
var should_mute: Bool {
return should_hide_event(contacts: damus_state.contacts, ev: event)
return !should_show_event(contacts: damus_state.contacts, ev: event)
}
var FillColor: Color {

View File

@@ -17,13 +17,13 @@ struct TextEvent: View {
var body: some View {
HStack(alignment: .top) {
let profile = damus.profiles.lookup(id: pubkey)
VStack {
let pmodel = ProfileModel(pubkey: pubkey, damus: damus)
let pv = ProfileView(damus_state: damus, profile: pmodel, followers: FollowersModel(damus_state: damus, target: pubkey))
NavigationLink(destination: pv) {
ProfilePicView(pubkey: pubkey, size: PFP_SIZE, highlight: .none, profiles: damus.profiles, contacts: damus.contacts)
ProfilePicView(pubkey: pubkey, size: PFP_SIZE, highlight: .none, profiles: damus.profiles)
}
Spacer()

View File

@@ -65,7 +65,7 @@ struct NoteContentView: View {
var body: some View {
MainContent()
.onAppear() {
self.artifacts = render_note_content(ev: event, profiles: damus_state.profiles, privkey: damus_state.keypair.privkey, show_images: show_images)
self.artifacts = render_note_content(ev: event, profiles: damus_state.profiles, privkey: damus_state.keypair.privkey)
}
.onReceive(handle_notify(.profile_updated)) { notif in
let profile = notif.object as! ProfileUpdate
@@ -74,7 +74,7 @@ struct NoteContentView: View {
switch block {
case .mention(let m):
if m.type == .pubkey && m.ref.ref_id == profile.pubkey {
self.artifacts = render_note_content(ev: event, profiles: damus_state.profiles, privkey: damus_state.keypair.privkey, show_images: show_images)
self.artifacts = render_note_content(ev: event, profiles: damus_state.profiles, privkey: damus_state.keypair.privkey)
}
case .text: return
case .hashtag: return
@@ -261,12 +261,12 @@ struct NoteArtifacts {
}
}
func render_note_content(ev: NostrEvent, profiles: Profiles, privkey: String?, show_images: Bool) -> NoteArtifacts {
func render_note_content(ev: NostrEvent, profiles: Profiles, privkey: String?) -> NoteArtifacts {
let blocks = ev.blocks(privkey)
return render_blocks(blocks: blocks, profiles: profiles, privkey: privkey, show_images: show_images)
return render_blocks(blocks: blocks, profiles: profiles, privkey: privkey)
}
func render_blocks(blocks: [Block], profiles: Profiles, privkey: String?, show_images: Bool) -> NoteArtifacts {
func render_blocks(blocks: [Block], profiles: Profiles, privkey: String?) -> NoteArtifacts {
var invoices: [Invoice] = []
var img_urls: [URL] = []
var link_urls: [URL] = []
@@ -283,7 +283,7 @@ func render_blocks(blocks: [Block], profiles: Profiles, privkey: String?, show_i
return str
case .url(let url):
// Handle Image URLs
if show_images && is_image_url(url) {
if is_image_url(url) {
// Append Image
img_urls.append(url)
return str

View File

@@ -39,7 +39,7 @@ struct ParticipantsView: View {
ForEach(originalReferences.pRefs) { participant in
let pubkey = participant.id
HStack {
ProfilePicView(pubkey: pubkey, size: PFP_SIZE, highlight: .none, profiles: damus_state.profiles, contacts: damus_state.contacts)
ProfilePicView(pubkey: pubkey, size: PFP_SIZE, highlight: .none, profiles: damus_state.profiles)
VStack(alignment: .leading) {
let profile = damus_state.profiles.lookup(id: pubkey)

View File

@@ -98,21 +98,19 @@ struct ProfilePicView: View {
let size: CGFloat
let highlight: Highlight
let profiles: Profiles
let contacts: Contacts
@State var picture: String?
init (pubkey: String, size: CGFloat, highlight: Highlight, profiles: Profiles, contacts: Contacts, picture: String? = nil) {
init (pubkey: String, size: CGFloat, highlight: Highlight, profiles: Profiles, picture: String? = nil) {
self.pubkey = pubkey
self.profiles = profiles
self.contacts = contacts
self.size = size
self.highlight = highlight
self._picture = State(initialValue: picture)
}
var body: some View {
InnerProfilePicView(url: get_profile_url(picture: picture, pubkey: pubkey, profiles: profiles, contacts: contacts), fallbackUrl: URL(string: robohash(pubkey)), pubkey: pubkey, size: size, highlight: highlight)
InnerProfilePicView(url: get_profile_url(picture: picture, pubkey: pubkey, profiles: profiles), fallbackUrl: URL(string: robohash(pubkey)), pubkey: pubkey, size: size, highlight: highlight)
.onReceive(handle_notify(.profile_updated)) { notif in
let updated = notif.object as! ProfileUpdate
@@ -127,19 +125,8 @@ struct ProfilePicView: View {
}
}
func get_profile_url(picture: String?, pubkey: String, profiles: Profiles, contacts: Contacts) -> URL {
var pic: String
let remote_image_policy: RemoteImagePolicy = RemoteImagePolicy(rawValue: UserDefaults.standard.string(forKey: "remote_image_policy") ?? "") ?? .friendsOfFriends
if pubkey == contacts.our_pubkey ||
remote_image_policy == .everyone ||
remote_image_policy == .friendsOnly && contacts.is_friend(pubkey) ||
remote_image_policy == .friendsOfFriends && contacts.is_in_friendosphere(pubkey) {
pic = picture ?? profiles.lookup(id: pubkey)?.picture ?? robohash(pubkey)
} else {
pic = robohash(pubkey)
}
func get_profile_url(picture: String?, pubkey: String, profiles: Profiles) -> URL {
let pic = picture ?? profiles.lookup(id: pubkey)?.picture ?? robohash(pubkey)
if let url = URL(string: pic) {
return url
}
@@ -163,8 +150,7 @@ struct ProfilePicView_Previews: PreviewProvider {
pubkey: pubkey,
size: 100,
highlight: .none,
profiles: make_preview_profiles(pubkey),
contacts: Contacts(our_pubkey: pubkey))
profiles: make_preview_profiles(pubkey))
}
}

View File

@@ -13,7 +13,7 @@ struct ProfilePictureSelector: View {
var body: some View {
let highlight: Highlight = .custom(Color.white, 2.0)
ZStack {
ProfilePicView(pubkey: pubkey, size: 80.0, highlight: highlight, profiles: Profiles(), contacts: Contacts(our_pubkey: pubkey))
ProfilePicView(pubkey: pubkey, size: 80.0, highlight: highlight, profiles: Profiles())
}
}
}

View File

@@ -255,12 +255,12 @@ struct ProfileView: View {
let pfp_size: CGFloat = 90.0
HStack(alignment: .center) {
ProfilePicView(pubkey: profile.pubkey, size: pfp_size, highlight: .custom(imageBorderColor(), 4.0), profiles: damus_state.profiles, contacts: damus_state.contacts)
ProfilePicView(pubkey: profile.pubkey, size: pfp_size, highlight: .custom(imageBorderColor(), 4.0), profiles: damus_state.profiles)
.onTapGesture {
is_zoomed.toggle()
}
.fullScreenCover(isPresented: $is_zoomed) {
ProfileZoomView(pubkey: profile.pubkey, profiles: damus_state.profiles, contacts: damus_state.contacts)}
ProfileZoomView(pubkey: profile.pubkey, profiles: damus_state.profiles) }
.offset(y: -(pfp_size/2.0)) // Increase if set a frame
Spacer()
@@ -333,10 +333,19 @@ struct ProfileView: View {
}
if let relays = profile.relays {
NavigationLink(destination: UserRelaysView(state: damus_state, pubkey: profile.pubkey, relays: Array(relays.keys).sorted())) {
Text("\(Text("\(relays.keys.count)", comment: "Number of relay servers a user is connected.").font(.subheadline.weight(.medium))) \(Text(String(format: NSLocalizedString("relays_count", comment: "Part of a larger sentence to describe how many relay servers a user is connected."), relays.keys.count)).font(.subheadline).foregroundColor(.gray))", comment: "Sentence composed of 2 variables to describe how many relay servers a user is connected. In source English, the first variable is the number of relay servers, and the second variable is 'Relay' or 'Relays'.")
// Only open relay config view if the user is logged in with private key and they are looking at their own profile.
let relay_text = Text("\(Text("\(relays.keys.count)", comment: "Number of relay servers a user is connected.").font(.subheadline.weight(.medium))) \(Text(String(format: NSLocalizedString("relays_count", comment: "Part of a larger sentence to describe how many relay servers a user is connected."), relays.keys.count)).font(.subheadline).foregroundColor(.gray))", comment: "Sentence composed of 2 variables to describe how many relay servers a user is connected. In source English, the first variable is the number of relay servers, and the second variable is 'Relay' or 'Relays'.")
if profile.pubkey == damus_state.pubkey && damus_state.is_privkey_user {
NavigationLink(destination: RelayConfigView(state: damus_state)) {
relay_text
}
.buttonStyle(PlainButtonStyle())
} else {
NavigationLink(destination: UserRelaysView(state: damus_state, pubkey: profile.pubkey, relays: Array(relays.keys).sorted())) {
relay_text
}
.buttonStyle(PlainButtonStyle())
}
.buttonStyle(PlainButtonStyle())
}
}
}

View File

@@ -11,7 +11,6 @@ struct ProfileZoomView: View {
@Environment(\.presentationMode) var presentationMode
let pubkey: String
let profiles: Profiles
let contacts: Contacts
@GestureState private var scaleState: CGFloat = 1
@GestureState private var offsetState = CGSize.zero
@@ -69,7 +68,7 @@ struct ProfileZoomView: View {
Spacer()
ProfilePicView(pubkey: pubkey, size: 200.0, highlight: .none, profiles: profiles, contacts: contacts)
ProfilePicView(pubkey: pubkey, size: 200.0, highlight: .none, profiles: profiles)
.padding(100)
.scaledToFit()
.scaleEffect(self.scale * scaleState)
@@ -93,8 +92,6 @@ struct ProfileZoomView_Previews: PreviewProvider {
static var previews: some View {
ProfileZoomView(
pubkey: pubkey,
profiles: make_preview_profiles(pubkey),
contacts: Contacts(our_pubkey: pubkey)
)
profiles: make_preview_profiles(pubkey))
}
}

View File

@@ -42,7 +42,7 @@ struct QRCodeView: View {
let profile = damus_state.profiles.lookup(id: damus_state.pubkey)
if (damus_state.profiles.lookup(id: damus_state.pubkey)?.picture) != nil {
ProfilePicView(pubkey: damus_state.pubkey, size: 90.0, highlight: .custom(Color("DamusWhite"), 4.0), profiles: damus_state.profiles, contacts: damus_state.contacts)
ProfilePicView(pubkey: damus_state.pubkey, size: 90.0, highlight: .custom(Color("DamusWhite"), 4.0), profiles: damus_state.profiles)
.padding(.top, 50)
} else {
Image(systemName: "person.fill")

View File

@@ -35,7 +35,7 @@ struct SearchResultsView: View {
}
}
case .hashtag(let ht):
let search_model = SearchModel(pool: damus_state.pool, search: .filter_hashtag([ht]))
let search_model = SearchModel(contacts: damus_state.contacts, pool: damus_state.pool, search: .filter_hashtag([ht]))
let dst = SearchView(appstate: damus_state, search: search_model)
NavigationLink(destination: dst) {
Text("Search hashtag: #\(ht)", comment: "Navigation link to search hashtag.")

View File

@@ -25,6 +25,9 @@ struct SearchView: View {
.onDisappear() {
search.unsubscribe()
}
.onReceive(handle_notify(.new_mutes)) { notif in
search.filter_muted()
}
}
}
@@ -43,7 +46,7 @@ struct SearchView_Previews: PreviewProvider {
let filter = NostrFilter.filter_hashtag(["bitcoin"])
let pool = test_state.pool
let model = SearchModel(pool: pool, search: filter)
let model = SearchModel(contacts: test_state.contacts, pool: pool, search: filter)
SearchView(appstate: test_state, search: model)
}

View File

@@ -55,7 +55,7 @@ struct SideMenuView: View {
NavigationLink(destination: ProfileView(damus_state: damus_state, profile: profile_model, followers: followers)) {
if let picture = damus_state.profiles.lookup(id: damus_state.pubkey)?.picture {
ProfilePicView(pubkey: damus_state.pubkey, size: 60, highlight: .none, profiles: damus_state.profiles, contacts: damus_state.contacts, picture: picture)
ProfilePicView(pubkey: damus_state.pubkey, size: 60, highlight: .none, profiles: damus_state.profiles, picture: picture)
} else {
Image(systemName: "person.fill")
}