mapbox / mapbox-navigation-ios

Turn-by-turn navigation logic and UI in Swift on iOS
https://docs.mapbox.com/ios/navigation/
Other
861 stars 310 forks source link

Set or change legIndex of RouteProgress #4168

Closed faliinitse closed 10 months ago

faliinitse commented 1 year ago

I want to change the legIndex of RouteProgress After it initializes in RouteController. I found that legIndex in RouteProgress is public but even if i set it then func updateIndexes(status: NavigationStatus, progress: RouteProgress) method in RouteController revert it back to whatever coming in status.legIndex.

I can also see that in theinit(route: Route, options: RouteOptions, legIndex: Int = 0, spokenInstructionIndex: Int = 0) of RouteProgress there is an extra parameter legIndex but I can't pass it from anywhere. Can any one help me with this issue?

I want to update the RouteProgress legIndex manually . Right now it is starting the progress from 0 legIndex. I want to set it by myself so it should calculate or give me the correct progress.

I found this Link but this solution only give option to go in a loop I want to set the x index directly and don't want to go in a loop because this method is a Async method.

In the above link it is refer to a method call public func advanceLegIndex(completionHandler: AdvanceLegCompletionHandler? = nil) but i can see that method is calling private func updateRouteLeg(to value: Int, completionHandler: AdvanceLegCompletionHandler? = nil) so instead of advanceLegIndex if you make the updateRouteLeg public then this issue will be resolve.

Thanks in advance

Udumft commented 1 year ago

Hi @faliinitse! Thank you for the suggestion. We are evaluating exposing this method publicly, but there are currently some technical problems. I will keep you updated on the progress.

Udumft commented 1 year ago

See related PR: https://github.com/mapbox/mapbox-navigation-ios/pull/4261