From 0d76c557aa25615e8c8b3df2e0a38d8c17d6528c Mon Sep 17 00:00:00 2001 From: Bobby Sudekum Date: Fri, 9 Mar 2018 14:09:44 -0800 Subject: [PATCH] Prevent double voice instruction before rerouting (#1215) * Prevent voice instruction before rerouting * change --- MapboxCoreNavigation/RouteController.swift | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/MapboxCoreNavigation/RouteController.swift b/MapboxCoreNavigation/RouteController.swift index 9057a22fadd..4420ca92c66 100644 --- a/MapboxCoreNavigation/RouteController.swift +++ b/MapboxCoreNavigation/RouteController.swift @@ -640,12 +640,11 @@ extension RouteController: CLLocationManagerDelegate { } // Check and see if the user is near a future step. - guard let nearestStep = routeProgress.currentLegProgress.closestStep(to: location.coordinate), - nearestStep.index != routeProgress.currentLegProgress.stepIndex else { + guard let nearestStep = routeProgress.currentLegProgress.closestStep(to: location.coordinate) else { return false } - if nearestStep.distance < radius { + if nearestStep.distance < RouteControllerUserLocationSnappingDistance { advanceStepIndex(to: nearestStep.index) return true }