- Revamp whole DB to Display flow - Filter Pipeline, arbitrary filtering and sorting - Binary tree arrays for faster lookup & manipulation - DB: introducing custom functions - DB scheme: split req into heap & cache - cache written by GlassVPN only - heap written by Main App only - Introducing DB separation: DBCore, DBCommon, DBAppOnly - Introducing DB data sources: TestDataSource, GroupedDomainDataSource, RecordingsDB, DomainFilter - Background sync: Move entries from cache to heap and notify all observers - GlassVPN: Binary tree filter lookup - GlassVPN: Reusing prepared statement
28 lines
1.4 KiB
Swift
28 lines
1.4 KiB
Swift
import Foundation
|
|
|
|
let NotifyVPNStateChanged = NSNotification.Name("GlassVPNStateChanged") // VPNState!
|
|
let NotifyDNSFilterChanged = NSNotification.Name("PSIDNSFilterSettingsChanged") // domain: String?
|
|
let NotifyDateFilterChanged = NSNotification.Name("PSIDateFilterSettingsChanged") // nil!
|
|
let NotifyLogHistoryReset = NSNotification.Name("PSILogHistoryReset") // domain: String?
|
|
let NotifySyncInsert = NSNotification.Name("PSISyncInsert") // SQLiteRowRange!
|
|
let NotifySyncRemove = NSNotification.Name("PSISyncRemove") // SQLiteRowRange!
|
|
let NotifyRecordingChanged = NSNotification.Name("PSIRecordingChanged") // (Recording, deleted: Bool)!
|
|
|
|
|
|
extension NSNotification.Name {
|
|
func post(_ obj: Any? = nil) {
|
|
NotificationCenter.default.post(name: self, object: obj)
|
|
}
|
|
func postAsyncMain(_ obj: Any? = nil) {
|
|
DispatchQueue.main.async { NotificationCenter.default.post(name: self, object: obj) }
|
|
}
|
|
/// You are responsible for removing the returned object in a `deinit` block.
|
|
// @discardableResult func observe(queue: OperationQueue? = nil, using block: @escaping (Notification) -> Void) -> NSObjectProtocol {
|
|
// NotificationCenter.default.addObserver(forName: self, object: nil, queue: queue, using: block)
|
|
// }
|
|
/// On iOS 9.0+ you don't need to unregister the observer.
|
|
func observe(call: Selector, on target: Any, obj: Any? = nil) {
|
|
NotificationCenter.default.addObserver(target, selector: call, name: self, object: obj)
|
|
}
|
|
}
|