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

Native Route Objects #3824

Merged
merged 7 commits into from Apr 26, 2022
Merged

Native Route Objects #3824

merged 7 commits into from Apr 26, 2022

Conversation

Udumft
Copy link
Contributor

@Udumft Udumft commented Apr 13, 2022

Resolves #3689
This PR implements setting full route response data to NN.Router by setting alternative routes too. It also adds RerouteController and Navigator router setup which is a common starting point for future NN features integrations like Rerouting and Alternative routes.

Omitting changelog entry since this change should be completely transparent for now.

@Udumft Udumft added the Core Work related to core navigation and integrations. label Apr 13, 2022
@Udumft Udumft self-assigned this Apr 13, 2022
@mapbox-github-ci-issues-public-1

Breaking Changes in MapboxCoreNavigation

Breaking API Changes

NavigationSettings

  • removed method: initialize(directions:tileStoreConfiguration:) in NavigationSettings

@Udumft Udumft marked this pull request as ready for review April 13, 2022 14:38
@Udumft Udumft requested a review from a team April 13, 2022 14:38
@mapbox-github-ci-issues-public-1

Breaking Changes in MapboxCoreNavigation

Breaking API Changes

NavigationSettings

  • removed method: initialize(directions:tileStoreConfiguration:) in NavigationSettings

@Udumft
Copy link
Contributor Author

Udumft commented Apr 15, 2022

Breaking API bot is pointing towards a method which got additional parameter with a default value. This will not result in breaking changes

@mapbox-github-ci-issues-public-1

Breaking Changes in MapboxCoreNavigation

Breaking API Changes

NavigationSettings

  • removed method: initialize(directions:tileStoreConfiguration:) in NavigationSettings

Copy link
Contributor

@1ec5 1ec5 left a comment

Choose a reason for hiding this comment

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

Some stylistic comments, but it looks like you have things under control here.

Sources/MapboxCoreNavigation/RouteController.swift Outdated Show resolved Hide resolved
@@ -88,16 +101,20 @@ public class NavigationSettings {
fall back to the `NavigationSettings.directions` by default.
- tileStoreConfiguration: Options for configuring how map and navigation tiles are stored on the device. See
`TileStoreConfiguration` for more details.
- routingProviderSource: Configures the type of routing to be used by various SDK objects when providing route calculations.
Copy link
Contributor

Choose a reason for hiding this comment

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

(This change is mentioned in the changelog blurb being added in #3754.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, but without #3754 this change is unused. I've added it in this PR though to avoid conflicts between RerouteController and Alternative routes integrations.

Comment on lines 14 to 15
typealias SetMainRouteHandler = (RouteInterface?, _ legIndex: UInt32, _ completion: @escaping (Result<RouteInfo, Error>) -> Void) -> Void
typealias SetAlternativeRoutesHandler = ([RouteInterface], _ completion: @escaping (Result<[RouteAlternative], Error>) -> Void) -> Void
Copy link
Contributor

Choose a reason for hiding this comment

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

While we’re at it, we should give these type aliases less method-like names so that variables of this type can have less awkward names. How about MainRouteSelectionHandler and AlternativeRoutesAvailabilityHandler?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I feel it's better to have both main and alternative handlers to share similar naming pattern because they are doing similar action.

@mapbox-github-ci-issues-public-1

Breaking Changes in MapboxCoreNavigation

Breaking API Changes

NavigationSettings

  • removed method: initialize(directions:tileStoreConfiguration:) in NavigationSettings

@Udumft Udumft requested review from 1ec5 and a team April 20, 2022 08:50
@mapbox-github-ci-issues-public-1

Breaking Changes in MapboxCoreNavigation

Breaking API Changes

NavigationSettings

  • removed method: initialize(directions:tileStoreConfiguration:) in NavigationSettings

Sources/MapboxCoreNavigation/CoreNavigationNavigator.swift Outdated Show resolved Hide resolved
Sources/MapboxCoreNavigation/NativeHandlersFactory.swift Outdated Show resolved Hide resolved
lazy var configHandle: ConfigHandle = {
let customConfig = UserDefaults.standard.dictionary(forKey: customConfigKey) ?? [:]
let historyAutorecordingConfig = [
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not about auto-recording anymore. What if we call it defaultConfig or something like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right. It was like this, but seems to be overwritten during rebase.

uuid: sessionUUID,
legIndex: UInt32(legIndex)) { [weak self] result in
self?.sharedNavigator.setAlternativeRoutes(routes,
completion: { _ in })
completion?(result)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it okay that we don't wait until alternative routes are set and call this callback here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is. completion reports info about the main route, while setting of alternatives is irrelevant to it. It is also does not change the flow if alternatives set failed for some reason.

@mapbox-github-ci-issues-public-1

Breaking Changes in MapboxCoreNavigation

Breaking API Changes

NavigationSettings

  • removed method: initialize(directions:tileStoreConfiguration:) in NavigationSettings

@Udumft Udumft merged commit 3ae5d61 into main Apr 26, 2022
@Udumft Udumft deleted the vk/3689-nn-route branch April 26, 2022 14:49
@Udumft Udumft mentioned this pull request Apr 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Work related to core navigation and integrations.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NN Route Data object
3 participants