diff options
author | Dmitry Donskoy <donskdmitry@mail.ru> | 2018-09-26 13:36:00 +0300 |
---|---|---|
committer | Aleksandr Zatsepin <alexzatsepin@users.noreply.github.com> | 2018-09-27 15:40:37 +0300 |
commit | 18a8fa453e948bc4addf552a22ea369d2534a8a1 (patch) | |
tree | af78e2ebe7e006495a88c152767ce520c5aec20f /partners_api | |
parent | 55b9ffe8d9c524519846b96746734127afc2e6fd (diff) |
[android] Added jni call, fixed https://github.com/yoksnod/omim/pull/5#discussion_r220502861, fixed review notes https://github.com/yoksnod/omim/pull/5#discussion_r220474557
Diffstat (limited to 'partners_api')
-rw-r--r-- | partners_api/ads_engine.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/partners_api/ads_engine.cpp b/partners_api/ads_engine.cpp index 73bc25f2f3..eca7aac959 100644 --- a/partners_api/ads_engine.cpp +++ b/partners_api/ads_engine.cpp @@ -44,17 +44,17 @@ std::vector<Banner> Engine::GetBanners(feature::TypesHolder const & types, for (auto const & item : m_banners) { - if (item.m_enabled) + if (!item.m_enabled) + continue; + + for (auto const & countryId : countryIds) { - for (auto const & countryId : countryIds) + auto const bannerId = item.m_container->GetBannerId(types, countryId, userLanguage); + // We need to add banner for every banner system just once. + if (!bannerId.empty()) { - auto const bannerId = item.m_container->GetBannerId(types, countryId, userLanguage); - // We need to add banner for every banner system just once. - if (!bannerId.empty()) - { - result.emplace_back(item.m_type, bannerId); - break; - } + result.emplace_back(item.m_type, bannerId); + break; } } } @@ -93,18 +93,16 @@ void Engine::DisableAdProvider(Banner::Type const type, Banner::Place const plac SetAdProviderEnabled(place == Banner::Place::Search ? m_searchBanners : m_banners, type, false); } -void Engine::EnableAdProvider(Banner::Type const type, Banner::Place place) -{ - SetAdProviderEnabled(place == Banner::Place::Search ? m_searchBanners : m_banners, type, true); -} - void Engine::SetAdProviderEnabled(std::vector<Engine::ContainerItem> & banners, Banner::Type const type, bool const isEnabled) { for (auto & item : banners) { if (item.m_type == type) + { item.m_enabled = isEnabled; + return; + } } } } // namespace ads |