Add scroll queue detection in notification view

This will stop injecting events into the timeline if you're scrolling
This commit is contained in:
William Casarin
2023-02-26 14:14:25 -08:00
parent 75fd8de456
commit 4b5c217213
4 changed files with 33 additions and 14 deletions

View File

@@ -8,12 +8,16 @@
import Foundation
/// Used for holding back events until they're ready to be displayed
class EventHolder: ObservableObject {
class EventHolder: ObservableObject, ScrollQueue {
private var has_event: Set<String>
@Published var events: [NostrEvent]
@Published var incoming: [NostrEvent]
var should_queue: Bool
func set_should_queue(_ val: Bool) {
self.should_queue = val
}
var queued: Int {
return incoming.count
}