@@ -332,11 +332,10 @@ struct ContentView: View {
|
||||
|
||||
add_relay(pool, "wss://relay.damus.io")
|
||||
add_relay(pool, "wss://nostr-pub.wellorder.net")
|
||||
add_relay(pool, "wss://nostr.onsats.org")
|
||||
add_relay(pool, "wss://nostr.bitcoiner.social")
|
||||
//add_relay(pool, "wss://nostr.bitcoiner.social")
|
||||
add_relay(pool, "ws://monad.jb55.com:8080")
|
||||
add_relay(pool, "wss://nostr-relay.freeberty.net")
|
||||
add_relay(pool, "wss://nostr-relay.untethr.me")
|
||||
//add_relay(pool, "wss://nostr-relay.freeberty.net")
|
||||
//add_relay(pool, "wss://nostr-relay.untethr.me")
|
||||
|
||||
pool.register_handler(sub_id: sub_id, handler: home.handle_event)
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ class SearchHomeModel: ObservableObject {
|
||||
@Published var events: [NostrEvent] = []
|
||||
let pool: RelayPool
|
||||
let sub_id = UUID().description
|
||||
let limit: UInt32 = 1000
|
||||
let limit: UInt32 = 250
|
||||
|
||||
init(pool: RelayPool) {
|
||||
self.pool = pool
|
||||
@@ -44,9 +44,6 @@ class SearchHomeModel: ObservableObject {
|
||||
guard sub_id == self.sub_id else {
|
||||
return
|
||||
}
|
||||
guard self.events.count <= limit else {
|
||||
return
|
||||
}
|
||||
if ev.kind == NostrKind.text.rawValue {
|
||||
let _ = insert_uniq_sorted_event(events: &events, new_ev: ev) {
|
||||
$0.created_at > $1.created_at
|
||||
|
||||
@@ -84,12 +84,12 @@ struct ProfileView: View {
|
||||
|
||||
Text(data?.about ?? "")
|
||||
|
||||
if let contact = profile.contacts {
|
||||
Divider()
|
||||
Divider()
|
||||
|
||||
let contacts = contact.referenced_pubkeys.map { $0.ref_id }
|
||||
let following_model = FollowingModel(damus_state: damus_state, contacts: contacts)
|
||||
HStack {
|
||||
HStack {
|
||||
if let contact = profile.contacts {
|
||||
let contacts = contact.referenced_pubkeys.map { $0.ref_id }
|
||||
let following_model = FollowingModel(damus_state: damus_state, contacts: contacts)
|
||||
NavigationLink(destination: FollowingView(damus_state: damus_state, following: following_model, whos: profile.pubkey)) {
|
||||
HStack {
|
||||
Text("\(profile.following)")
|
||||
@@ -98,18 +98,17 @@ struct ProfileView: View {
|
||||
}
|
||||
}
|
||||
.buttonStyle(PlainButtonStyle())
|
||||
|
||||
let fview = FollowersView(damus_state: damus_state, whos: profile.pubkey)
|
||||
.environmentObject(followers)
|
||||
NavigationLink(destination: fview) {
|
||||
HStack {
|
||||
Text("\(followers.contacts.count)")
|
||||
Text("Followers")
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
}
|
||||
.buttonStyle(PlainButtonStyle())
|
||||
}
|
||||
let fview = FollowersView(damus_state: damus_state, whos: profile.pubkey)
|
||||
.environmentObject(followers)
|
||||
NavigationLink(destination: fview) {
|
||||
HStack {
|
||||
Text("\(followers.contacts.count)")
|
||||
Text("Followers")
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
}
|
||||
.buttonStyle(PlainButtonStyle())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,9 @@ struct SearchHomeView: View {
|
||||
|
||||
MainContent
|
||||
}
|
||||
.onChange(of: search) { s in
|
||||
print("search change 1")
|
||||
}
|
||||
.onAppear {
|
||||
model.subscribe()
|
||||
}
|
||||
|
||||
@@ -17,11 +17,12 @@ struct SearchResultsView: View {
|
||||
}
|
||||
|
||||
var MainContent: some View {
|
||||
VStack {
|
||||
ForEach(results, id: \.0) { prof in
|
||||
ProfileSearchResult(pk: prof.0, res: prof.1)
|
||||
ScrollView {
|
||||
LazyVStack {
|
||||
ForEach(results, id: \.0) { prof in
|
||||
ProfileSearchResult(pk: prof.0, res: prof.1)
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,9 +33,11 @@ struct SearchResultsView: View {
|
||||
let prof = els.element.value.profile
|
||||
let lowname = prof.name.map { $0.lowercased() }
|
||||
let lowdisp = prof.display_name.map { $0.lowercased() }
|
||||
let ok = new == pk || String(new.dropFirst()) == pk
|
||||
let ok = new.count == 1 ?
|
||||
((lowname?.starts(with: new) ?? false) ||
|
||||
(lowdisp?.starts(with: new) ?? false)) : (pk.starts(with: new) || String(new.dropFirst()) == pk
|
||||
|| lowname?.contains(new) ?? false
|
||||
|| lowdisp?.contains(new) ?? false
|
||||
|| lowdisp?.contains(new) ?? false)
|
||||
if ok {
|
||||
acc.append((pk, prof))
|
||||
}
|
||||
@@ -45,13 +48,19 @@ struct SearchResultsView: View {
|
||||
var body: some View {
|
||||
MainContent
|
||||
.frame(maxHeight: .infinity)
|
||||
.onChange(of: search) { new in search_changed(new) }
|
||||
.onAppear {
|
||||
search_changed(search)
|
||||
}
|
||||
.onChange(of: search) { new in
|
||||
search_changed(new)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
struct SearchResultsView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
let search = Binding<String>.init(get: { "jb55" }, set: { _ in })
|
||||
SearchResultsView(damus_state: test_damus_state(), search: search)
|
||||
SearchResultsView(damus_state: test_damus_state(), s)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user