Skip to content

Commit

Permalink
CarPlay maneuver color fix (#4482)
Browse files Browse the repository at this point in the history
* vk/NAVIOS-1233-carplay-maneuver-color: fixed applying correct style type when generating maneuver arrow for carplay; CHANGELOG updated
  • Loading branch information
Udumft committed Jun 19, 2023
1 parent 06d83f2 commit 80557c2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
### CarPlay

* Fixed an issue where starting navigation while connected to CarPlay but not having window active resulted in CarPlay view to be stuck at preview screen. ([#4477](https://github.com/mapbox/mapbox-navigation-ios/pull/4477))
* Fixed an issue where maneuver arrow was not changing color following day/night style automatic toggling. ([#4482](https://github.com/mapbox/mapbox-navigation-ios/pull/4482))

### Other changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -919,9 +919,8 @@ open class CarPlayNavigationViewController: UIViewController, BuildingHighlighti

// Add maneuver arrow
if #available(iOS 13.0, *) {
let userInterfaceStyle = traitCollection.userInterfaceStyle
primaryManeuver.symbolImage = visualInstruction.primaryInstruction.maneuverImage(side: visualInstruction.drivingSide,
userInterfaceStyle: userInterfaceStyle)
type: styleManager?.currentStyleType)
} else {
primaryManeuver.symbolSet = visualInstruction.primaryInstruction.maneuverImageSet(side: visualInstruction.drivingSide)
}
Expand Down
15 changes: 6 additions & 9 deletions Sources/MapboxNavigation/VisualInstruction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,15 @@ extension VisualInstruction {
- returns: A `UIImage` representing the maneuver.
*/
@available(iOS 13.0, *)
func maneuverImage(side: DrivingSide, userInterfaceStyle: UIUserInterfaceStyle) -> UIImage? {
func maneuverImage(side: DrivingSide,
type styleType: StyleType?
) -> UIImage? {
let color: UIColor
switch userInterfaceStyle {
case .unspecified:
switch styleType {
case .day, .none:
color = .black
case .light:
color = .black
case .dark:
case .night:
color = .white
@unknown default:
Log.error("Error occured with unknown UIUserInterfaceStyle.", category: .navigationUI)
return nil
}
return maneuverViewImage(drivingSide: side,
color: color,
Expand Down

0 comments on commit 80557c2

Please sign in to comment.