Refactoring I.

- 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
This commit is contained in:
relikd
2020-06-02 21:45:08 +02:00
parent 10b43a0f67
commit b17fb3c354
36 changed files with 2214 additions and 1482 deletions

View File

@@ -14,16 +14,23 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
UserDefaults.standard.set(false, forKey: "kill_db")
SQLiteDatabase.destroyDatabase()
}
try? SQLiteDatabase.open().initScheme()
if let db = AppDB {
db.initCommonScheme()
db.initAppOnlyScheme()
}
DBWrp.initContentOfDB()
#if IOS_SIMULATOR
TestDataSource.load()
#endif
loadVPN { mgr in
self.managerVPN = mgr
self.postVPNState()
}
NSNotification.Name.NEVPNStatusDidChange.observe(call: #selector(vpnStatusChanged(_:)), on: self)
NotifyDNSFilterChanged.observe(call: #selector(filterDidChange), on: self)
NotifyDNSFilterChanged.observe(call: #selector(didChangeDomainFilter), on: self)
sync.start()
return true
}
@@ -31,7 +38,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
postRawVPNState((notification.object as? NETunnelProviderSession)?.status ?? .invalid)
}
@objc private func filterDidChange() {
@objc private func didChangeDomainFilter() {
// Notify VPN extension about changes
if let session = self.managerVPN?.connection as? NETunnelProviderSession,
session.status == .connected {