From ff582ea91f794deb271cd9e0468cac6635cf674f Mon Sep 17 00:00:00 2001 From: Arsentiy Milchakov Date: Fri, 8 May 2020 14:18:43 +0300 Subject: [PATCH] [guides on map] shown guides counting is added --- map/guides_manager.cpp | 9 +++++++++ map/guides_manager.hpp | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/map/guides_manager.cpp b/map/guides_manager.cpp index 7307a85b2f..d06c1b7d92 100644 --- a/map/guides_manager.cpp +++ b/map/guides_manager.cpp @@ -69,6 +69,7 @@ void GuidesManager::SetEnabled(bool enabled) Clear(); ChangeState(newState); + m_shownGuides.clear(); if (!enabled) return; @@ -209,6 +210,8 @@ GuidesManager::GuidesGallery GuidesManager::GetGallery() const auto url = url::Join(BOOKMARKS_CATALOG_FRONT_URL, languages::GetCurrentNorm(), "v3/mobilefront", info.m_id); InjectUTM(url, UTM::GuidesOnMapGallery); + InjectUTMTerm(url, std::to_string(m_shownGuides.size())); + item.m_url = std::move(url); item.m_imageUrl = info.m_imageUrl; item.m_title = info.m_name; @@ -253,6 +256,11 @@ void GuidesManager::SetActiveGuide(std::string const & guideId) UpdateActiveGuide(); } +uint64_t GuidesManager::GetShownGuidesCount() const +{ + return m_shownGuides.size(); +} + void GuidesManager::SetGalleryListener(GuidesGalleryChangedFn const & onGalleryChanged) { m_onGalleryChanged = onGalleryChanged; @@ -299,6 +307,7 @@ void GuidesManager::UpdateGuidesMarks() mark->SetGuideId(guide.m_guideInfo.m_id); mark->SetIsDownloaded(IsGuideDownloaded(guide.m_guideInfo.m_id)); mark->SetIndex(++m_nextMarkIndex); + m_shownGuides.insert(guide.m_guideInfo.m_id); } } UpdateActiveGuide(); diff --git a/map/guides_manager.hpp b/map/guides_manager.hpp index b7b9c6e6b3..c4698fae1e 100644 --- a/map/guides_manager.hpp +++ b/map/guides_manager.hpp @@ -15,6 +15,7 @@ #include #include #include +#include #include class GuidesManager final @@ -90,6 +91,8 @@ public: std::string GetActiveGuide() const; void SetActiveGuide(std::string const & guideId); + uint64_t GetShownGuidesCount() const; + using GuidesGalleryChangedFn = std::function; void SetGalleryListener(GuidesGalleryChangedFn const & onGalleryChangedFn); @@ -129,6 +132,8 @@ private: df::DrapeEngineSafePtr m_drapeEngine; uint32_t m_nextMarkIndex = 0; + + std::unordered_set m_shownGuides; }; std::string DebugPrint(GuidesManager::GuidesState state);