Adding new "not updated" filter to history list
This commit is contained in:
parent
aa008d5443
commit
cbb1f30d31
@ -15,6 +15,7 @@ enum HistoryFilter {
|
||||
case all
|
||||
case unrecognized
|
||||
case outdated
|
||||
case notSynced
|
||||
}
|
||||
|
||||
extension String.StringInterpolation {
|
||||
@ -185,16 +186,22 @@ class CheckController: UIViewController, UITableViewDelegate, UISearchResultsUpd
|
||||
self.historyDataSource.setFilterPredicate { $0.outdated }
|
||||
self.historyFilter = .outdated
|
||||
}
|
||||
let notUpdated = UIAlertAction(title: NSLocalizedString("Not updated", comment: ""), style: .default) { _ in
|
||||
self.historyDataSource.setFilterPredicate { $0.needSync }
|
||||
self.historyFilter = .notSynced
|
||||
}
|
||||
|
||||
switch self.historyFilter {
|
||||
case .all: all.setValue(true, forKey: "checked")
|
||||
case .unrecognized: unrecognized.setValue(true, forKey: "checked")
|
||||
case .outdated: outdated.setValue(true, forKey: "checked")
|
||||
case .notSynced: notUpdated.setValue(true, forKey: "checked")
|
||||
}
|
||||
|
||||
sheet.addAction(all)
|
||||
sheet.addAction(unrecognized)
|
||||
sheet.addAction(outdated)
|
||||
sheet.addAction(notUpdated)
|
||||
sheet.addAction(cancel)
|
||||
sheet.popoverPresentationController?.barButtonItem = sender
|
||||
self.present(sheet, animated: true)
|
||||
@ -252,25 +259,25 @@ class CheckController: UIViewController, UITableViewDelegate, UISearchResultsUpd
|
||||
func updateDetailController(with vehicle: VehicleDto) {
|
||||
if let splitViewController = self.view.window?.rootViewController as? UISplitViewController
|
||||
{
|
||||
// var detail: UINavigationController?
|
||||
// if splitViewController.viewControllers.count == 2 {
|
||||
// detail = splitViewController.viewControllers.last as? UINavigationController
|
||||
// } else {
|
||||
// let storyboard = UIStoryboard(name: "Main", bundle: nil)
|
||||
// detail = storyboard.instantiateViewController(identifier: "ReportNavController")
|
||||
// }
|
||||
//
|
||||
// if let detail = detail {
|
||||
// detail.popToRootViewController(animated: true)
|
||||
// let report = detail.viewControllers.first as? ReportController
|
||||
// report?.number = vehicle.getNumber()
|
||||
// splitViewController.showDetailViewController(detail, sender: self)
|
||||
// }
|
||||
|
||||
Task {
|
||||
let coordinator = ReportCoordinator(splitController: splitViewController, vehicle: vehicle, isPersistent: true)
|
||||
try? await coordinator.start()
|
||||
var detail: UINavigationController?
|
||||
if splitViewController.viewControllers.count == 2 {
|
||||
detail = splitViewController.viewControllers.last as? UINavigationController
|
||||
} else {
|
||||
let storyboard = UIStoryboard(name: "Main", bundle: nil)
|
||||
detail = storyboard.instantiateViewController(identifier: "ReportNavController")
|
||||
}
|
||||
|
||||
if let detail = detail {
|
||||
detail.popToRootViewController(animated: true)
|
||||
let report = detail.viewControllers.first as? ReportController
|
||||
report?.number = vehicle.getNumber()
|
||||
splitViewController.showDetailViewController(detail, sender: self)
|
||||
}
|
||||
|
||||
// Task {
|
||||
// let coordinator = ReportCoordinator(splitController: splitViewController, vehicle: vehicle, isPersistent: true)
|
||||
// try? await coordinator.start()
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -413,3 +413,5 @@
|
||||
"ZIP (or OKTMO) code" = "Индекс (или ОКТМО)";
|
||||
|
||||
"Server" = "Сервер";
|
||||
|
||||
"Not updated" = "Не обновленные";
|
||||
|
||||
@ -176,4 +176,8 @@ extension VehicleDto {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
public var needSync: Bool {
|
||||
!synchronized && !unrecognized
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user