blob: 6574349ef71f4aa7312e90edf992b9fee02ed949 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#include "partners_api/downloader_promo.hpp"
#include "partners_api/megafon_countries.hpp"
#include "partners_api/promo_api.hpp"
#include "storage/storage.hpp"
#include "base/string_utils.hpp"
namespace promo
{
// static
DownloaderPromo::Banner DownloaderPromo::GetBanner(storage::Storage const & storage,
Api const & promoApi, std::string const & mwmId,
std::string const & currentLocale,
bool hasRemoveAdsSubscription)
{
if (!hasRemoveAdsSubscription && ads::HasMegafonDownloaderBanner(storage, mwmId, currentLocale))
return {Type::Megafon, ads::GetMegafonDownloaderBannerUrl()};
auto const & cities = storage.GetMwmTopCityGeoIds();
auto const it = cities.find(mwmId);
if (it != cities.cend())
{
auto const id = strings::to_string(it->second.GetEncodedId());
return {Type::BookmarkCatalog, promoApi.GetPromoLinkForDownloader(id, currentLocale)};
}
return {};
}
} // namespace promo
|