diff --git a/map/routing_manager.cpp b/map/routing_manager.cpp index 40bdfe06ad..42a0a0ed54 100644 --- a/map/routing_manager.cpp +++ b/map/routing_manager.cpp @@ -104,6 +104,9 @@ RoutingManager::RoutingManager(Callbacks && callbacks, Delegate & delegate) m_routingSession.SetReadyCallbacks( [this](Route const & route, IRouter::ResultCode code) { OnBuildRouteReady(route, code); }, [this](Route const & route, IRouter::ResultCode code) { OnRebuildRouteReady(route, code); }); + + m_routingSession.SetCheckpointCallback( + [this](size_t passedCheckpointIdx) { /* TODO insert reaction here */ }); } void RoutingManager::SetBookmarkManager(BookmarkManager * bmManager) diff --git a/routing/routing_session.cpp b/routing/routing_session.cpp index fdfcd9172c..5aab585f94 100644 --- a/routing/routing_session.cpp +++ b/routing/routing_session.cpp @@ -205,6 +205,7 @@ RoutingSession::State RoutingSession::OnLocationPositionChanged(GpsInfo const & { m_passedDistanceOnRouteMeters += m_route->GetTotalDistanceMeters(); SetState(RouteFinished); + m_checkpointCallback(m_checkpoints.GetPoints().size() - 1); alohalytics::TStringMap params = {{"router", m_route->GetRouterId()}, {"passedDistance", strings::to_string(m_passedDistanceOnRouteMeters)}, @@ -504,6 +505,11 @@ void RoutingSession::SetProgressCallback(TProgressCallback const & progressCallb m_progressCallback = progressCallback; } +void RoutingSession::SetCheckpointCallback(CheckpointCallback const & checkpointCallback) +{ + m_checkpointCallback = checkpointCallback; +} + void RoutingSession::SetUserCurrentPosition(m2::PointD const & position) { m_userCurrentPosition = position; diff --git a/routing/routing_session.hpp b/routing/routing_session.hpp index 372319fc41..2dfae480b9 100644 --- a/routing/routing_session.hpp +++ b/routing/routing_session.hpp @@ -77,6 +77,7 @@ public: typedef function TReadyCallback; typedef function TProgressCallback; + typedef function CheckpointCallback; RoutingSession(); @@ -148,6 +149,7 @@ public: void SetReadyCallbacks(TReadyCallback const & buildReadyCallback, TReadyCallback const & rebuildReadyCallback); void SetProgressCallback(TProgressCallback const & progressCallback); + void SetCheckpointCallback(CheckpointCallback const & checkpointCallback); // Sound notifications for turn instructions. void EnableTurnNotifications(bool enable); @@ -230,6 +232,7 @@ private: TReadyCallback m_buildReadyCallback; TReadyCallback m_rebuildReadyCallback; TProgressCallback m_progressCallback; + CheckpointCallback m_checkpointCallback; // Statistics parameters // Passed distance on route including reroutes