Skip to content

[CarPlay] Provide delegate to customize the trailing bottom map buttons. #1963

Closed

Description

@vincethecoder

Mapbox Navigation SDK version: 0.28.0

The current CarPlayManagerDelegate implements a delegate for customizing the map buttons per activity. Although the CarPlayMapViewController creates the recenter, pan and zoom in/out buttons on the map template, it's undiscoverable.

Hence, the CarPlayManagerDelegate.CarPlayManagerDelegate.carPlayManager(_:mapButtonsCompatibleWith:in:for:) should provide an additional parameter for a CarPlayMapViewController.

When that method gets implemented, the developer can choose to use the zoom in/out and pan buttons declared in the CarPlayMapViewController or provide a collection of custom map buttons to display in the trailing bottom buttons for the respective CarPlayActivity classifications.

The proposed delegate should look like this:

CarPlayManagerDelegate.carPlayManager(_:mapButtonsCompatibleWith:in:for:
carPlayMapViewController:)

The implementation of the delegate should look like this:

func carPlayManager(_ carPlayManager: CarPlayManager, 
mapButtonsCompatibleWith traitCollection: UITraitCollection, 
in template: CPTemplate, for activity: CarPlayActivity, 
carPlayMapViewController: CarPlayMapViewController) -> [CPMapButton]? {
   ...
   case .browsing:
   var mapButtons = [carPlayMapViewController.recenterButton,
                     carPlayMapViewController.zoomInButton,
                     carPlayMapViewController.zoomOutButton]
            
            if let mapTemplate = template as? CPMapTemplate {
                mapButtons.insert(carPlayMapViewController.createPanMapButton(for: 
                mapTemplate), at: 1)
            }
   return mapButtons 
   ...
}

/cc @mapbox/navigation-ios

Activity

  1. self-assigned this
    on Feb 7, 2019
  2. added
    feature
    CarPlay
    on Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

CarPlayfeature

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions