diff --git a/AutoCat.xcodeproj/project.pbxproj b/AutoCat.xcodeproj/project.pbxproj index 674331a..811cc67 100644 --- a/AutoCat.xcodeproj/project.pbxproj +++ b/AutoCat.xcodeproj/project.pbxproj @@ -1080,7 +1080,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 83; + CURRENT_PROJECT_VERSION = 86; DEVELOPMENT_TEAM = 46DTTB8X4S; INFOPLIST_FILE = AutoCat/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; @@ -1105,7 +1105,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 83; + CURRENT_PROJECT_VERSION = 86; DEVELOPMENT_TEAM = 46DTTB8X4S; INFOPLIST_FILE = AutoCat/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; diff --git a/AutoCat/Controllers/CheckController.swift b/AutoCat/Controllers/CheckController.swift index 2210999..a08ee0f 100644 --- a/AutoCat/Controllers/CheckController.swift +++ b/AutoCat/Controllers/CheckController.swift @@ -213,8 +213,18 @@ class CheckController: UIViewController, UITableViewDelegate, UITextFieldDelegat self.number.text = nil self.check.isEnabled = false + var events: [VehicleEvent] = [] + do { + let realm = try Realm() + if let dbVehicle = realm.object(ofType: Vehicle.self, forPrimaryKey: numberNormalized), dbVehicle.unrecognized { + events.append(contentsOf: dbVehicle.events) + } + } catch { + print(error) + } + HUD.show(.progress) - self.check(number: numberNormalized, action: .receiveAndSend, notes: [], events: []).subscribe { (vehicle, errors) in + self.check(number: numberNormalized, action: .receiveAndSend, notes: [], events: events).subscribe { (vehicle, errors) in if !vehicle.unrecognized { self.updateDetailController(with: vehicle) } diff --git a/AutoCat/Extensions/MapExt.swift b/AutoCat/Extensions/MapExt.swift index bf57821..6ea76e9 100644 --- a/AutoCat/Extensions/MapExt.swift +++ b/AutoCat/Extensions/MapExt.swift @@ -19,7 +19,13 @@ extension MKMapView { diagonal = 1000 } - let region = MKCoordinateRegion(center: center, latitudinalMeters: diagonal, longitudinalMeters: diagonal) + var region = MKCoordinateRegion(center: center, latitudinalMeters: diagonal, longitudinalMeters: diagonal) + + if region.span.latitudeDelta > 180 || region.span.longitudeDelta > 360 { + region = MKCoordinateRegion(center: .init(latitude: 0, longitude: 0), + span: .init(latitudeDelta: 180, longitudeDelta: 360)) + } + self.setRegion(region, animated: true) } }