/
githubmirror
/
omim
Обзор
Документация
Войти
/
githubmirror
/
omim
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
partners_api/megafon_countries.cpp
63 строки
2 KB
Александр Зацепин
[android] Cleared Megafon countries
12 фев 2020, 14:37
12 фев 2020, 14:37
921a409
Код
Авторство
О чём код?
#include "partners_api/megafon_countries.hpp" #include <algorithm> namespace ads { namespace { storage::CountriesVec const kCountries = { // All supported countries are removed until Megafon contract is extended or renewed. }; bool IsRussianLocale(std::string const & currentLocale) { return currentLocale.find("ru") != std::string::npos; } bool ContainsCountry(storage::Storage const & storage, storage::CountriesVec const & countries, storage::CountriesVec const & referenceCountries) { for (auto const & c : countries) { if (std::find(referenceCountries.cbegin(), referenceCountries.cend(), c) != referenceCountries.cend()) { return true; } } return false; } } // namespace bool HasMegafonDownloaderBanner(storage::Storage const & storage, std::string const & mwmId, std::string const & currentLocale) { if (!IsRussianLocale(currentLocale)) return false; storage::CountriesVec countries; storage.GetTopmostNodesFor(mwmId, countries); return ContainsCountry(storage, countries, kCountries); } bool HasMegafonCategoryBanner(storage::Storage const & storage, storage::CountriesVec const & countries, std::string const & currentLocale) { if (!IsRussianLocale(currentLocale)) return false; return ContainsCountry(storage, countries, kCountries); } std::string GetMegafonDownloaderBannerUrl() { return "https://localads.maps.me/redirects/megafon_downloader"; } std::string GetMegafonCategoryBannerUrl() { return "https://localads.maps.me/redirects/megafon_search_category"; } } // namespace ads