Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up delegate method names; use UUIDs for feedback IDs #1413

Merged
merged 2 commits into from
May 10, 2018

Conversation

1ec5
Copy link
Contributor

@1ec5 1ec5 commented May 10, 2018

This one is a doozy. Hot on the heels of #1378, most public NavigationViewControllerDelegate methods and some RouteControllerDelegate and TunnelIntersectionManagerDelegate methods have been renamed to conform to Cocoa naming conventions in both Swift and Objective-C. The biggest change is that all the NavigationViewControllerDelegate methods now begin with navigationViewController instead of sometimes beginning with navigationMapView. If an implementation needs access to the map view, it can use navigationViewController.mapView.

NavigationViewControllerDelegate changes:

v0.16.x This PR
navigationMapView(_:routeStyleLayerWithIdentifier:source:) navigationViewController(_:routeStyleLayerWithIdentifier:source:)
navigationMapView(_:routeCasingStyleLayerWithIdentifier:source:) navigationViewController(_:routeCasingStyleLayerWithIdentifier:source:)
navigationMapView(_:shapeFor:) navigationViewController(_:shapeFor:)
navigationMapView(_:simplifiedShapeFor:) navigationViewController(_:simplifiedShapeFor:)
navigationMapView(_:waypointStyleLayerWithIdentifier:source:) navigationViewController(_:waypointStyleLayerWithIdentifier:source:)
navigationMapView(_:waypointSymbolStyleLayerWithIdentifier:source:) navigationViewController(_:waypointSymbolStyleLayerWithIdentifier:source:)
navigationMapView(_:shapeFor:legIndex:) navigationViewController(_:shapeFor:legIndex:)
navigationMapView(_:didTap:) navigationViewController(_:didSelect:)
navigationMapView(_:imageFor:) navigationViewController(_:imageFor:)
navigationMapView(_:viewFor:) navigationViewController(_:viewFor:)
navigationViewController(_:didSend:feedbackType:) navigationViewController(_:didSendFeedbackAssigned:feedbackType:)

NavigationViewControllerDelegate changes in Objective-C only:

v0.16.x This PR
-navigationViewController:didArriveAt: -navigationViewController:didArriveAtWaypoint:
-navigationViewController:shouldDiscard: -navigationViewController:shouldDiscardLocation:
-navigationViewController:roadNameAt: -navigationViewController:roadNameAtLocation:

TunnelIntersectionManagerDelegate changes:

master This PR
tunnelIntersectionManager(_:willEnableAnimationAt:callback:) tunnelIntersectionManager(_:willEnableAnimationAt:completionHandler:)
tunnelIntersectionManager(_:willDisableAnimationAt:callback:) tunnelIntersectionManager(_:willDisableAnimationAt:completionHandler:)

Along for the ride, MapboxNavigation now represents feedback IDs as UUIDs instead of Strings, just like in Core Navigation, resulting in the following changes to RouteController:

v0.16.x This PR
recordFeedback(type:description:) returns String recordFeedback(type:description:) returns UUID
updateFeedback(feedbackId:type:source:description:) updateFeedback(uuid:type:source:description:)
cancelFeedback(feedbackId:) cancelFeedback(uuid:)

Finally, this PR fixes an issue (present in the current release) where NavigationViewController.navigationMapView(_:shapeDescribing:) (now navigationMapView(_:shapeFor:)) was getting called instead of navigationMapView(_:simplifiedShapeDescribing:) (now navigationMapView(_:simplifiedShapeFor:)).

Fixes #1376.

/cc @bsudekum @JThramer @vincethecoder

Named delegate method parameters in Objective-C. Replaced the first argument of several delegate methods with the sending object. Made method names more consistent between NavigationMapViewDelegate, RouteMapViewControllerDelegate, and NavigationViewControllerDelegate.

Represent feedback IDs as UUID instead of String, just like in Core Navigation.

Renamed “callback” to “completionHandler”.

Fixed an issue where NavigationViewControllerDelegate.navigationMapView(_:shapeFor:) was getting called instead of navigationMapView(_:simplifiedShapeFor:).

Fixed typos in documentation comments. Separated ViewController delegate implementations into extensions.
@1ec5 1ec5 added bug Something isn’t working op-ex Refactoring, Tech Debt or any other operational excellence work. Objective-C labels May 10, 2018
@1ec5 1ec5 added this to the v0.17.0 milestone May 10, 2018
@1ec5 1ec5 self-assigned this May 10, 2018
@@ -28,11 +29,27 @@
### Other changes

* `DistanceFormatter`, `ReplayLocationManager`, `SimulatedLocationManager`, `LanesView`, and `ManueverView` are now subclassable. ([#1345](https://github.com/mapbox/mapbox-navigation-ios/pull/1345]))
* Renamed several `NavigationMapViewDelegate` methods ([#1364](https://github.com/mapbox/mapbox-navigation-ios/pull/1364), [#1338](https://github.com/mapbox/mapbox-navigation-ios/pull/1338), [#1318](https://github.com/mapbox/mapbox-navigation-ios/pull/1318), [#1378](https://github.com/mapbox/mapbox-navigation-ios/pull/1378)):
* Renamed many `NavigationViewController` and `NavigationMapViewDelegate` methods ([#1364](https://github.com/mapbox/mapbox-navigation-ios/pull/1364), [#1338](https://github.com/mapbox/mapbox-navigation-ios/pull/1338), [#1318](https://github.com/mapbox/mapbox-navigation-ios/pull/1318), [#1378](https://github.com/mapbox/mapbox-navigation-ios/pull/1378), [#1413](https://github.com/mapbox/mapbox-navigation-ios/pull/1413)):
* `NavigationViewControllerDelegate.navigationViewControllerDidCancelNavigation(_:)` to `NavigationViewControllerDelegate.navigationViewControllerDidDismiss(_:byCanceling:)`
Copy link
Contributor

Choose a reason for hiding this comment

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

This list pretty huge, maybe put it behind a more/toggle button thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This changelog gets included in the jazzy docset’s cover page. Not sure whether jazzy’s Markdown formatter can handle <details>. Open to using a table, but then the concern is horizontal scrolling that could break page layouts.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I think a table might help.

Copy link
Contributor

@bsudekum bsudekum left a comment

Choose a reason for hiding this comment

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

Looks good, let's also test how this fairs in https://github.com/mapbox/navigation-ios-examples.

@1ec5
Copy link
Contributor Author

1ec5 commented May 10, 2018

Updated examples based on mapbox/mapbox-navigation-ios-examples#20.

@bsudekum bsudekum merged commit 0c0e54e into master May 10, 2018
@1ec5 1ec5 mentioned this pull request May 10, 2018
@1ec5 1ec5 added the backwards incompatible changes that break backwards compatibility of public API label Dec 18, 2018
@1ec5 1ec5 deleted the 1ec5-delegate-rename-1376 branch December 5, 2019 18:18
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 bug Something isn’t working op-ex Refactoring, Tech Debt or any other operational excellence work.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NavigationViewControllerDelegate methods should identify the view controller
2 participants