Skip to content

Commit 736978b

Browse files
authored
Add SubType to VisualInstruction.Component. (#4296)
1 parent 22c93dc commit 736978b

File tree

15 files changed

+1459
-19
lines changed

15 files changed

+1459
-19
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
* 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))
1414
* 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))
15-
* MapboxCoreNavigation now requires [MapboxDirections v2.9.0-rc.1](https://github.com/mapbox/mapbox-directions-swift/releases/tag/v2.9.0-rc.1). ([#4300](https://github.com/mapbox/mapbox-navigation-ios/pull/4300))
15+
* 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))
1616
* Cocoapods podspec for MapboxCoreNavigation now references resources that will be copied into the application. ([#4280](https://github.com/mapbox/mapbox-navigation-ios/pull/4280))
1717

1818
### Routing

Cartfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
binary "https://api.mapbox.com/downloads/v2/carthage/mapbox-common/MapboxCommon.json" ~> 23.2.1
22
binary "https://api.mapbox.com/downloads/v2/carthage/mobile-navigation-native/MapboxNavigationNative.xcframework.json" ~> 123.1.0
3-
github "mapbox/mapbox-directions-swift" == 2.9.0-rc.1
3+
github "mapbox/mapbox-directions-swift" == 2.9.0-rc.2
44
github "mapbox/mapbox-events-ios" ~> 1.0.0

Cartfile.resolved

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
binary "https://api.mapbox.com/downloads/v2/carthage/mapbox-common/MapboxCommon.json" "23.2.1"
22
binary "https://api.mapbox.com/downloads/v2/carthage/mobile-navigation-native/MapboxNavigationNative.xcframework.json" "123.1.0"
3-
github "mapbox/mapbox-directions-swift" "v2.9.0-rc.1"
3+
github "mapbox/mapbox-directions-swift" "v2.9.0-rc.2"
44
github "mapbox/mapbox-events-ios" "v1.0.10"
55
github "mapbox/turf-swift" "v2.6.1"
66
github "mattgallagher/CwlPreconditionTesting" "2.1.0"

MapboxCoreNavigation.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Pod::Spec.new do |s|
4545
s.module_name = "MapboxCoreNavigation"
4646

4747
s.dependency "MapboxNavigationNative", "~> 123.1"
48-
s.dependency "MapboxDirections-pre", "2.9.0-rc.1"
48+
s.dependency "MapboxDirections-pre", "2.9.0-rc.2"
4949
s.dependency "MapboxMobileEvents", "~> 1.0"
5050

5151
s.swift_version = "5.5"

MapboxNavigation-SPM.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MapboxNavigation.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@
240240
8A18568726320B5900F8AE38 /* FollowingCameraOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A18568626320B5900F8AE38 /* FollowingCameraOptions.swift */; };
241241
8A18569926320B8F00F8AE38 /* OverviewCameraOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A18569826320B8F00F8AE38 /* OverviewCameraOptions.swift */; };
242242
8A1943A92685DC680066E2F8 /* NavigationGeocodedPlacemark.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A1943A82685DC680066E2F8 /* NavigationGeocodedPlacemark.swift */; };
243+
8A1FACF32942C6BA0051FE76 /* VisualInstructionComponentGuidanceViewKind.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A1FACF22942C6BA0051FE76 /* VisualInstructionComponentGuidanceViewKind.swift */; };
243244
8A2081CB25E07CED00F9B8A6 /* NavigationMapViewIdentifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A2081C925E07CED00F9B8A6 /* NavigationMapViewIdentifiers.swift */; };
244245
8A2081CC25E07CED00F9B8A6 /* RouteLineType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A2081CA25E07CED00F9B8A6 /* RouteLineType.swift */; };
245246
8A2354EE28877890003E42B4 /* BannerContainerViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A2354EA28877890003E42B4 /* BannerContainerViewDelegate.swift */; };
@@ -368,6 +369,7 @@
368369
8AF1D57028F0C8FE00041ED4 /* BannerDismissalViewControllerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AF1D56F28F0C8FE00041ED4 /* BannerDismissalViewControllerDelegate.swift */; };
369370
8AF1D57128F0C90B00041ED4 /* BannerDismissalViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AF1D56B28F0B10000041ED4 /* BannerDismissalViewController.swift */; };
370371
8AF1D57228F0C90E00041ED4 /* BannerDismissalViewControllerLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AF1D56D28F0B13500041ED4 /* BannerDismissalViewControllerLayout.swift */; };
372+
8AFCE2FA2964E2EE00EBFC11 /* route-with-instruction-components-with-subtype.json in Resources */ = {isa = PBXBuildFile; fileRef = 8AFCE2F92964E2EE00EBFC11 /* route-with-instruction-components-with-subtype.json */; };
371373
8AFF2D2326F137CB008267BF /* RoadObjectKind.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AFF2D2226F137CB008267BF /* RoadObjectKind.swift */; };
372374
8D1A5CD2212DDFCD0059BA4A /* DispatchTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D1A5CD1212DDFCD0059BA4A /* DispatchTimer.swift */; };
373375
8D24A2F62040960C0098CBF8 /* UIEdgeInsets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24A2F52040960C0098CBF8 /* UIEdgeInsets.swift */; };
@@ -910,6 +912,7 @@
910912
8A18568626320B5900F8AE38 /* FollowingCameraOptions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowingCameraOptions.swift; sourceTree = "<group>"; };
911913
8A18569826320B8F00F8AE38 /* OverviewCameraOptions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OverviewCameraOptions.swift; sourceTree = "<group>"; };
912914
8A1943A82685DC680066E2F8 /* NavigationGeocodedPlacemark.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationGeocodedPlacemark.swift; sourceTree = "<group>"; };
915+
8A1FACF22942C6BA0051FE76 /* VisualInstructionComponentGuidanceViewKind.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VisualInstructionComponentGuidanceViewKind.swift; sourceTree = "<group>"; };
913916
8A2081C925E07CED00F9B8A6 /* NavigationMapViewIdentifiers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationMapViewIdentifiers.swift; sourceTree = "<group>"; };
914917
8A2081CA25E07CED00F9B8A6 /* RouteLineType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RouteLineType.swift; sourceTree = "<group>"; };
915918
8A2354EA28877890003E42B4 /* BannerContainerViewDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BannerContainerViewDelegate.swift; sourceTree = "<group>"; };
@@ -1038,6 +1041,7 @@
10381041
8AF1D56B28F0B10000041ED4 /* BannerDismissalViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BannerDismissalViewController.swift; sourceTree = "<group>"; };
10391042
8AF1D56D28F0B13500041ED4 /* BannerDismissalViewControllerLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BannerDismissalViewControllerLayout.swift; sourceTree = "<group>"; };
10401043
8AF1D56F28F0C8FE00041ED4 /* BannerDismissalViewControllerDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BannerDismissalViewControllerDelegate.swift; sourceTree = "<group>"; };
1044+
8AFCE2F92964E2EE00EBFC11 /* route-with-instruction-components-with-subtype.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "route-with-instruction-components-with-subtype.json"; sourceTree = "<group>"; };
10411045
8AFF2D2226F137CB008267BF /* RoadObjectKind.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RoadObjectKind.swift; sourceTree = "<group>"; };
10421046
8B808F862487CFEC00EEE453 /* el */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = el; path = el.lproj/Navigation.strings; sourceTree = "<group>"; };
10431047
8B808F892487CFEC00EEE453 /* el */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = el; path = el.lproj/Localizable.strings; sourceTree = "<group>"; };
@@ -2134,6 +2138,7 @@
21342138
B47C1AE4261FD0A30078546C /* Fixtures */ = {
21352139
isa = PBXGroup;
21362140
children = (
2141+
8AFCE2F92964E2EE00EBFC11 /* route-with-instruction-components-with-subtype.json */,
21372142
8A474195294BBFDA00F231F9 /* route-with-amenities.json */,
21382143
B4953F5628762CAF0090E4F8 /* route-with-straight-line.json */,
21392144
B443A48A27BB0CB8000AF101 /* sprite-info.json */,
@@ -2290,6 +2295,7 @@
22902295
3A8187C824BDAE9C00708F19 /* URLSession.swift */,
22912296
11D1F89F2696048D0053A93F /* Dictionary+DeepMerge.swift */,
22922297
8AC85EA328628E4F003F8FC8 /* UIDevice.swift */,
2298+
8A1FACF22942C6BA0051FE76 /* VisualInstructionComponentGuidanceViewKind.swift */,
22932299
8A7B69912947AA0F00FFC3F5 /* AmenityType.swift */,
22942300
);
22952301
name = Extensions;
@@ -2912,6 +2918,7 @@
29122918
B4A78D2E261FD47700FDF212 /* route-with-mixed-road-classes.json in Resources */,
29132919
B4A78D2F261FD47700FDF212 /* sthlm-double-back-replay.json in Resources */,
29142920
B4BB0AD52704D1D7006F502D /* short_route.json in Resources */,
2921+
8AFCE2FA2964E2EE00EBFC11 /* route-with-instruction-components-with-subtype.json in Resources */,
29152922
B4A78D30261FD47700FDF212 /* route-with-road-classes-single-congestion.json in Resources */,
29162923
E2D1496D265CFB4D008135A3 /* Images.xcassets in Resources */,
29172924
B4A78D32261FD47700FDF212 /* sthlm-double-back.json in Resources */,
@@ -3438,6 +3445,7 @@
34383445
DA5F44C725F07AB700F573EC /* RoadName.swift in Sources */,
34393446
DA5F44AC25F07A6800F573EC /* RoadGraphPosition.swift in Sources */,
34403447
2E50E0E6264E49EF009D3848 /* OpenLRIdentifier.swift in Sources */,
3448+
8A1FACF32942C6BA0051FE76 /* VisualInstructionComponentGuidanceViewKind.swift in Sources */,
34413449
2BF398C1274BDEA8000C9A72 /* Directions.swift in Sources */,
34423450
2E5ACEE9288E877A00300ECA /* EventConstants.swift in Sources */,
34433451
353E69041EF0C4E5007B2AE5 /* SimulatedLocationManager.swift in Sources */,

Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ let package = Package(
2222
)
2323
],
2424
dependencies: [
25-
.package(name: "MapboxDirections", url: "https://github.com/mapbox/mapbox-directions-swift.git", .exact("2.9.0-rc.1")),
25+
.package(name: "MapboxDirections", url: "https://github.com/mapbox/mapbox-directions-swift.git", .exact("2.9.0-rc.2")),
2626
.package(name: "MapboxMobileEvents", url: "https://github.com/mapbox/mapbox-events-ios.git", from: "1.0.0"),
2727
.package(name: "MapboxNavigationNative", url: "https://github.com/mapbox/mapbox-navigation-native-ios.git", from: "123.1.0"),
2828
.package(name: "MapboxMaps", url: "https://github.com/mapbox/mapbox-maps-ios.git", from: "10.10.1"),
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import MapboxDirections
2+
import MapboxNavigationNative
3+
4+
extension VisualInstruction.Component.GuidanceViewKind {
5+
6+
init(_ native: MapboxNavigationNative.BannerComponentSubType) {
7+
switch native {
8+
case .JCT:
9+
self = .fork
10+
case .signboard:
11+
self = .signboard
12+
case .sapaguidemap:
13+
self = .serviceAreaGuideMap
14+
case .sapa:
15+
self = .serviceArea
16+
case .aftertoll:
17+
self = .afterToll
18+
case .cityreal:
19+
self = .realisticUrbanIntersection
20+
case .ent:
21+
self = .motorwayEntrance
22+
case .exit:
23+
self = .motorwayExit
24+
case .tollbranch:
25+
self = .tollBranch
26+
case .directionboard:
27+
self = .directionBoard
28+
@unknown default:
29+
fatalError("Unknown BannerComponentSubType value.")
30+
}
31+
}
32+
}

Sources/MapboxNavigation/InstructionPresenter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ class InstructionPresenter {
176176
?? NSAttributedString(string: text.text, attributes: defaultAttributes)
177177
case .lane(_, _, _):
178178
preconditionFailure("Lane component has no attributed string representation.")
179-
case .guidanceView(_, let alternativeText):
179+
case .guidanceView(_, let alternativeText, _):
180180
return NSAttributedString(string: alternativeText.text, attributes: defaultAttributes)
181181
}
182182
}

0 commit comments

Comments
 (0)