diff --git a/platform/ios/app-swift/Package.resolved b/platform/ios/app-swift/Package.resolved index 09a5f670b..2f4ad6007 100644 --- a/platform/ios/app-swift/Package.resolved +++ b/platform/ios/app-swift/Package.resolved @@ -3,10 +3,10 @@ { "identity" : "polyline", "kind" : "remoteSourceControl", - "location" : "https://github.com/raphaelmor/Polyline", + "location" : "https://github.com/aws-geospatial/polyline/", "state" : { - "revision" : "353f80378dcd8f17eefe8550090c6b1ae3c9da23", - "version" : "5.1.0" + "revision" : "deaef283f8040debf7cbd21bf95d779d2d1a798e", + "version" : "0.3.1" } }, { diff --git a/platform/ios/app-swift/Package.swift b/platform/ios/app-swift/Package.swift index f865a8e20..ca0ecc1f0 100644 --- a/platform/ios/app-swift/Package.swift +++ b/platform/ios/app-swift/Package.swift @@ -10,7 +10,7 @@ let package = Package( defaultLocalization: "en", platforms: [.iOS(.v12)], dependencies: [ - .package(url: "https://github.com/raphaelmor/Polyline", from: "5.1.0"), + .package(url: "https://github.com/aws-geospatial/polyline/", from: "0.3.1"), .package(url: "https://github.com/getsentry/sentry-cocoa", from: "8.54.0"), ] ) diff --git a/platform/ios/app-swift/Sources/Stability/Navigation.swift b/platform/ios/app-swift/Sources/Stability/Navigation.swift index fda05ae2f..750c7b4c7 100644 --- a/platform/ios/app-swift/Sources/Stability/Navigation.swift +++ b/platform/ios/app-swift/Sources/Stability/Navigation.swift @@ -144,7 +144,11 @@ class NavigationRoute { init(json: [String: Any], mapView: MLNMapView) { self.mapView = mapView - load(json: json) + do { + try load(json: json) + } catch { + print("Error loading route: \(error)") + } } deinit { @@ -152,7 +156,7 @@ class NavigationRoute { mapView?.locationManager = nil } - private func load(json: [String: Any]) { + private func load(json: [String: Any]) throws { let routeJson = (json["routes"] as! [[String: Any]]).first! // stats @@ -164,7 +168,11 @@ class NavigationRoute { destination = CLLocationCoordinate2D(latitude: destinationJson.last!, longitude: destinationJson.first!) // route geometry - let geometry: [LocationCoordinate2D] = decodePolyline(routeJson["geometry"] as! String, precision: 1e6)! + Polyline.setCompressionAlgorithm(CompressionAlgorithm.Polyline6) + + let geometry = try Polyline.decodeToLngLatArray(routeJson["geometry"] as! String).map { + CLLocationCoordinate2D(latitude: $0.last!, longitude: $0.first!) + } loadGeometry(from: geometry)