From 717138bb3e42e64c80c2a87a25e1e46c2447e354 Mon Sep 17 00:00:00 2001 From: Selim Mustafaev Date: Fri, 18 Sep 2020 11:53:00 +0300 Subject: [PATCH] Adding some new info to reports. Fixed bug with setting map region on iOS14 --- AutoCat.xcodeproj/project.pbxproj | 4 +- .../xcshareddata/swiftpm/Package.resolved | 20 +-- .../xcdebugger/Breakpoints_v2.xcbkptlist | 4 +- .../xcschemes/xcschememanagement.plist | 126 ++++++++++++++++++ .../Location/LocationPickerController.swift | 6 +- AutoCat/Extensions/VehicleReportImage.swift | 42 ++++++ AutoCat/Info.plist | 6 +- 7 files changed, 191 insertions(+), 17 deletions(-) diff --git a/AutoCat.xcodeproj/project.pbxproj b/AutoCat.xcodeproj/project.pbxproj index 79b69ce..7f9be28 100644 --- a/AutoCat.xcodeproj/project.pbxproj +++ b/AutoCat.xcodeproj/project.pbxproj @@ -763,7 +763,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 34; + CURRENT_PROJECT_VERSION = 35; DEVELOPMENT_TEAM = 46DTTB8X4S; INFOPLIST_FILE = AutoCat/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; @@ -785,7 +785,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 34; + CURRENT_PROJECT_VERSION = 35; DEVELOPMENT_TEAM = 46DTTB8X4S; INFOPLIST_FILE = AutoCat/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; diff --git a/AutoCat.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/AutoCat.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 0e7c99d..b4870ea 100644 --- a/AutoCat.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/AutoCat.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/xmartlabs/Eureka", "state": { "branch": null, - "revision": "9a30ae436ec9e9fcb8b3eb1bdfd95e95989d6ca5", - "version": "5.2.1" + "revision": "9fe153d2be663621d4f53196bf1b7effb83d7017", + "version": "5.3.0" } }, { @@ -24,8 +24,8 @@ "repositoryURL": "https://github.com/onevcat/Kingfisher", "state": { "branch": null, - "revision": "175eeb4618b0a6ef4d69a7409b6a74ddd235a093", - "version": "5.15.0" + "revision": "22b795dd57766fa0e86773d8733efb31dc0f31fb", + "version": "5.15.1" } }, { @@ -42,8 +42,8 @@ "repositoryURL": "https://github.com/realm/realm-cocoa", "state": { "branch": null, - "revision": "6310911a38d55003f0b8acca96635aa2bfc3e2c0", - "version": "5.4.0" + "revision": "f64ac045d8cb171d8e317d9b854df7215aed7466", + "version": "5.4.2" } }, { @@ -51,8 +51,8 @@ "repositoryURL": "https://github.com/realm/realm-core", "state": { "branch": null, - "revision": "34d7fbcbab2a94bcad081bddf9d172961cd84659", - "version": "6.0.25" + "revision": "e051fc73c56830bf3ab0b8a82f7a613968cec6c6", + "version": "6.0.26" } }, { @@ -87,8 +87,8 @@ "repositoryURL": "https://github.com/malcommac/SwiftDate.git", "state": { "branch": null, - "revision": "700dde1b3417fd4a7fd2bec9f5bc8ab2de1b96b4", - "version": "6.1.0" + "revision": "a25913b19833860b61fac161a706e44834f03c47", + "version": "6.2.0" } } ] diff --git a/AutoCat.xcodeproj/xcuserdata/selim.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/AutoCat.xcodeproj/xcuserdata/selim.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 737454d..02e91d7 100644 --- a/AutoCat.xcodeproj/xcuserdata/selim.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/AutoCat.xcodeproj/xcuserdata/selim.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -8,7 +8,7 @@ BreakpointExtensionID = "Xcode.Breakpoint.SwiftErrorBreakpoint"> @@ -17,7 +17,7 @@ BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint"> orderHint 0 + Eureka (Playground) 1.xcscheme + + isShown + + orderHint + 9 + + Eureka (Playground) 2.xcscheme + + isShown + + orderHint + 10 + + Eureka (Playground).xcscheme + + isShown + + orderHint + 2 + + GettingStarted (Playground) 1.xcscheme + + isShown + + orderHint + 11 + + GettingStarted (Playground) 2.xcscheme + + isShown + + orderHint + 12 + + GettingStarted (Playground) 3.xcscheme + + isShown + + orderHint + 13 + + GettingStarted (Playground) 4.xcscheme + + isShown + + orderHint + 14 + + GettingStarted (Playground) 5.xcscheme + + isShown + + orderHint + 15 + + GettingStarted (Playground).xcscheme + + isShown + + orderHint + 5 + + Rx (Playground) 1.xcscheme + + isShown + + orderHint + 3 + + Rx (Playground) 2.xcscheme + + isShown + + orderHint + 4 + + Rx (Playground).xcscheme + + isShown + + orderHint + 1 + + SwiftDate (Playground) 1.xcscheme + + isShown + + orderHint + 7 + + SwiftDate (Playground) 2.xcscheme + + isShown + + orderHint + 8 + + SwiftDate (Playground) 3.xcscheme + + isShown + + orderHint + 16 + + SwiftDate (Playground) 4.xcscheme + + isShown + + orderHint + 17 + + SwiftDate (Playground) 5.xcscheme + + isShown + + orderHint + 18 + + SwiftDate (Playground).xcscheme + + isShown + + orderHint + 6 + diff --git a/AutoCat/Controllers/Location/LocationPickerController.swift b/AutoCat/Controllers/Location/LocationPickerController.swift index 5c0150f..78dfdae 100644 --- a/AutoCat/Controllers/Location/LocationPickerController.swift +++ b/AutoCat/Controllers/Location/LocationPickerController.swift @@ -149,8 +149,12 @@ public class LocationPickerController : UIViewController, TypedRowControllerType } public func mapView(_ mapView: MKMapView, didUpdate userLocation: MKUserLocation) { - mapView.showsUserLocation = false let region = MKCoordinateRegion(center: userLocation.coordinate, latitudinalMeters: 1000, longitudinalMeters: 1000) mapView.setRegion(region, animated: true) + mapView.showsUserLocation = false + } + + public func mapView(_ mapView: MKMapView, didFailToLocateUserWithError error: Error) { + print(error) } } diff --git a/AutoCat/Extensions/VehicleReportImage.swift b/AutoCat/Extensions/VehicleReportImage.swift index a1209ca..8f85918 100644 --- a/AutoCat/Extensions/VehicleReportImage.swift +++ b/AutoCat/Extensions/VehicleReportImage.swift @@ -144,6 +144,30 @@ extension Vehicle { y += 24 + if !self.events.isEmpty { + "LOCATIONS".draw(with: CGRect(x: 15, y: y, width: w - 15, height: 24), options: .usesLineFragmentOrigin, attributes: headerAttributes, context: nil) + y += 24 + self.drawLine(y: y, width: w, margin: 0, context: ctx) + y += 1/UIScreen.main.scale + + for event in self.events { + let date = Date(timeIntervalSince1970: event.date) + self.drawCell(y: y, width: w, height: cellHeight, title: "Date", value: formatter.string(from: date), context: ctx) + y += cellHeight + + if let address = event.address { + self.drawCell(y: y, width: w, height: cellHeight, title: "Address", value: address, context: ctx) + y += cellHeight + } + + let location = String(format: "%.05f, %.05f", event.latitude, event.longitude) + self.drawCell(y: y, width: w, height: cellHeight, title: "Location", value: location, context: ctx) + y += cellHeight + 8 + } + } + + y += 24 + "PHOTOS (\(self.photos.count))".draw(with: CGRect(x: 15, y: y, width: w - 15, height: 24), options: .usesLineFragmentOrigin, attributes: headerAttributes, context: nil) y += 24 self.drawLine(y: y, width: w, margin: 0, context: ctx) @@ -218,6 +242,24 @@ extension Vehicle { } } + if !self.events.isEmpty { + text += "\n" + text += "Locations\n" + text += "\n" + for event in self.events { + let date = Date(timeIntervalSince1970: event.date) + text += "Date: \(formatter.string(from: date))\n" + + if let address = event.address { + text += "Address: \(address)\n" + } + + let location = String(format: "%.05f, %.05f", event.latitude, event.longitude) + text += "Location: \(location)\n" + text += "\n" + } + } + return text } } diff --git a/AutoCat/Info.plist b/AutoCat/Info.plist index 1ae5983..b95332d 100644 --- a/AutoCat/Info.plist +++ b/AutoCat/Info.plist @@ -2,8 +2,6 @@ - NSLocationWhenInUseUsageDescription - Access is needed for storing locations of vehicles CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleExecutable @@ -46,6 +44,10 @@ NSLocationAlwaysAndWhenInUseUsageDescription Access is needed for storing locations of vehicles (even when the app was sent to bacground) + NSLocationAlwaysUsageDescription + Access is needed for storing locations of vehicles (even when the app was sent to bacground) + NSLocationWhenInUseUsageDescription + Access is needed for storing locations of vehicles NSMicrophoneUsageDescription Access is needed for voice recordings NSPhotoLibraryAddUsageDescription