diff --git a/Sources/MapboxNavigation/CarPlayManagerDelegate.swift b/Sources/MapboxNavigation/CarPlayManagerDelegate.swift index 6aeab3889f8..df299405313 100644 --- a/Sources/MapboxNavigation/CarPlayManagerDelegate.swift +++ b/Sources/MapboxNavigation/CarPlayManagerDelegate.swift @@ -63,7 +63,7 @@ public protocol CarPlayManagerDelegate: AnyObject, UnimplementedLogging { - parameter desiredSimulationMode: The desired simulation mode to use. - returns: A navigation service that manages location updates along `route`. */ - func carPlayManager(_ carPlayManager: CarPlayManager, navigationServiceFor routeResponse: RouteResponse, routeIndex: Int, routeOptions: RouteOptions, desiredSimulationMode: SimulationMode) -> NavigationService + func carPlayManager(_ carPlayManager: CarPlayManager, navigationServiceFor routeResponse: RouteResponse, routeIndex: Int, routeOptions: RouteOptions, desiredSimulationMode: SimulationMode) -> NavigationService? /** Called when the CarPlay manager fails to fetch a route. diff --git a/Tests/MapboxNavigationTests/CarPlayManagerTests.swift b/Tests/MapboxNavigationTests/CarPlayManagerTests.swift index 0a040492523..a3b92ca48a4 100644 --- a/Tests/MapboxNavigationTests/CarPlayManagerTests.swift +++ b/Tests/MapboxNavigationTests/CarPlayManagerTests.swift @@ -406,11 +406,11 @@ class CarPlayManagerSpec: QuickSpec { var customTripPreviewTextConfiguration: CPTripPreviewTextConfiguration? var customTrip: CPTrip? - func carPlayManager(_ carPlayManager: CarPlayManager, willPreview trip: CPTrip) -> (CPTrip) { + func carPlayManager(_ carPlayManager: CarPlayManager, willPreview trip: CPTrip) -> CPTrip { return customTrip ?? trip } - func carPlayManager(_ carPlayManager: CarPlayManager, willPreview trip: CPTrip, with previewTextConfiguration: CPTripPreviewTextConfiguration) -> (CPTripPreviewTextConfiguration) { + func carPlayManager(_ carPlayManager: CarPlayManager, willPreview trip: CPTrip, with previewTextConfiguration: CPTripPreviewTextConfiguration) -> CPTripPreviewTextConfiguration { return customTripPreviewTextConfiguration ?? previewTextConfiguration } @@ -423,7 +423,7 @@ class CarPlayManagerSpec: QuickSpec { } //TODO: ADD OPTIONS TO THIS DELEGATE METHOD - func carPlayManager(_ carPlayManager: CarPlayManager, navigationServiceFor routeResponse: RouteResponse, routeIndex: Int, routeOptions: RouteOptions, desiredSimulationMode: SimulationMode) -> NavigationService { + func carPlayManager(_ carPlayManager: CarPlayManager, navigationServiceFor routeResponse: RouteResponse, routeIndex: Int, routeOptions: RouteOptions, desiredSimulationMode: SimulationMode) -> NavigationService? { let directionsFake = Directions(credentials: Fixture.credentials) return MapboxNavigationService(routeResponse: routeResponse, routeIndex: routeIndex, routeOptions: routeOptions, directions: directionsFake, simulating: desiredSimulationMode) } diff --git a/Tests/MapboxNavigationTests/Support/CarPlayUtils.swift b/Tests/MapboxNavigationTests/Support/CarPlayUtils.swift index d29621aa8bb..48fd84df8ec 100644 --- a/Tests/MapboxNavigationTests/Support/CarPlayUtils.swift +++ b/Tests/MapboxNavigationTests/Support/CarPlayUtils.swift @@ -28,7 +28,7 @@ class CarPlayManagerFailureDelegateSpy: CarPlayManagerDelegate { return nil } - func carPlayManager(_ carPlayManager: CarPlayManager, navigationServiceFor routeResponse: RouteResponse, routeIndex: Int, routeOptions: RouteOptions, desiredSimulationMode: SimulationMode) -> NavigationService { + func carPlayManager(_ carPlayManager: CarPlayManager, navigationServiceFor routeResponse: RouteResponse, routeIndex: Int, routeOptions: RouteOptions, desiredSimulationMode: SimulationMode) -> NavigationService? { fatalError("This is an empty stub.") } @@ -63,7 +63,7 @@ class TestCarPlayManagerDelegate: CarPlayManagerDelegate { public var trailingBarButtons: [CPBarButton]? public var mapButtons: [CPMapButton]? - func carPlayManager(_ carPlayManager: CarPlayManager, navigationServiceFor routeResponse: RouteResponse, routeIndex: Int, routeOptions: RouteOptions, desiredSimulationMode: SimulationMode) -> NavigationService { + func carPlayManager(_ carPlayManager: CarPlayManager, navigationServiceFor routeResponse: RouteResponse, routeIndex: Int, routeOptions: RouteOptions, desiredSimulationMode: SimulationMode) -> NavigationService? { let response = Fixture.routeResponse(from: jsonFileName, options: routeOptions) let directionsClientSpy = DirectionsSpy() let service = MapboxNavigationService(routeResponse: response, routeIndex: 0, routeOptions: routeOptions, directions: directionsClientSpy, locationSource: NavigationLocationManager(), eventsManagerType: NavigationEventsManagerSpy.self, simulating: desiredSimulationMode)