Browse Source

lazy vstack ftw

Signed-off-by: William Casarin <jb55@jb55.com>
profiles-everywhere
William Casarin 3 years ago
parent
commit
b100e9887b
  1. 2
      damus/ContentView.swift
  2. 1
      damus/Views/EventDetailView.swift
  3. 18
      damus/Views/TimelineView.swift

2
damus/ContentView.swift

@ -443,7 +443,7 @@ func get_metadata_since_time(_ metadata_event: NostrEvent?) -> Int64? {
func get_since_time(last_event: NostrEvent?) -> Int64 { func get_since_time(last_event: NostrEvent?) -> Int64 {
if last_event == nil { if last_event == nil {
return Int64(Date().timeIntervalSince1970) - (24 * 60 * 60 * 1) return Int64(Date().timeIntervalSince1970) - (24 * 60 * 60 * 3)
} }
return last_event!.created_at - 60 * 10 return last_event!.created_at - 60 * 10

1
damus/Views/EventDetailView.swift

@ -175,7 +175,6 @@ struct EventDetailView: View {
.onAppear() { .onAppear() {
self.add_event(event) self.add_event(event)
subscribe_to_thread() subscribe_to_thread()
} }
} }

18
damus/Views/TimelineView.swift

@ -15,15 +15,17 @@ struct TimelineView: View {
var body: some View { var body: some View {
ScrollView { ScrollView {
ForEach(events, id: \.id) { (ev: NostrEvent) in LazyVStack {
let evdet = EventDetailView(event: ev, pool: pool) ForEach(events, id: \.id) { (ev: NostrEvent) in
.navigationBarTitle("Thread") let evdet = EventDetailView(event: ev, pool: pool)
.padding([.leading, .trailing], 6) .navigationBarTitle("Thread")
.environmentObject(profiles) .padding([.leading, .trailing], 6)
NavigationLink(destination: evdet) { .environmentObject(profiles)
EventView(event: ev, highlight: .none, has_action_bar: true) NavigationLink(destination: evdet) {
EventView(event: ev, highlight: .none, has_action_bar: true)
}
.buttonStyle(PlainButtonStyle())
} }
.buttonStyle(PlainButtonStyle())
} }
} }
.padding([.leading, .trailing], 6) .padding([.leading, .trailing], 6)

Loading…
Cancel
Save