diff --git a/map/framework.cpp b/map/framework.cpp index 077f7370ae..6a68508b94 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -1728,3 +1728,16 @@ bool Framework::GetGuideInfo(storage::TIndex const & index, guides::GuideInfo & storage::TStatus t = GetCountryStatus(index); return (t == storage::EOnDisk && GetGuidesManager().GetGuideInfo(guideId, info)); } + +void Framework::GetGuidesInfosWithDownloadedMaps(vector & guides) +{ + vector maps; + GetLocalMaps(maps); + for (size_t i = 0; i < maps.size(); ++i) + { + guides::GuideInfo tmp; + my::GetNameWithoutExt(maps[i]); + if (GetGuidesManager().GetGuideInfo(maps[i], tmp)) + guides.push_back(tmp); + } +} diff --git a/map/framework.hpp b/map/framework.hpp index dd3749fd8a..aca2ca17a9 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -483,6 +483,7 @@ public: public: guides::GuidesManager & GetGuidesManager(); bool GetGuideInfo(storage::TIndex const & index, guides::GuideInfo & info); + void GetGuidesInfosWithDownloadedMaps(vector & guides); //@} }; diff --git a/storage/guides.cpp b/storage/guides.cpp index b9d8fafe2f..c9853e8d17 100644 --- a/storage/guides.cpp +++ b/storage/guides.cpp @@ -17,6 +17,7 @@ #define GUIDE_UPDATE_TIME_KEY "guideUpdateTime" +#define GUIDE_ADVERTISE_KEY "GuideAdvertised: " #define GUIDE_UPDATE_PERIOD 60 * 60 * 24 using namespace guides; @@ -121,6 +122,18 @@ bool GuidesManager::ValidateAndParseGuidesData(string const & jsonData) } } +bool GuidesManager::WasAdvertised(string const & countryId) +{ + bool flag = false; + Settings::Get(GUIDE_ADVERTISE_KEY + countryId, flag); + return flag; +} + +void GuidesManager::SetWasAdvertised(string const & countryId) +{ + Settings::Set(GUIDE_ADVERTISE_KEY + countryId, true); +} + void GuidesManager::SaveToFile() const { string const path = GetPlatform().WritableDir() + GetDataFileName(); diff --git a/storage/guides.hpp b/storage/guides.hpp index 60ae656b5d..8d76f94869 100644 --- a/storage/guides.hpp +++ b/storage/guides.hpp @@ -40,6 +40,8 @@ public: void SaveToFile() const; bool GetGuideInfo(string const & countryId, GuideInfo & appInfo) const; bool ValidateAndParseGuidesData(string const & jsonData); + bool WasAdvertised(string const & countryId); + void SetWasAdvertised(string const & countryId); private: void OnFinish(downloader::HttpRequest & request);