diff --git a/.breakage-allowlist b/.breakage-allowlist index c25fc623512..6179d8901c3 100644 --- a/.breakage-allowlist +++ b/.breakage-allowlist @@ -1,2 +1,5 @@ Func CarPlayManagerDelegate.carPlayManagerDidCancelPreview(_:) has been added as a protocol requirement -Constructor MapboxNavigationService.init(history:customRoutingProvider:credentials:eventsManagerType:routerType:customActivityType:) has been removed \ No newline at end of file +Constructor MapboxNavigationService.init(history:customRoutingProvider:credentials:eventsManagerType:routerType:customActivityType:) has been removed +EnumElement RoadName.name has been removed +EnumElement RoadName.code has been removed +Enum RoadName has been changed to a Struct diff --git a/CHANGELOG.md b/CHANGELOG.md index fd7c82347e2..0ea5e01a7f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,23 +2,40 @@ ## v2.11.0 +### Packaging + +* MapboxCoreNavigation now requires [MapboxNavigationNative v124._x_](https://github.com/mapbox/mapbox-navigation-native-ios/releases/tag/124.0.1). ([#4333](https://github.com/mapbox/mapbox-navigation-ios/pull/4333)) +* MapboxCoreNavigation now requires [MapboxDirections v2.10.0-beta.1](https://github.com/mapbox/mapbox-directions-swift/releases/tag/v2.10.0-beta.1). ([#4333](https://github.com/mapbox/mapbox-navigation-ios/pull/4333)) +* MapboxNavigation now requires [MapboxMaps v10.11.0-beta.1](https://github.com/mapbox/mapbox-maps-ios/releases/tag/v10.11.0-beta.1). ([#4333](https://github.com/mapbox/mapbox-navigation-ios/pull/4333)) + ### CarPlay * Added `CarPlayManagerDelegate.carPlayManagerDidCancelPreview(_:)` to notify developers after CarPlay canceled routes preview, and `CarPlayManager.cancelRoutesPreview()` method to cancel routes preview on CarPlay. ([#4311](https://github.com/mapbox/mapbox-navigation-ios/pull/4311)) * Added `CPRouteChoice.indexedRouteResponse` property to allow developers to get access to the `IndexedRouteResponse` of `CPRouteChoice` on CarPlay. ([#4311](https://github.com/mapbox/mapbox-navigation-ios/pull/4311)) * Added the ability to pan a map view on CarPlay. ([#4288](https://github.com/mapbox/mapbox-navigation-ios/pull/4288)) +### Electronic horizon + +**Note:** The Mapbox Electronic Horizon feature of the Mapbox Navigation SDK is in public beta and is subject to changes, including its pricing. Use of the feature is subject to the beta product restrictions in the Mapbox Terms of Service. Mapbox reserves the right to eliminate any free tier or free evaluation offers at any time and require customers to place an order to purchase the Mapbox Electronic Horizon feature, regardless of the level of use of the feature. + +* `RoadName` type changed from enum to struct with additional properties. ([#4333](https://github.com/mapbox/mapbox-navigation-ios/pull/4333)) +* Electronic Horizon Notifications (`Notification.Name.electronicHorizonDidUpdatePosition`, `Notification.Name.electronicHorizonDidEnterRoadObject`, `Notification.Name.electronicHorizonDidExitRoadObject`, `Notification.Name.electronicHorizonDidPassRoadObject`) are now called on the main thread. ([#4333](https://github.com/mapbox/mapbox-navigation-ios/pull/4333)) + ### Other changes * Fixed an issue where an incorrect upcoming intersection index cause a crash. ([#4314](https://github.com/mapbox/mapbox-navigation-ios/pull/4314)) +* Fixed an issue where `RouteProgress.currentLegProgress.currentStepProgress.userDistanceToUpcomingIntersection` could be incorrectly calculated for folding back route steps. ([#4268](https://github.com/mapbox/mapbox-navigation-ios/pull/4268)) +* Ensure map-matching considers HOV-only roads as auto accessible [#4333](https://github.com/mapbox/mapbox-navigation-native/pull/4333) +* Added `ReplayManagerHistoryEventsListener` to receive events feed when replaying a `History` data. ([#4342](https://github.com/mapbox/mapbox-navigation-ios/pull/4342)) +* `UserPushedHistoryEvent` is now public. ([#4342](https://github.com/mapbox/mapbox-navigation-ios/pull/4342)) ## v2.10.0 ### Packaging -* MapboxCoreNavigation now requires [MapboxNavigationNative v123._x_](https://github.com/mapbox/mapbox-navigation-native-ios/releases/tag/123.1.0). ([#4298](https://github.com/mapbox/mapbox-navigation-ios/pull/4298)) +* MapboxCoreNavigation now requires [MapboxNavigationNative v123._x_](https://github.com/mapbox/mapbox-navigation-native-ios/releases/tag/123.2.0). ([#4331](https://github.com/mapbox/mapbox-navigation-ios/pull/4331)) * MapboxNavigation now requires [MapboxMaps v10.10._x_](https://github.com/mapbox/mapbox-maps-ios/releases/tag/v10.10.1). ([#4315](https://github.com/mapbox/mapbox-navigation-ios/pull/4315)) -* MapboxCoreNavigation now requires [MapboxDirections v2.9.0-rc.2](https://github.com/mapbox/mapbox-directions-swift/releases/tag/v2.9.0-rc.2). ([#4296](https://github.com/mapbox/mapbox-navigation-ios/pull/4296)) +* MapboxCoreNavigation now requires [MapboxDirections v2.9.1](https://github.com/mapbox/mapbox-directions-swift/releases/tag/v2.9.1). ([#4336](https://github.com/mapbox/mapbox-navigation-ios/pull/4336)) * Cocoapods podspec for MapboxCoreNavigation now references resources that will be copied into the application. ([#4280](https://github.com/mapbox/mapbox-navigation-ios/pull/4280)) ### Routing @@ -56,7 +73,6 @@ * Fixed an issue where the route progress could be incorrectly calculated for folding back route steps. ([#4234](https://github.com/mapbox/mapbox-navigation-ios/pull/4234)) * `NavigationView.init(frame:tileStoreLocation:navigationMapView:)`, `NavigationView.navigationMapView`, `NavigationView.floatingStackView`, `NavigationView.floatingButtons`, `NavigationView.wayNameView`, `NavigationView.speedLimitView`, `NavigationView.topBannerContainerView` and `NavigationView.bottomBannerContainerView` are now publicly accessible. ([#4249](https://github.com/mapbox/mapbox-navigation-ios/pull/4249)) * Fixed an issue where empty intersections of the current step could cause a crash. ([#4260](https://github.com/mapbox/mapbox-navigation-ios/pull/4260)) -* Fixed an issue where `RouteProgress.currentLegProgress.currentStepProgress.userDistanceToUpcomingIntersection` could be incorrectly calculated for folding back route steps. ([#4268](https://github.com/mapbox/mapbox-navigation-ios/pull/4268)) * Deprecated `NavigationSettings.initialize(directions:tileStoreConfiguration:routingProviderSource:alternativeRouteDetectionStrategy:utilizeSensorData:navigatorPredictionInterval:liveIncidentsOptions:statusUpdatingSettings:)` method in favor of `NavigationSettings.initialize(with:)`. ([#4275](https://github.com/mapbox/mapbox-navigation-ios/pull/4275)) * Added new parameter that allows configuring logging level for Mapbox SDKs. Checkout new `NavigationSettings.initialize(with:)` method for more information. ([#4275](https://github.com/mapbox/mapbox-navigation-ios/pull/4275)) * Fixed an issue where the `UserHaloCourseView` will be shown under reduced location accuracy mode with `NavigationMapview.reducedAccuracyActivatedMode` as `false`. Right now `UserHaloCourseView` will be applied in only one case: when user explicitly sets `NavigationMapView.reducedAccuracyActivatedMode` to `true`, and the `Precise Location` property in the settings of current application is disabled by user. ([#4285](https://github.com/mapbox/mapbox-navigation-ios/pull/4285)) @@ -259,7 +275,7 @@ * Fixed an issue where the destination building is not highlighted after rerouting. ([#4034](https://github.com/mapbox/mapbox-navigation-ios/pull/4034)) * Fixed an issue where the incorrect destination building is highlighted after panning the correct building off screen. ([#4034](https://github.com/mapbox/mapbox-navigation-ios/pull/4034)) * Fixed an issue where the maneuver arrow on the route line overlapped labels for points of interest. ([#4030](https://github.com/mapbox/mapbox-navigation-ios/pull/4030)) -* Fixed an issue where `NavigationMapView` injected with `NavigationOptions` isn't visible in active navigation. ([#4049](https://github.com/mapbox/mapbox-navigation-ios/pull/4049)) +* Fixed an issue where `NavigationMapView` injected with `NavigationOptions` isn't visible in active navigation. ([#4049](https://github.com/mapbox/mapbox-navigation-ios/pull/4049)) * Fixed the crash caused by showing a route that doesn't contain coordinates. ([#4046](https://github.com/mapbox/mapbox-navigation-ios/pull/4046)) ### CarPlay diff --git a/Cartfile b/Cartfile index 53f4d57a547..6800d7c011f 100644 --- a/Cartfile +++ b/Cartfile @@ -1,4 +1,4 @@ -binary "https://api.mapbox.com/downloads/v2/carthage/mapbox-common/MapboxCommon.json" ~> 23.2.1 -binary "https://api.mapbox.com/downloads/v2/carthage/mobile-navigation-native/MapboxNavigationNative.xcframework.json" ~> 123.1.0 -github "mapbox/mapbox-directions-swift" == 2.9.0-rc.2 +binary "https://api.mapbox.com/downloads/v2/carthage/mapbox-common/MapboxCommon.json" == 23.3.0-beta.1 +binary "https://api.mapbox.com/downloads/v2/carthage/mobile-navigation-native/MapboxNavigationNative.xcframework.json" ~> 124.0.1 +github "mapbox/mapbox-directions-swift" == 2.10.0-beta.1 github "mapbox/mapbox-events-ios" ~> 1.0.0 diff --git a/Cartfile.resolved b/Cartfile.resolved index 49754ddd5db..2c9f335bf44 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,6 +1,6 @@ -binary "https://api.mapbox.com/downloads/v2/carthage/mapbox-common/MapboxCommon.json" "23.2.1" -binary "https://api.mapbox.com/downloads/v2/carthage/mobile-navigation-native/MapboxNavigationNative.xcframework.json" "123.1.0" -github "mapbox/mapbox-directions-swift" "v2.9.0-rc.2" +binary "https://api.mapbox.com/downloads/v2/carthage/mapbox-common/MapboxCommon.json" "23.3.0-beta.1" +binary "https://api.mapbox.com/downloads/v2/carthage/mobile-navigation-native/MapboxNavigationNative.xcframework.json" "124.0.1" +github "mapbox/mapbox-directions-swift" "v2.10.0-beta.1" github "mapbox/mapbox-events-ios" "v1.0.10" github "mapbox/turf-swift" "v2.6.1" github "mattgallagher/CwlPreconditionTesting" "2.1.0" diff --git a/Example/ViewController+FreeDrive.swift b/Example/ViewController+FreeDrive.swift index fd64559404b..4eb78953526 100644 --- a/Example/ViewController+FreeDrive.swift +++ b/Example/ViewController+FreeDrive.swift @@ -158,14 +158,7 @@ extension ViewController { guard let metadata = passiveLocationManager?.roadGraph.edgeMetadata(edgeIdentifier: identifier) else { return [] } - let names = metadata.names.map { name -> String in - switch name { - case .name(let name): - return name - case .code(let code): - return "(\(code))" - } - } + let names = metadata.names.map(\.text) // If the road is unnamed, fall back to the road class. if names.isEmpty { diff --git a/MapboxCoreNavigation.podspec b/MapboxCoreNavigation.podspec index da53532c010..856f559d27b 100644 --- a/MapboxCoreNavigation.podspec +++ b/MapboxCoreNavigation.podspec @@ -44,8 +44,8 @@ Pod::Spec.new do |s| s.requires_arc = true s.module_name = "MapboxCoreNavigation" - s.dependency "MapboxNavigationNative", "~> 123.1" - s.dependency "MapboxDirections-pre", "2.9.0-rc.2" + s.dependency "MapboxNavigationNative", "~> 124.0.1" + s.dependency "MapboxDirections-pre", "2.10.0-beta.1" s.dependency "MapboxMobileEvents", "~> 1.0" s.swift_version = "5.5" diff --git a/MapboxNavigation-SPM.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/MapboxNavigation-SPM.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 142bc572c18..276ed2c940b 100644 --- a/MapboxNavigation-SPM.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/MapboxNavigation-SPM.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -24,8 +24,8 @@ "repositoryURL": "https://github.com/mapbox/mapbox-common-ios.git", "state": { "branch": null, - "revision": "82f54cb3717aadcc88cd5302112add73644844d8", - "version": "23.2.1" + "revision": "d6e7b7d8df0ec523eb63412daf2f2fa4f58e0a55", + "version": "23.3.0-beta.1" } }, { @@ -33,8 +33,8 @@ "repositoryURL": "https://github.com/mapbox/mapbox-core-maps-ios.git", "state": { "branch": null, - "revision": "8d1e95ae3c341bea2ad73599bf6ef674fa2b6897", - "version": "10.10.0" + "revision": "439dc92d71ee10f7fb6c3ca89468586c65bb5108", + "version": "10.11.0-beta.1" } }, { @@ -42,8 +42,8 @@ "repositoryURL": "https://github.com/mapbox/mapbox-directions-swift.git", "state": { "branch": null, - "revision": "94244ece1cd95f91f18c6325dcbed07de8dcf8b1", - "version": "2.9.0-rc.2" + "revision": "1f878617c7df86a51880bc961e85b0055cab2dcd", + "version": "2.10.0-beta.1" } }, { @@ -60,8 +60,8 @@ "repositoryURL": "https://github.com/mapbox/mapbox-maps-ios.git", "state": { "branch": null, - "revision": "862ca6e0e57a2e13dd057332ee50f936a6b24fbf", - "version": "10.10.1" + "revision": "7833ea786889e3b109ef31d7d3b923793088020f", + "version": "10.11.0-beta.1" } }, { @@ -69,8 +69,8 @@ "repositoryURL": "https://github.com/mapbox/mapbox-navigation-native-ios.git", "state": { "branch": null, - "revision": "25539af7104ec49ab924ccb566e614fb983ead97", - "version": "123.1.0" + "revision": "9aef5a469b4ffa6317e060521f1052af756b6ec7", + "version": "124.0.1" } }, { @@ -123,8 +123,8 @@ "repositoryURL": "https://github.com/apple/swift-argument-parser", "state": { "branch": null, - "revision": "fddd1c00396eed152c45a46bea9f47b98e59301d", - "version": "1.2.0" + "revision": "4ad606ba5d7673ea60679a61ff867cc1ff8c8e86", + "version": "1.2.1" } }, { diff --git a/MapboxNavigation.podspec b/MapboxNavigation.podspec index c01e812ff7b..dc02c725037 100644 --- a/MapboxNavigation.podspec +++ b/MapboxNavigation.podspec @@ -44,7 +44,7 @@ Pod::Spec.new do |s| s.module_name = "MapboxNavigation" s.dependency "MapboxCoreNavigation", "#{s.version.to_s}" - s.dependency "MapboxMaps", "~> 10.10" + s.dependency "MapboxMaps", "10.11.0-beta.1" s.dependency "Solar-dev", "~> 3.0" s.dependency "MapboxSpeech", "~> 2.0" s.dependency "MapboxMobileEvents", "~> 1.0" diff --git a/MapboxNavigation.xcodeproj/project.pbxproj b/MapboxNavigation.xcodeproj/project.pbxproj index 4e616e0be2c..3cb616b295e 100644 --- a/MapboxNavigation.xcodeproj/project.pbxproj +++ b/MapboxNavigation.xcodeproj/project.pbxproj @@ -225,6 +225,7 @@ 5A1C075824BDEB44000A6330 /* PassiveLocationProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A1C075724BDEB44000A6330 /* PassiveLocationProvider.swift */; }; 5A39B9282498F9890026DFD1 /* PassiveLocationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A39B9272498F9890026DFD1 /* PassiveLocationManager.swift */; }; 5A43FC8B24B488DC00BF7943 /* PassiveLocationManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A43FC8A24B488DC00BF7943 /* PassiveLocationManagerTests.swift */; }; + 7E6CAE392976B346001D749D /* RoadShield.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E6CAE382976B346001D749D /* RoadShield.swift */; }; 8A0155E828F8EC72009E299C /* BannerPresentationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A0155E728F8EC72009E299C /* BannerPresentationTests.swift */; }; 8A0155EA28F8EC85009E299C /* StackTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A0155E928F8EC85009E299C /* StackTests.swift */; }; 8A0155EC28F8ED38009E299C /* PreviewViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A0155EB28F8ED38009E299C /* PreviewViewControllerTests.swift */; }; @@ -240,7 +241,6 @@ 8A18568726320B5900F8AE38 /* FollowingCameraOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A18568626320B5900F8AE38 /* FollowingCameraOptions.swift */; }; 8A18569926320B8F00F8AE38 /* OverviewCameraOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A18569826320B8F00F8AE38 /* OverviewCameraOptions.swift */; }; 8A1943A92685DC680066E2F8 /* NavigationGeocodedPlacemark.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A1943A82685DC680066E2F8 /* NavigationGeocodedPlacemark.swift */; }; - 8A1FACF32942C6BA0051FE76 /* VisualInstructionComponentGuidanceViewKind.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A1FACF22942C6BA0051FE76 /* VisualInstructionComponentGuidanceViewKind.swift */; }; 8A2081CB25E07CED00F9B8A6 /* NavigationMapViewIdentifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A2081C925E07CED00F9B8A6 /* NavigationMapViewIdentifiers.swift */; }; 8A2081CC25E07CED00F9B8A6 /* RouteLineType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A2081CA25E07CED00F9B8A6 /* RouteLineType.swift */; }; 8A2354EE28877890003E42B4 /* BannerContainerViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A2354EA28877890003E42B4 /* BannerContainerViewDelegate.swift */; }; @@ -897,6 +897,7 @@ 5A1C075724BDEB44000A6330 /* PassiveLocationProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PassiveLocationProvider.swift; sourceTree = ""; }; 5A39B9272498F9890026DFD1 /* PassiveLocationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PassiveLocationManager.swift; sourceTree = ""; }; 5A43FC8A24B488DC00BF7943 /* PassiveLocationManagerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PassiveLocationManagerTests.swift; sourceTree = ""; }; + 7E6CAE382976B346001D749D /* RoadShield.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RoadShield.swift; sourceTree = ""; }; 8A0155E728F8EC72009E299C /* BannerPresentationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BannerPresentationTests.swift; sourceTree = ""; }; 8A0155E928F8EC85009E299C /* StackTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StackTests.swift; sourceTree = ""; }; 8A0155EB28F8ED38009E299C /* PreviewViewControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreviewViewControllerTests.swift; sourceTree = ""; }; @@ -912,7 +913,6 @@ 8A18568626320B5900F8AE38 /* FollowingCameraOptions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowingCameraOptions.swift; sourceTree = ""; }; 8A18569826320B8F00F8AE38 /* OverviewCameraOptions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OverviewCameraOptions.swift; sourceTree = ""; }; 8A1943A82685DC680066E2F8 /* NavigationGeocodedPlacemark.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationGeocodedPlacemark.swift; sourceTree = ""; }; - 8A1FACF22942C6BA0051FE76 /* VisualInstructionComponentGuidanceViewKind.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VisualInstructionComponentGuidanceViewKind.swift; sourceTree = ""; }; 8A2081C925E07CED00F9B8A6 /* NavigationMapViewIdentifiers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationMapViewIdentifiers.swift; sourceTree = ""; }; 8A2081CA25E07CED00F9B8A6 /* RouteLineType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RouteLineType.swift; sourceTree = ""; }; 8A2354EA28877890003E42B4 /* BannerContainerViewDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BannerContainerViewDelegate.swift; sourceTree = ""; }; @@ -2295,7 +2295,6 @@ 3A8187C824BDAE9C00708F19 /* URLSession.swift */, 11D1F89F2696048D0053A93F /* Dictionary+DeepMerge.swift */, 8AC85EA328628E4F003F8FC8 /* UIDevice.swift */, - 8A1FACF22942C6BA0051FE76 /* VisualInstructionComponentGuidanceViewKind.swift */, 8A7B69912947AA0F00FFC3F5 /* AmenityType.swift */, ); name = Extensions; @@ -2465,6 +2464,7 @@ DA5F44F325F07D3A00F573EC /* RoadObjectStoreDelegate.swift */, DA5F44F425F07D3B00F573EC /* RoadObjectStore.swift */, 414119FE26C5269A00402B5D /* RoadSubgraphEdge.swift */, + 7E6CAE382976B346001D749D /* RoadShield.swift */, ); path = EHorizon; sourceTree = ""; @@ -3382,6 +3382,7 @@ 353E68FC1EF0B7F8007B2AE5 /* NavigationLocationManager.swift in Sources */, 2BE7013D25359C7B00F46E4E /* RouteAlert.swift in Sources */, 2C04E467290A8C6B0067FDCF /* PredictiveCacheNavigationOptions.swift in Sources */, + 7E6CAE392976B346001D749D /* RoadShield.swift in Sources */, 2B2DC69928F479DE0019232C /* HistoryEvent.swift in Sources */, 353E68FE1EF0B985007B2AE5 /* BundleAdditions.swift in Sources */, 2EFAE005264C1F9200B618C4 /* RoadObjectLocation.swift in Sources */, @@ -3445,7 +3446,6 @@ DA5F44C725F07AB700F573EC /* RoadName.swift in Sources */, DA5F44AC25F07A6800F573EC /* RoadGraphPosition.swift in Sources */, 2E50E0E6264E49EF009D3848 /* OpenLRIdentifier.swift in Sources */, - 8A1FACF32942C6BA0051FE76 /* VisualInstructionComponentGuidanceViewKind.swift in Sources */, 2BF398C1274BDEA8000C9A72 /* Directions.swift in Sources */, 2E5ACEE9288E877A00300ECA /* EventConstants.swift in Sources */, 353E69041EF0C4E5007B2AE5 /* SimulatedLocationManager.swift in Sources */, diff --git a/Package.resolved b/Package.resolved index dea285c0a04..5f27f01cc94 100644 --- a/Package.resolved +++ b/Package.resolved @@ -24,8 +24,8 @@ "repositoryURL": "https://github.com/mapbox/mapbox-common-ios.git", "state": { "branch": null, - "revision": "82f54cb3717aadcc88cd5302112add73644844d8", - "version": "23.2.1" + "revision": "d6e7b7d8df0ec523eb63412daf2f2fa4f58e0a55", + "version": "23.3.0-beta.1" } }, { @@ -33,8 +33,8 @@ "repositoryURL": "https://github.com/mapbox/mapbox-core-maps-ios.git", "state": { "branch": null, - "revision": "8d1e95ae3c341bea2ad73599bf6ef674fa2b6897", - "version": "10.10.0" + "revision": "439dc92d71ee10f7fb6c3ca89468586c65bb5108", + "version": "10.11.0-beta.1" } }, { @@ -42,8 +42,8 @@ "repositoryURL": "https://github.com/mapbox/mapbox-directions-swift.git", "state": { "branch": null, - "revision": "94244ece1cd95f91f18c6325dcbed07de8dcf8b1", - "version": "2.9.0-rc.2" + "revision": "1f878617c7df86a51880bc961e85b0055cab2dcd", + "version": "2.10.0-beta.1" } }, { @@ -60,8 +60,8 @@ "repositoryURL": "https://github.com/mapbox/mapbox-maps-ios.git", "state": { "branch": null, - "revision": "7ba6d499e565d65da9ad54b6f4348eecdbb505da", - "version": "10.10.0" + "revision": "7833ea786889e3b109ef31d7d3b923793088020f", + "version": "10.11.0-beta.1" } }, { @@ -69,8 +69,8 @@ "repositoryURL": "https://github.com/mapbox/mapbox-navigation-native-ios.git", "state": { "branch": null, - "revision": "25539af7104ec49ab924ccb566e614fb983ead97", - "version": "123.1.0" + "revision": "9aef5a469b4ffa6317e060521f1052af756b6ec7", + "version": "124.0.1" } }, { @@ -114,8 +114,8 @@ "repositoryURL": "https://github.com/apple/swift-argument-parser", "state": { "branch": null, - "revision": "fddd1c00396eed152c45a46bea9f47b98e59301d", - "version": "1.2.0" + "revision": "4ad606ba5d7673ea60679a61ff867cc1ff8c8e86", + "version": "1.2.1" } }, { diff --git a/Package.swift b/Package.swift index ad9172ddc5b..855ab344077 100644 --- a/Package.swift +++ b/Package.swift @@ -22,10 +22,10 @@ let package = Package( ) ], dependencies: [ - .package(name: "MapboxDirections", url: "https://github.com/mapbox/mapbox-directions-swift.git", .exact("2.9.0-rc.2")), + .package(name: "MapboxDirections", url: "https://github.com/mapbox/mapbox-directions-swift.git", .exact("2.10.0-beta.1")), .package(name: "MapboxMobileEvents", url: "https://github.com/mapbox/mapbox-events-ios.git", from: "1.0.0"), - .package(name: "MapboxNavigationNative", url: "https://github.com/mapbox/mapbox-navigation-native-ios.git", from: "123.1.0"), - .package(name: "MapboxMaps", url: "https://github.com/mapbox/mapbox-maps-ios.git", from: "10.10.1"), + .package(name: "MapboxNavigationNative", url: "https://github.com/mapbox/mapbox-navigation-native-ios.git", from: "124.0.1"), + .package(name: "MapboxMaps", url: "https://github.com/mapbox/mapbox-maps-ios.git", .exact("10.11.0-beta.1")), .package(name: "Solar", url: "https://github.com/ceeK/Solar.git", from: "3.0.0"), .package(name: "MapboxSpeech", url: "https://github.com/mapbox/mapbox-speech-swift.git", from: "2.0.0"), .package(name: "CwlPreconditionTesting", url: "https://github.com/mattgallagher/CwlPreconditionTesting.git", from: "2.1.0"), diff --git a/Sources/MapboxCoreNavigation/CoreNavigationNavigator.swift b/Sources/MapboxCoreNavigation/CoreNavigationNavigator.swift index 083a12d4aae..8c736f42135 100644 --- a/Sources/MapboxCoreNavigation/CoreNavigationNavigator.swift +++ b/Sources/MapboxCoreNavigation/CoreNavigationNavigator.swift @@ -378,7 +378,9 @@ class NavigatorElectronicHorizonObserver: ElectronicHorizonObserver { .updatesMostProbablePathKey: position.type() == .update, .distancesByRoadObjectKey: distances.map(DistancedRoadObject.init), ] - NotificationCenter.default.post(name: .electronicHorizonDidUpdatePosition, object: nil, userInfo: userInfo) + onMainAsync { + NotificationCenter.default.post(name: .electronicHorizonDidUpdatePosition, object: nil, userInfo: userInfo) + } } public func onRoadObjectEnter(for info: RoadObjectEnterExitInfo) { @@ -386,7 +388,9 @@ class NavigatorElectronicHorizonObserver: ElectronicHorizonObserver { .roadObjectIdentifierKey: info.roadObjectId, .didTransitionAtEndpointKey: info.isEnterFromStartOrExitFromEnd, ] - NotificationCenter.default.post(name: .electronicHorizonDidEnterRoadObject, object: nil, userInfo: userInfo) + onMainAsync { + NotificationCenter.default.post(name: .electronicHorizonDidEnterRoadObject, object: nil, userInfo: userInfo) + } } public func onRoadObjectExit(for info: RoadObjectEnterExitInfo) { @@ -394,14 +398,18 @@ class NavigatorElectronicHorizonObserver: ElectronicHorizonObserver { .roadObjectIdentifierKey: info.roadObjectId, .didTransitionAtEndpointKey: info.isEnterFromStartOrExitFromEnd, ] - NotificationCenter.default.post(name: .electronicHorizonDidExitRoadObject, object: nil, userInfo: userInfo) + onMainAsync { + NotificationCenter.default.post(name: .electronicHorizonDidExitRoadObject, object: nil, userInfo: userInfo) + } } public func onRoadObjectPassed(for info: RoadObjectPassInfo) { let userInfo: [RoadGraph.NotificationUserInfoKey: Any] = [ .roadObjectIdentifierKey: info.roadObjectId, ] - NotificationCenter.default.post(name: .electronicHorizonDidPassRoadObject, object: nil, userInfo: userInfo) + onMainAsync { + NotificationCenter.default.post(name: .electronicHorizonDidPassRoadObject, object: nil, userInfo: userInfo) + } } } diff --git a/Sources/MapboxCoreNavigation/EHorizon/RoadGraphEdgeMetadata.swift b/Sources/MapboxCoreNavigation/EHorizon/RoadGraphEdgeMetadata.swift index e64be6d9016..93653247a85 100644 --- a/Sources/MapboxCoreNavigation/EHorizon/RoadGraphEdgeMetadata.swift +++ b/Sources/MapboxCoreNavigation/EHorizon/RoadGraphEdgeMetadata.swift @@ -160,7 +160,7 @@ extension RoadGraph.Edge { self.roadClasses = roadClasses isBridge = native.isBridge - names = native.names.map(RoadName.init) + names = native.names.compactMap(RoadName.init) laneCount = native.laneCount as? UInt altitude = native.meanElevation as? Double curvature = UInt(native.curvature) diff --git a/Sources/MapboxCoreNavigation/EHorizon/RoadName.swift b/Sources/MapboxCoreNavigation/EHorizon/RoadName.swift index 90459e349d7..c93bd0f20f5 100644 --- a/Sources/MapboxCoreNavigation/EHorizon/RoadName.swift +++ b/Sources/MapboxCoreNavigation/EHorizon/RoadName.swift @@ -1,31 +1,42 @@ import Foundation import MapboxNavigationNative -/** - A human-readable name or route reference code that identifies a road. - - - note: The Mapbox Electronic Horizon feature of the Mapbox Navigation SDK is in public beta and is subject to changes, including its pricing. Use of the feature is subject to the beta product restrictions in the Mapbox Terms of Service. Mapbox reserves the right to eliminate any free tier or free evaluation offers at any time and require customers to place an order to purchase the Mapbox Electronic Horizon feature, regardless of the level of use of the feature. - */ -public enum RoadName { - /** - A road name. - - If you display a name to the user, you may need to abbreviate common words like “East” or “Boulevard” to ensure that it fits in the allotted space. - */ - case name(_ name: String) - - /** - A route reference code assigned to a road. - - A route reference code commonly consists of an alphabetic network code, a space or hyphen, and a route number. You should not assume that the network code is globally unique: for example, a network code of “NH” may indicate a “National Highway” or “New Hampshire”. Moreover, a route number may not even uniquely identify a route within a given network. - */ - case code(_ code: String) +/// Road information, like Route number, street name, shield information, etc. +/// +/// - note: The Mapbox Electronic Horizon feature of the Mapbox Navigation SDK is in public beta +/// and is subject to changes, including its pricing. Use of the feature is subject to the beta product restrictions +/// in the Mapbox Terms of Service. Mapbox reserves the right to eliminate any free tier or free evaluation offers at +/// any time and require customers to place an order to purchase the Mapbox Electronic Horizon feature, regardless of +/// the level of use of the feature. +public struct RoadName: Equatable { + /// The name of the road. + /// + /// If you display a name to the user, you may need to abbreviate common words like “East” or “Boulevard” to ensure + /// that it fits in the allotted space. + public let text: String - init(_ native: MapboxNavigationNative.RoadName) { - if native.isShielded { - self = .code(native.name) - } else { - self = .name(native.name) - } + /// 2 letters language code or "Unspecified" or empty string + public let language: String + + /// Shield information of the road + public let shield: RoadShield? + + /// Creates a new `RoadName` instance. + /// - Parameters: + /// - text: The name of the road. + /// - language: 2 letters language code or "Unspecified" or empty string + /// - shield: Shield information of the road + public init(text: String, language: String, shield: RoadShield? = nil) { + self.text = text + self.language = language + self.shield = shield + } + + init?(_ native: MapboxNavigationNative.RoadName) { + guard native.text != "/" else { return nil } + + self.shield = native.shield.map(RoadShield.init) + self.text = native.text + self.language = native.language } } diff --git a/Sources/MapboxCoreNavigation/EHorizon/RoadShield.swift b/Sources/MapboxCoreNavigation/EHorizon/RoadShield.swift new file mode 100644 index 00000000000..dacc1d202db --- /dev/null +++ b/Sources/MapboxCoreNavigation/EHorizon/RoadShield.swift @@ -0,0 +1,42 @@ +import MapboxNavigationNative + +/// Describes a road shield information. +/// +/// - note: The Mapbox Electronic Horizon feature of the Mapbox Navigation SDK is in public beta +/// and is subject to changes, including its pricing. Use of the feature is subject to the beta product restrictions +/// in the Mapbox Terms of Service. Mapbox reserves the right to eliminate any free tier or free evaluation offers at +/// any time and require customers to place an order to purchase the Mapbox Electronic Horizon feature, regardless of +/// the level of use of the feature. +public struct RoadShield: Equatable { + /// The base url for a shield image. + public let baseUrl: String + + /// The shield display reference. + public let displayRef: String + + /// The shield text. + public let name: String + + /// The string indicating the color of the text to be rendered on the route shield, e.g. "black". + public let textColor: String + + /// Creates a new `Shield` instance. + /// - Parameters: + /// - baseUrl: The base url for a shield image. + /// - displayRef: The shield display reference. + /// - name: The shield text. + /// - textColor: The string indicating the color of the text to be rendered on the route shield. + public init(baseUrl: String, displayRef: String, name: String, textColor: String) { + self.baseUrl = baseUrl + self.displayRef = displayRef + self.name = name + self.textColor = textColor + } + + init(_ native: MapboxNavigationNative.Shield) { + self.baseUrl = native.baseUrl + self.name = native.name + self.displayRef = native.displayRef + self.textColor = native.textColor + } +} diff --git a/Sources/MapboxCoreNavigation/VisualInstructionComponentGuidanceViewKind.swift b/Sources/MapboxCoreNavigation/VisualInstructionComponentGuidanceViewKind.swift deleted file mode 100644 index a217c36f983..00000000000 --- a/Sources/MapboxCoreNavigation/VisualInstructionComponentGuidanceViewKind.swift +++ /dev/null @@ -1,32 +0,0 @@ -import MapboxDirections -import MapboxNavigationNative - -extension VisualInstruction.Component.GuidanceViewKind { - - init(_ native: MapboxNavigationNative.BannerComponentSubType) { - switch native { - case .JCT: - self = .fork - case .signboard: - self = .signboard - case .sapaguidemap: - self = .serviceAreaGuideMap - case .sapa: - self = .serviceArea - case .aftertoll: - self = .afterToll - case .cityreal: - self = .realisticUrbanIntersection - case .ent: - self = .motorwayEntrance - case .exit: - self = .motorwayExit - case .tollbranch: - self = .tollBranch - case .directionboard: - self = .directionBoard - @unknown default: - fatalError("Unknown BannerComponentSubType value.") - } - } -} diff --git a/Sources/MapboxNavigation/CarPlayNavigationViewController.swift b/Sources/MapboxNavigation/CarPlayNavigationViewController.swift index 9e1df5a39b4..15a8eca0b86 100644 --- a/Sources/MapboxNavigation/CarPlayNavigationViewController.swift +++ b/Sources/MapboxNavigation/CarPlayNavigationViewController.swift @@ -1027,7 +1027,7 @@ open class CarPlayNavigationViewController: UIViewController, BuildingHighlighti if let cachedImage = ImageRepository.shared.cachedImageForKey(cacheKey) { return cachedImage } else { - guard case let .guidanceView(guidanceViewImageRepresentation, _, _) = guidanceView, + guard case let .guidanceView(guidanceViewImageRepresentation, _) = guidanceView, let guidanceImageURL = guidanceViewImageRepresentation.imageURL, let accessToken = navigationService.credentials.accessToken, let guidanceViewImageURL = URL(string: guidanceImageURL.absoluteString + "&access_token=" + accessToken) else { diff --git a/Sources/MapboxNavigation/InstructionPresenter.swift b/Sources/MapboxNavigation/InstructionPresenter.swift index 16a512d974d..698f8d8d18d 100644 --- a/Sources/MapboxNavigation/InstructionPresenter.swift +++ b/Sources/MapboxNavigation/InstructionPresenter.swift @@ -176,7 +176,7 @@ class InstructionPresenter { ?? NSAttributedString(string: text.text, attributes: defaultAttributes) case .lane(_, _, _): preconditionFailure("Lane component has no attributed string representation.") - case .guidanceView(_, let alternativeText, _): + case .guidanceView(_, let alternativeText): return NSAttributedString(string: alternativeText.text, attributes: defaultAttributes) } } diff --git a/Sources/MapboxNavigation/JunctionView.swift b/Sources/MapboxNavigation/JunctionView.swift index 7c3a944e81a..d01576a6c9d 100644 --- a/Sources/MapboxNavigation/JunctionView.swift +++ b/Sources/MapboxNavigation/JunctionView.swift @@ -56,7 +56,7 @@ public class JunctionView: UIImageView { guard let guidanceView = quaternaryInstruction?.components.first else { return } - if case .guidanceView(let guidanceViewImageRepresentation, _, _) = guidanceView { + if case .guidanceView(let guidanceViewImageRepresentation, _) = guidanceView { if let cachedImage = imageRepository.cachedImageForKey(guidanceView.cacheKey!) { image = cachedImage show(animated: true) diff --git a/Sources/MapboxNavigation/VisualInstructionComponent.swift b/Sources/MapboxNavigation/VisualInstructionComponent.swift index d4e4de66159..50f76384c2d 100644 --- a/Sources/MapboxNavigation/VisualInstructionComponent.swift +++ b/Sources/MapboxNavigation/VisualInstructionComponent.swift @@ -13,7 +13,7 @@ extension VisualInstruction.Component { return imageRepresentation.legacyCacheKey ?? "generic-" + alternativeText.text case .text, .delimiter, .lane: return nil - case .guidanceView(let guidanceViewRepresentation, _, _): + case .guidanceView(let guidanceViewRepresentation, _): guard let imageURL = guidanceViewRepresentation.imageURL else { return nil } return "guidance-" + imageURL.absoluteString } diff --git a/Sources/TestHelper/NavNative/TestNavigationStatusProvider.swift b/Sources/TestHelper/NavNative/TestNavigationStatusProvider.swift index 7651a1140ff..bfd067f3ad9 100644 --- a/Sources/TestHelper/NavNative/TestNavigationStatusProvider.swift +++ b/Sources/TestHelper/NavNative/TestNavigationStatusProvider.swift @@ -19,7 +19,7 @@ public final class TestNavigationStatusProvider { activeGuidanceInfo: ActiveGuidanceInfo? = nil) -> NavigationStatus { let fixLocation = FixLocation(location ?? CLLocation(latitude: 37.788443, longitude: -122.4020258)) let shield = Shield(baseUrl: "shield_url", displayRef: "ref", name: "shield", textColor: "") - let road = MapboxNavigationNative.Road(text: "name", imageBaseUrl: "base_image_url", shield: shield) + let road = MapboxNavigationNative.RoadName(text: "name", language: "lang", imageBaseUrl: "base_image_url", shield: shield) let mapMatch = MapMatch(position: .init(edgeId: 0, percentAlong: 0), proba: 42) let mapMatcherOutput = MapMatcherOutput(matches: [mapMatch], isTeleport: false) return .init(routeState: routeState, diff --git a/Tests/CocoaPodsTest/PodInstall/Podfile.lock b/Tests/CocoaPodsTest/PodInstall/Podfile.lock index df12d84f95a..0cc2a2a0587 100644 --- a/Tests/CocoaPodsTest/PodInstall/Podfile.lock +++ b/Tests/CocoaPodsTest/PodInstall/Podfile.lock @@ -1,28 +1,28 @@ PODS: - - MapboxCommon (23.2.1) - - MapboxCoreMaps (10.10.0): - - MapboxCommon (~> 23.2) + - MapboxCommon (23.3.0-beta.1) + - MapboxCoreMaps (10.11.0-beta.1): + - MapboxCommon (~> 23.3.0-beta) - MapboxCoreNavigation (2.11.0-alpha.1): - - MapboxDirections-pre (= 2.9.0-rc.2) + - MapboxDirections-pre (= 2.10.0-beta.1) - MapboxMobileEvents (~> 1.0) - - MapboxNavigationNative (~> 123.1) - - MapboxDirections-pre (2.9.0-rc.2): + - MapboxNavigationNative (~> 124.0.1) + - MapboxDirections-pre (2.10.0-beta.1): - Polyline (~> 5.0) - Turf (~> 2.6.1) - - MapboxMaps (10.10.1): - - MapboxCommon (= 23.2.1) - - MapboxCoreMaps (= 10.10.0) + - MapboxMaps (10.11.0-beta.1): + - MapboxCommon (= 23.3.0-beta.1) + - MapboxCoreMaps (= 10.11.0-beta.1) - MapboxMobileEvents (= 1.0.10) - Turf (~> 2.0) - MapboxMobileEvents (1.0.10) - MapboxNavigation (2.11.0-alpha.1): - MapboxCoreNavigation (= 2.11.0-alpha.1) - - MapboxMaps (~> 10.10) + - MapboxMaps (= 10.11.0-beta.1) - MapboxMobileEvents (~> 1.0) - MapboxSpeech (~> 2.0) - Solar-dev (~> 3.0) - - MapboxNavigationNative (123.2.0): - - MapboxCommon (~> 23.2) + - MapboxNavigationNative (124.0.1): + - MapboxCommon (~> 23.3.0-beta.1) - MapboxSpeech (2.1.1) - Polyline (5.1.0) - Solar-dev (3.0.1) @@ -52,14 +52,14 @@ EXTERNAL SOURCES: :path: "../../../" SPEC CHECKSUMS: - MapboxCommon: 235bb9c27a8985d982e17f216795b1f7ab526782 - MapboxCoreMaps: 4075a9e415b9b3ab6229d09623fef5f791826a5b - MapboxCoreNavigation: f0d375dd649f6c2703d84b0b0a42412dacea9985 - MapboxDirections-pre: 140113d2251ca97dac655b5244f857f1eafd562e - MapboxMaps: 0c2f7722016bc56aa27b5e6bcf72ae4df7a98670 + MapboxCommon: 672a965248a61c71441719600d0425f546e96b39 + MapboxCoreMaps: dc808848e0aa35a203cf64b0e286ea2ee05a663d + MapboxCoreNavigation: 32c8e4ac6b7f7b58dfcebdfa0bf20615e2539558 + MapboxDirections-pre: f1a5b06857420f3694408e153e39a1991b6c6749 + MapboxMaps: fcf19ee46a2dbf1b39a8c205f6cd045f4a83a213 MapboxMobileEvents: de50b3a4de180dd129c326e09cd12c8adaaa46d6 - MapboxNavigation: 91ef8a89c412700e0ce51e3d7a42c8989033ddfb - MapboxNavigationNative: c653ab9ec695989dc948f96d4cb6a554c9c86f96 + MapboxNavigation: 3cff051081378439d12f1999694761db37dda2b3 + MapboxNavigationNative: 94d5c683fc77e42ba27b85b297d1384e6c55f47a MapboxSpeech: cd25ef99c3a3d2e0da72620ff558276ea5991a77 Polyline: 2a1f29f87f8d9b7de868940f4f76deb8c678a5b1 Solar-dev: 4612dc9878b9fed2667d23b327f1d4e54e16e8d0 diff --git a/Tests/MapboxCoreNavigationIntegrationTests/MapboxCoreNavigationIntegrationTests.swift b/Tests/MapboxCoreNavigationIntegrationTests/MapboxCoreNavigationIntegrationTests.swift index 11a10eb7c3a..5b9c96805e0 100644 --- a/Tests/MapboxCoreNavigationIntegrationTests/MapboxCoreNavigationIntegrationTests.swift +++ b/Tests/MapboxCoreNavigationIntegrationTests/MapboxCoreNavigationIntegrationTests.swift @@ -601,7 +601,7 @@ class MapboxCoreNavigationIntegrationTests: TestCase { wait(for: [routeControllerProgressExpectation], timeout: waitForInterval) } - func testInstructionComponentsReportingWithGuidanceViewKinds() { + func testInstructionComponentsReportingWithGuidanceView() { let routeOptions = NavigationRouteOptions(coordinates: [ CLLocationCoordinate2D(latitude: 35.652935, longitude: 139.745061), CLLocationCoordinate2D(latitude: 35.650312, longitude: 139.737655) @@ -642,27 +642,21 @@ class MapboxCoreNavigationIntegrationTests: TestCase { return false } - guard case let .guidanceView(_, _, firstStepGuidanceViewKind) = routeProgress.currentLegProgress.leg.steps[0].instructionsDisplayedAlongStep?.first?.quaternaryInstruction?.components.first else { + guard case .guidanceView(_, _) = routeProgress.currentLegProgress.leg.steps[0].instructionsDisplayedAlongStep?.first?.quaternaryInstruction?.components.first else { XCTFail("Component should be valid.") return false } - - XCTAssertEqual(firstStepGuidanceViewKind, .realisticUrbanIntersection) - - guard case let .guidanceView(_, _, secondStepGuidanceViewKind) = routeProgress.currentLegProgress.leg.steps[1].instructionsDisplayedAlongStep?.first?.quaternaryInstruction?.components.first else { + + guard case .guidanceView(_, _) = routeProgress.currentLegProgress.leg.steps[1].instructionsDisplayedAlongStep?.first?.quaternaryInstruction?.components.first else { XCTFail("Component should be valid.") return false } - - XCTAssertEqual(secondStepGuidanceViewKind, .motorwayEntrance) - - guard case let .guidanceView(_, _, thirdStepGuidanceViewKind) = routeProgress.currentLegProgress.leg.steps[2].instructionsDisplayedAlongStep?.first?.quaternaryInstruction?.components.first else { + + guard case .guidanceView(_, _) = routeProgress.currentLegProgress.leg.steps[2].instructionsDisplayedAlongStep?.first?.quaternaryInstruction?.components.first else { XCTFail("Component should be valid.") return false } - XCTAssertEqual(thirdStepGuidanceViewKind, .fork) - return true }