diff options
author | Arsentiy Milchakov <milcars@mapswithme.com> | 2019-05-22 16:08:03 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2019-05-22 21:13:05 +0300 |
commit | 8feb8457c6b43cb0807085e13c78b247d0a20db9 (patch) | |
tree | d9c35522cfe55a5d8d8ff9a356206e53d84c951f /map | |
parent | 7f550f91f8521e3848d140f813fa681c12e51654 (diff) |
[core] review fixes + cross_reference is renamed to promo
Diffstat (limited to 'map')
-rw-r--r-- | map/CMakeLists.txt | 4 | ||||
-rw-r--r-- | map/cross_reference_delegate.hpp | 26 | ||||
-rw-r--r-- | map/framework.cpp | 19 | ||||
-rw-r--r-- | map/framework.hpp | 6 | ||||
-rw-r--r-- | map/place_page_info.hpp | 2 | ||||
-rw-r--r-- | map/promo_delegate.cpp (renamed from map/cross_reference_delegate.cpp) | 12 | ||||
-rw-r--r-- | map/promo_delegate.hpp | 26 |
7 files changed, 46 insertions, 49 deletions
diff --git a/map/CMakeLists.txt b/map/CMakeLists.txt index 29b8a66f78..a672419342 100644 --- a/map/CMakeLists.txt +++ b/map/CMakeLists.txt @@ -16,8 +16,8 @@ set( benchmark_tools.cpp booking_availability_filter.cpp booking_availability_filter.hpp - cross_reference_delegate.cpp - cross_reference_delegate.hpp + promo_delegate.cpp + promo_delegate.hpp booking_filter.hpp booking_filter_cache.cpp booking_filter_cache.hpp diff --git a/map/cross_reference_delegate.hpp b/map/cross_reference_delegate.hpp deleted file mode 100644 index 2d6cf9882a..0000000000 --- a/map/cross_reference_delegate.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include "partners_api/cross_reference_api.hpp" - -#include "geometry/point2d.hpp" - -#include <string> - -class DataSource; - -namespace search -{ -class CityFinder; -} - -class CrossReferenceDelegate : public cross_reference::Api::Delegate -{ -public: - CrossReferenceDelegate(DataSource const & dataSource, search::CityFinder & cityFinder); - - std::string GetCityOsmId(m2::PointD const & point) override; - -private: - DataSource const & m_dataSource; - search::CityFinder & m_cityFinder; -}; diff --git a/map/framework.cpp b/map/framework.cpp index d7b62253a1..7dd8031da8 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -1,7 +1,6 @@ #include "map/framework.hpp" #include "map/benchmark_tools.hpp" #include "map/chart_generator.hpp" -#include "map/cross_reference_delegate.hpp" #include "map/displayed_categories_modifiers.hpp" #include "map/everywhere_search_params.hpp" #include "map/ge0_parser.hpp" @@ -9,6 +8,7 @@ #include "map/gps_tracker.hpp" #include "map/notifications/notification_manager_delegate.hpp" #include "map/notifications/notification_queue.hpp" +#include "map/promo_delegate.hpp" #include "map/taxi_delegate.hpp" #include "map/user_mark.hpp" #include "map/utils.hpp" @@ -577,9 +577,8 @@ Framework::Framework(FrameworkParams const & params) GetPowerManager().Subscribe(this); GetPowerManager().Load(); - m_crossReferenceApi->SetDelegate( - make_unique<CrossReferenceDelegate>(m_model.GetDataSource(), *m_cityFinder)); - eye::Eye::Instance().Subscribe(m_crossReferenceApi.get()); + m_promoApi->SetDelegate(make_unique<PromoDelegate>(m_model.GetDataSource(), *m_cityFinder)); + eye::Eye::Instance().Subscribe(m_promoApi.get()); } Framework::~Framework() @@ -644,11 +643,11 @@ locals::Api * Framework::GetLocalsApi(platform::NetworkPolicy const & policy) return nullptr; } -cross_reference::Api * Framework::GetCrossReferenceApi(platform::NetworkPolicy const & policy) const +promo::Api * Framework::GetPromoApi(platform::NetworkPolicy const & policy) const { - ASSERT(m_crossReferenceApi, ()); + ASSERT(m_promoApi, ()); if (policy.CanUse()) - return m_crossReferenceApi.get(); + return m_promoApi.get(); return nullptr; } @@ -969,9 +968,9 @@ void Framework::FillInfoFromFeatureType(FeatureType & ft, place_page::Info & inf { info.SetSponsoredType(place_page::SponsoredType::Holiday); } - else if (ftypes::IsCrossReferenceCityChecker::Instance()(ft)) + else if (ftypes::IsPromoCatalogChecker::Instance()(ft)) { - info.SetSponsoredType(SponsoredType::CrossReference); + info.SetSponsoredType(SponsoredType::PromoCatalog); } FillLocalExperts(ft, info); @@ -1500,7 +1499,7 @@ void Framework::EnterForeground() m_trafficManager.OnEnterForeground(); m_routingManager.SetAllowSendingPoints(true); - m_crossReferenceApi->OnEnterForeground(); + m_promoApi->OnEnterForeground(); } void Framework::InitCountryInfoGetter() diff --git a/map/framework.hpp b/map/framework.hpp index 7f66e9fe5f..ac210b9c32 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -62,8 +62,8 @@ #include "partners_api/banner.hpp" #include "partners_api/booking_api.hpp" -#include "partners_api/cross_reference_api.hpp" #include "partners_api/locals_api.hpp" +#include "partners_api/promo_api.hpp" #include "partners_api/taxi_engine.hpp" #include "metrics/eye_info.hpp" @@ -230,7 +230,7 @@ protected: unique_ptr<booking::Api> m_bookingApi = make_unique<booking::Api>(); unique_ptr<locals::Api> m_localsApi = make_unique<locals::Api>(); - unique_ptr<cross_reference::Api> m_crossReferenceApi = make_unique<cross_reference::Api>(); + unique_ptr<promo::Api> m_promoApi = make_unique<promo::Api>(); df::DrapeApi m_drapeApi; @@ -278,7 +278,7 @@ public: booking::Api const * GetBookingApi(platform::NetworkPolicy const & policy) const; taxi::Engine * GetTaxiEngine(platform::NetworkPolicy const & policy); locals::Api * GetLocalsApi(platform::NetworkPolicy const & policy); - cross_reference::Api * GetCrossReferenceApi(platform::NetworkPolicy const & policy) const; + promo::Api * GetPromoApi(platform::NetworkPolicy const & policy) const; ugc::Api * GetUGCApi() { return m_ugcApi.get(); } ugc::Api const * GetUGCApi() const { return m_ugcApi.get(); } diff --git a/map/place_page_info.hpp b/map/place_page_info.hpp index 3394d2fb65..b93b4d4097 100644 --- a/map/place_page_info.hpp +++ b/map/place_page_info.hpp @@ -46,7 +46,7 @@ enum class SponsoredType Opentable, Partner, Holiday, - CrossReference, + PromoCatalog, }; enum class LocalAdsStatus diff --git a/map/cross_reference_delegate.cpp b/map/promo_delegate.cpp index 2f259dc615..d6fffa6555 100644 --- a/map/cross_reference_delegate.cpp +++ b/map/promo_delegate.cpp @@ -1,18 +1,16 @@ -#include "map/cross_reference_delegate.hpp" +#include "map/promo_delegate.hpp" #include "search/city_finder.hpp" #include "indexer/data_source.hpp" #include "indexer/ftypes_sponsored.hpp" -CrossReferenceDelegate::CrossReferenceDelegate(DataSource const & dataSource, - search::CityFinder & cityFinder) - : m_dataSource(dataSource) - , m_cityFinder(cityFinder) +PromoDelegate::PromoDelegate(DataSource const & dataSource, search::CityFinder & cityFinder) + : m_dataSource(dataSource), m_cityFinder(cityFinder) { } -std::string CrossReferenceDelegate::GetCityOsmId(m2::PointD const & point) +std::string PromoDelegate::GetCityId(m2::PointD const & point) { auto const featureId = m_cityFinder.GetCityFeatureID(point); @@ -24,7 +22,7 @@ std::string CrossReferenceDelegate::GetCityOsmId(m2::PointD const & point) if (!feature) return {}; - if (ftypes::IsCrossReferenceCityChecker::Instance()(*feature)) + if (ftypes::IsPromoCatalogChecker::Instance()(*feature)) return feature->GetMetadata().Get(feature::Metadata::FMD_SPONSORED_ID); return {}; diff --git a/map/promo_delegate.hpp b/map/promo_delegate.hpp new file mode 100644 index 0000000000..e81ec6c712 --- /dev/null +++ b/map/promo_delegate.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include "partners_api/promo_api.hpp" + +#include "geometry/point2d.hpp" + +#include <string> + +class DataSource; + +namespace search +{ +class CityFinder; +} + +class PromoDelegate : public promo::Api::Delegate +{ +public: + PromoDelegate(DataSource const & dataSource, search::CityFinder & cityFinder); + + std::string GetCityId(m2::PointD const & point) override; + +private: + DataSource const & m_dataSource; + search::CityFinder & m_cityFinder; +}; |