From 2c14a0617716445466dffde8c80063779d9b252c Mon Sep 17 00:00:00 2001 From: "r.kuznetsov" Date: Tue, 20 Feb 2018 20:02:54 +0300 Subject: [PATCH] Added min and max mwm version to PW --- platform/marketing_service.cpp | 3 ++- platform/marketing_service.hpp | 3 ++- storage/country.cpp | 3 --- storage/storage.cpp | 21 +++++++++++++++++++++ 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/platform/marketing_service.cpp b/platform/marketing_service.cpp index 5b02fa75ea..4f059efe63 100644 --- a/platform/marketing_service.cpp +++ b/platform/marketing_service.cpp @@ -4,7 +4,8 @@ namespace marketing { // Tags. -char const * const kMapVersion = "map_version"; +char const * const kMapVersionMin = "map_version_min"; +char const * const kMapVersionMax = "map_version_max"; char const * const kMapListing = "map_listing"; char const * const kMapDownloadDiscovered = "map_download_discovered"; char const * const kMapLastDownloaded = "last_map_downloaded"; diff --git a/platform/marketing_service.hpp b/platform/marketing_service.hpp index bac4604c80..c2b7dc275f 100644 --- a/platform/marketing_service.hpp +++ b/platform/marketing_service.hpp @@ -9,7 +9,8 @@ namespace marketing { // Tags. -extern char const * const kMapVersion; +extern char const * const kMapVersionMin; +extern char const * const kMapVersionMax; extern char const * const kMapListing; extern char const * const kMapDownloadDiscovered; extern char const * const kMapLastDownloaded; diff --git a/storage/country.cpp b/storage/country.cpp index 4109846690..220ffde46c 100644 --- a/storage/country.cpp +++ b/storage/country.cpp @@ -329,9 +329,6 @@ int64_t LoadCountriesFromBuffer(string const & jsonBuffer, TCountryTree & countr { LOG(LERROR, (e.Msg())); } - stringstream ss; - ss << version; - GetPlatform().GetMarketingService().SendPushWooshTag(marketing::kMapVersion, ss.str()); return version; } diff --git a/storage/storage.cpp b/storage/storage.cpp index 73709ac666..5e6f00ca7a 100644 --- a/storage/storage.cpp +++ b/storage/storage.cpp @@ -4,6 +4,7 @@ #include "defines.hpp" #include "platform/local_country_file_utils.hpp" +#include "platform/marketing_service.hpp" #include "platform/mwm_version.hpp" #include "platform/platform.hpp" #include "platform/preferred_languages.hpp" @@ -27,6 +28,8 @@ #include "std/sstream.hpp" #include "std/target_os.hpp" +#include + #include "3party/Alohalytics/src/alohalytics.h" using namespace downloader; @@ -251,6 +254,9 @@ void Storage::RegisterAllLocalMaps(bool enableDiffs) sort(localFiles.begin(), localFiles.end(), compareByCountryAndVersion); + int64_t minVersion = std::numeric_limits().max(); + int64_t maxVersion = std::numeric_limits().min(); + auto i = localFiles.begin(); while (i != localFiles.end()) { @@ -266,6 +272,16 @@ void Storage::RegisterAllLocalMaps(bool enableDiffs) LocalCountryFile const & localFile = *i; string const & name = localFile.GetCountryName(); + if (name != WORLD_FILE_NAME && name != WORLD_COASTS_FILE_NAME && + name != WORLD_COASTS_OBSOLETE_FILE_NAME) + { + auto const version = localFile.GetVersion(); + if (version < minVersion) + minVersion = version; + if (version > maxVersion) + maxVersion = version; + } + TCountryId countryId = FindCountryIdByFile(name); if (IsLeaf(countryId)) RegisterCountryFiles(countryId, localFile.GetDirectory(), localFile.GetVersion()); @@ -277,6 +293,11 @@ void Storage::RegisterAllLocalMaps(bool enableDiffs) i = j; } + GetPlatform().GetMarketingService().SendPushWooshTag(marketing::kMapVersionMin, + strings::to_string(minVersion)); + GetPlatform().GetMarketingService().SendPushWooshTag(marketing::kMapVersionMax, + strings::to_string(maxVersion)); + FindAllDiffs(m_dataDir, m_notAppliedDiffs); if (enableDiffs) LoadDiffScheme();