Refactoring II.
- Filter by date range - SyncUpdate tasks run fully asynchronous in background - Move tableView manipulations into FilterPipelineDelegate - Move SyncUpdate notification into SyncUpdateDelegate - Fix: sync cache before persisting a recording - Restructuring GroupedDomainDataSource - Performance: db logs queries use rowids instead of timestamps - Add 'now' button to DatePickerAlert
This commit is contained in:
@@ -2,23 +2,16 @@ import UIKit
|
||||
|
||||
class TVCFilter: UITableViewController, EditActionsRemove {
|
||||
var currentFilter: FilterOptions = .none // set by segue
|
||||
private var dataSource: [String] = []
|
||||
private lazy var dataSource = DomainFilter.list(where: currentFilter)
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
NotifyDNSFilterChanged.observe(call: #selector(didChangeDomainFilter), on: self)
|
||||
reloadDataSource()
|
||||
}
|
||||
|
||||
func reloadDataSource() {
|
||||
dataSource = DomainFilter.list(where: currentFilter)
|
||||
tableView.reloadData()
|
||||
}
|
||||
|
||||
@objc func didChangeDomainFilter(_ notification: Notification) {
|
||||
guard let domain = notification.object as? String else {
|
||||
reloadDataSource()
|
||||
return
|
||||
preconditionFailure("Domain independent filter reset not implemented")
|
||||
}
|
||||
if DomainFilter[domain]?.contains(currentFilter) ?? false {
|
||||
let i = dataSource.binTreeIndex(of: domain, compare: (<))!
|
||||
|
||||
@@ -42,10 +42,7 @@ class TVCSettings: UITableViewController {
|
||||
"You are about to delete all results that have been logged in the past. " +
|
||||
"Your preferences for blocked and ignored domains are preserved.\n" +
|
||||
"Continue?", buttonText: "Delete", buttonStyle: .destructive) { _ in
|
||||
DispatchQueue.global().async {
|
||||
try? AppDB?.dnsLogsDeleteAll()
|
||||
NotifyLogHistoryReset.postAsyncMain()
|
||||
}
|
||||
TheGreatDestroyer.deleteAllLogs()
|
||||
}.presentIn(self)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user