diff --git a/iphone/Maps/Classes/CarPlay/CarPlayRouter.swift b/iphone/Maps/Classes/CarPlay/CarPlayRouter.swift index f65a142ab7..132b192647 100644 --- a/iphone/Maps/Classes/CarPlay/CarPlayRouter.swift +++ b/iphone/Maps/Classes/CarPlay/CarPlayRouter.swift @@ -268,8 +268,7 @@ extension CarPlayRouter { primaryManeuver.instructionVariants = [instructionVariant] if let imageName = routeInfo.turnImageName, let symbol = UIImage(named: imageName) { - primaryManeuver.symbolSet = CPImageSet(lightContentImage: symbol, - darkContentImage: symbol) + primaryManeuver.symbolImage = symbol } if let estimates = createEstimates(routeInfo) { primaryManeuver.initialTravelEstimates = estimates @@ -280,8 +279,7 @@ extension CarPlayRouter { let secondaryManeuver = CPManeuver() secondaryManeuver.userInfo = CPConstants.Maneuvers.secondary secondaryManeuver.instructionVariants = [L("then_turn")] - secondaryManeuver.symbolSet = CPImageSet(lightContentImage: symbol, - darkContentImage: symbol) + secondaryManeuver.symbolImage = symbol maneuvers.append(secondaryManeuver) } return maneuvers diff --git a/iphone/Maps/Classes/CarPlay/CarPlayService.swift b/iphone/Maps/Classes/CarPlay/CarPlayService.swift index 7e07b67e9c..7f1b5579ff 100644 --- a/iphone/Maps/Classes/CarPlay/CarPlayService.swift +++ b/iphone/Maps/Classes/CarPlay/CarPlayService.swift @@ -97,6 +97,18 @@ final class CarPlayService: NSObject { } return .unspecified } + + private var rootTemplateStyle: CPTripEstimateStyle { + get { + if #available(iOS 13.0, *) { + return sessionConfiguration?.contentStyle == .light ? .light : .dark + } + return .dark + } + set { + (interfaceController?.rootTemplate as? CPMapTemplate)?.tripEstimateStyle = newValue + } + } private func applyRootViewController() { guard let window = window else { return } @@ -114,6 +126,7 @@ final class CarPlayService: NSObject { private func applyBaseRootTemplate() { let mapTemplate = MapTemplateBuilder.buildBaseTemplate(positionMode: currentPositionMode) mapTemplate.mapDelegate = self + mapTemplate.tripEstimateStyle = rootTemplateStyle interfaceController?.setRootTemplate(mapTemplate, animated: true) FrameworkHelper.rotateMap(0.0, animated: false) } @@ -124,6 +137,7 @@ final class CarPlayService: NSObject { interfaceController?.setRootTemplate(mapTemplate, animated: true) router?.startNavigationSession(forTrip: trip, template: mapTemplate) if let estimates = createEstimates(routeInfo: routeInfo) { + mapTemplate.tripEstimateStyle = rootTemplateStyle mapTemplate.updateEstimates(estimates, for: trip) } @@ -314,7 +328,9 @@ extension CarPlayService: CPSessionConfigurationDelegate { @available(iOS 13.0, *) func sessionConfiguration(_ sessionConfiguration: CPSessionConfiguration, contentStyleChanged contentStyle: CPContentStyle) { - window?.overrideUserInterfaceStyle = contentStyle == .light ? .light : .dark + let isLight = contentStyle == .light + window?.overrideUserInterfaceStyle = isLight ? .light : .dark + rootTemplateStyle = isLight ? .light : .dark } } diff --git a/iphone/Maps/Classes/CarPlay/Template Builders/MapTemplateBuilder.swift b/iphone/Maps/Classes/CarPlay/Template Builders/MapTemplateBuilder.swift index 72a46f41ad..594fc7fbb5 100644 --- a/iphone/Maps/Classes/CarPlay/Template Builders/MapTemplateBuilder.swift +++ b/iphone/Maps/Classes/CarPlay/Template Builders/MapTemplateBuilder.swift @@ -16,6 +16,11 @@ final class MapTemplateBuilder { case redirectRoute case endRoute } + + private enum Constants { + static let carPlayGuidanceBackgroundColor = UIColor(46, 100, 51, 1.0) + } + // MARK: - CPMapTemplate builders class func buildBaseTemplate(positionMode: MWMMyPositionMode) -> CPMapTemplate { let mapTemplate = CPMapTemplate() @@ -100,6 +105,7 @@ final class MapTemplateBuilder { CarPlayService.shared.cancelCurrentTrip() } mapTemplate.trailingNavigationBarButtons = [endButton] + mapTemplate.guidanceBackgroundColor = Constants.carPlayGuidanceBackgroundColor } // MARK: - Conditional navigation buttons