Skip to content

Removing CarPlayManager shared instance - #1792

Merged
vincethecoder merged 12 commits into
masterfrom
jerrad-kobe/carplaymanager-instance
Oct 24, 2018
Merged

vincethecoder merged 12 commits into
masterfrom
jerrad-kobe/carplaymanager-instance

Conversation

@vincethecoder

@vincethecoder vincethecoder commented Oct 22, 2018 •

Copy link
Copy Markdown
Contributor

In efforts to address current issues associated with the CarPlayManager.shared singleton, this branch provides an app delegate CarPlayManager property which could contain any additional information such a EventsManager if necessary.

/cc @akitchen @frederoni @1ec5

TODO:

  • Update the SDK cover doc to reflect changes to CarPlayManager.
  • Update change log to reflect recent changes.

vincethecoder and others added 2 commits October 22, 2018 15:30
…erty.

Co-authored-by: Jerrad Thramer <[email protected]>
Co-authored-by: Vincent Sam <[email protected]>
Co-authored-by: Jerrad Thramer <[email protected]>
Co-authored-by: Vincent Sam <[email protected]>
#if canImport(MapboxGeocoder)
func carPlayManager(_ carPlayManager: CarPlayManager, searchTemplate: CPSearchTemplate, updatedSearchText searchText: String, completionHandler: @escaping ([CPListItem]) -> Void) {
return CarPlayManager.searchTemplate(searchTemplate, updatedSearchText: searchText, completionHandler: completionHandler)
return CarPlayManager.searchTemplate(carPlayManager, searchTemplate: searchTemplate, updatedSearchText: searchText, completionHandler: completionHandler)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a pretty significant indication here that this should be an instance method on the carPlayManager itself

@akitchen akitchen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider converting the search template functionality to instance methods as a part of this. Note, this will be a breaking change in our search template functionality. /cc @mapbox/navigation-ios

Comment thread MapboxNavigation/CarPlayManager.swift Outdated
let navigationViewController = CarPlayNavigationViewController(with: service,
mapTemplate: navigationMapTemplate,
interfaceController: interfaceController)
interfaceController: interfaceController, manager: self)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline for the manager argument.

…lementations.

Co-authored-by: Jerrad Thramer <[email protected]>
Co-authored-by: Vincent Sam <[email protected]>
@akitchen akitchen changed the title CarPlayManager modified to an app delegate property. Removing CarPlayManager shared instance Oct 22, 2018
Jerrad Thramer and others added 2 commits October 22, 2018 17:40
…legate when iOS version is lower than 12.0. Added missing CoreLocation module missing when running app on iOS device with an iOS version prior to version 12.0.
Comment thread MapboxNavigation/CarPlayManager.swift Outdated


/**
The most recently selected search results.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: documentation doesn't correspond to the property

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

You do not create instances of this object yourself; instead, use the `CarPlayManager.shared` class property.

Messages declared in the `CPApplicationDelegate` protocol should be sent to this object in the containing application's application delegate. Implement `CarPlayManagerDelegate` in the containing application and assign an instance to the `delegate` property of the `CarPlayManager` shared instance.
Messages declared in the `CPApplicationDelegate` protocol should be sent to this object in the containing application's application delegate. Implement `CarPlayManagerDelegate` in the containing application and assign an instance to the `delegate` property of your `CarPlayManager` instance.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably note that the application should only have a single CarPlayManager instance at any given time. Effectively a singleton, but managed by the application instead of the SDK, to get around the access token problem.

@vincethecoder vincethecoder Oct 23, 2018 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@1ec5 has been address in this commit ✅

Comment thread Cartfile.resolved
@@ -1,5 +1,5 @@
binary "https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK.json" "4.5.0"
binary "https://www.mapbox.com/ios-sdk/MapboxNavigationNative.json" "3.1.5"
binary "https://www.mapbox.com/ios-sdk/MapboxNavigationNative.json" "3.2.0"

@frederoni frederoni Oct 23, 2018 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you'll get a failure on CI if you bump the MapboxNavigationNative to 3.2.0 in MapboxCoreNavigation.podspec. Don't forget to run pod update --repo update from MapboxCoreNavigationTests/CocoaPodsTest/PodInstall after you've changed the podspec.

@vincethecoder vincethecoder Oct 24, 2018 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@frederoni changes made in this commit ✅

@frederoni frederoni left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vincethecoder
vincethecoder merged commit 4053d1d into master Oct 24, 2018
@1ec5 1ec5 added the backwards incompatible changes that break backwards compatibility of public API label Dec 18, 2018
@1ec5
1ec5 deleted the jerrad-kobe/carplaymanager-instance branch December 5, 2019 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backwards incompatible changes that break backwards compatibility of public API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants