diff --git a/AutoCat.xcodeproj/xcuserdata/selim.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/AutoCat.xcodeproj/xcuserdata/selim.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
index 2358118..cc526ef 100644
--- a/AutoCat.xcodeproj/xcuserdata/selim.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
+++ b/AutoCat.xcodeproj/xcuserdata/selim.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
@@ -40,5 +40,53 @@
landmarkType = "7">
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/AutoCat/Base.lproj/Main.storyboard b/AutoCat/Base.lproj/Main.storyboard
index f09052e..2a94106 100644
--- a/AutoCat/Base.lproj/Main.storyboard
+++ b/AutoCat/Base.lproj/Main.storyboard
@@ -178,7 +178,7 @@
-
+
@@ -193,7 +193,7 @@
-
+
@@ -288,7 +288,7 @@
-
+
@@ -550,7 +550,7 @@
-
+
@@ -595,6 +595,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/AutoCat/Controllers/CheckController.swift b/AutoCat/Controllers/CheckController.swift
index b67e949..5bebb06 100644
--- a/AutoCat/Controllers/CheckController.swift
+++ b/AutoCat/Controllers/CheckController.swift
@@ -92,7 +92,7 @@ class CheckController: UIViewController, MaskedTextFieldDelegateListener, UITabl
.subscribe(onNext: onReceivedVehicle(_:), onError: { err in
if let realm = try? Realm() {
try? realm.write {
- realm.add(Vehicle(numberNormalized), update: .modified)
+ realm.add(Vehicle(numberNormalized), update: .all)
}
}
IHProgressHUD.showError(withStatus: err.localizedDescription)
@@ -114,7 +114,7 @@ class CheckController: UIViewController, MaskedTextFieldDelegateListener, UITabl
func onReceivedVehicle(_ vehicle: Vehicle) {
if let realm = try? Realm() {
try? realm.write {
- realm.add(vehicle, update: .modified)
+ realm.add(vehicle, update: .all)
}
}
@@ -125,16 +125,18 @@ class CheckController: UIViewController, MaskedTextFieldDelegateListener, UITabl
func updateDetailController(with vehicle: Vehicle) {
if let splitViewController = self.view.window?.rootViewController as? UISplitViewController
{
- var detail: ReportController?
+ var detail: UINavigationController?
if splitViewController.viewControllers.count == 2 {
- detail = splitViewController.viewControllers.last as? ReportController
+ detail = splitViewController.viewControllers.last as? UINavigationController
} else {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
- detail = storyboard.instantiateViewController(identifier: "ReportController")
+ detail = storyboard.instantiateViewController(identifier: "ReportNavController")
}
if let detail = detail {
- detail.vehicle = vehicle
+ detail.popToRootViewController(animated: true)
+ let report = detail.viewControllers.first as? ReportController
+ report?.vehicle = vehicle
splitViewController.showDetailViewController(detail, sender: self)
//self.performSegue(withIdentifier: "OpenDetailSegue", sender: self)
}
diff --git a/AutoCat/Controllers/MainSplitController.swift b/AutoCat/Controllers/MainSplitController.swift
index 7bea3ab..0297003 100644
--- a/AutoCat/Controllers/MainSplitController.swift
+++ b/AutoCat/Controllers/MainSplitController.swift
@@ -31,8 +31,12 @@ class MainSplitController: UISplitViewController, UISplitViewControllerDelegate
let tabController = splitViewController.viewControllers.first as? UITabBarController
let selectedNavController = tabController?.selectedViewController as? UINavigationController
- if selectedNavController?.topViewController is ReportController {
- return selectedNavController?.popViewController(animated: false)
+ if selectedNavController?.viewControllers[1] is ReportController {
+ if let controllers = selectedNavController?.popToRootViewController(animated: false) {
+ let nav = UINavigationController()
+ nav.setViewControllers(controllers, animated: true)
+ return nav
+ }
}
return nil
@@ -40,7 +44,12 @@ class MainSplitController: UISplitViewController, UISplitViewControllerDelegate
func splitViewController(_ splitViewController: UISplitViewController, collapseSecondary secondaryViewController: UIViewController, onto primaryViewController: UIViewController) -> Bool
{
- guard let detail = secondaryViewController as? ReportController else { return false }
+ guard let detailNav = secondaryViewController as? UINavigationController,
+ let detail = detailNav.viewControllers.first as? ReportController
+ else
+ {
+ return false
+ }
if detail.vehicle == nil {
return false
diff --git a/AutoCat/Controllers/OwnersController.swift b/AutoCat/Controllers/OwnersController.swift
index 3efa15a..0f98e84 100644
--- a/AutoCat/Controllers/OwnersController.swift
+++ b/AutoCat/Controllers/OwnersController.swift
@@ -37,4 +37,9 @@ class OwnersController: FormViewController {
}
}
}
+
+ override func viewWillAppear(_ animated: Bool) {
+ super.viewWillAppear(animated)
+ self.navigationController?.setNavigationBarHidden(false, animated: animated)
+ }
}
diff --git a/AutoCat/Controllers/SearchController.swift b/AutoCat/Controllers/SearchController.swift
index 0cbb72d..24c69f2 100644
--- a/AutoCat/Controllers/SearchController.swift
+++ b/AutoCat/Controllers/SearchController.swift
@@ -54,16 +54,18 @@ class SearchController: UIViewController, UISearchResultsUpdating {
func updateDetailController(with vehicle: Vehicle) {
if let splitViewController = self.view.window?.rootViewController as? UISplitViewController
{
- var detail: ReportController?
+ var detail: UINavigationController?
if splitViewController.viewControllers.count == 2 {
- detail = splitViewController.viewControllers.last as? ReportController
+ detail = splitViewController.viewControllers.last as? UINavigationController
} else {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
- detail = storyboard.instantiateViewController(identifier: "ReportController")
+ detail = storyboard.instantiateViewController(identifier: "ReportNavController")
}
if let detail = detail {
- detail.vehicle = vehicle
+ detail.popToRootViewController(animated: true)
+ let report = detail.viewControllers.first as? ReportController
+ report?.vehicle = vehicle
splitViewController.showDetailViewController(detail, sender: self)
//self.performSegue(withIdentifier: "OpenDetailSegue", sender: self)
}
diff --git a/AutoCat/ThirdParty/Api.swift b/AutoCat/ThirdParty/Api.swift
index 5a7ded9..078bf3d 100644
--- a/AutoCat/ThirdParty/Api.swift
+++ b/AutoCat/ThirdParty/Api.swift
@@ -7,7 +7,7 @@ class Api {
}
private static func createRequest(api: String, method: String, body: [String: T]? = nil) -> URLRequest? where T: LosslessStringConvertible {
- guard var urlComponents = URLComponents(string: Constants.baseUrl + api) else { return nil }
+ guard var urlComponents = URLComponents(string: Constants.debugBaseUrl + api) else { return nil }
if let body = body, method.uppercased() == "GET" {
urlComponents.queryItems = body.map { URLQueryItem(name: $0, value: String($1)) }