From 8feb8457c6b43cb0807085e13c78b247d0a20db9 Mon Sep 17 00:00:00 2001 From: Arsentiy Milchakov Date: Wed, 22 May 2019 16:08:03 +0300 Subject: [PATCH] [core] review fixes + cross_reference is renamed to promo --- base/visitor.hpp | 6 +- indexer/ftypes_sponsored.hpp | 2 +- map/CMakeLists.txt | 4 +- map/cross_reference_delegate.hpp | 26 -- map/framework.cpp | 19 +- map/framework.hpp | 6 +- map/place_page_info.hpp | 2 +- ...erence_delegate.cpp => promo_delegate.cpp} | 12 +- map/promo_delegate.hpp | 26 ++ metrics/eye.cpp | 14 +- metrics/eye.hpp | 6 +- metrics/eye_info.hpp | 11 +- metrics/metrics_tests/eye_tests.cpp | 2 +- .../metrics_tests_support/eye_for_testing.hpp | 2 +- partners_api/CMakeLists.txt | 4 +- partners_api/cross_reference_api.cpp | 227 ------------------ .../partners_api_tests/CMakeLists.txt | 2 +- ...ss_reference_tests.cpp => promo_tests.cpp} | 40 +-- partners_api/promo_api.cpp | 221 +++++++++++++++++ ...{cross_reference_api.hpp => promo_api.hpp} | 24 +- tools/python/ResponseProvider.py | 6 +- tools/python/jsons.py | 2 +- xcode/map/map.xcodeproj/project.pbxproj | 13 + .../partners_api.xcodeproj/project.pbxproj | 17 ++ 24 files changed, 359 insertions(+), 335 deletions(-) delete mode 100644 map/cross_reference_delegate.hpp rename map/{cross_reference_delegate.cpp => promo_delegate.cpp} (54%) create mode 100644 map/promo_delegate.hpp delete mode 100644 partners_api/cross_reference_api.cpp rename partners_api/partners_api_tests/{cross_reference_tests.cpp => promo_tests.cpp} (74%) create mode 100644 partners_api/promo_api.cpp rename partners_api/{cross_reference_api.hpp => promo_api.hpp} (60%) diff --git a/base/visitor.hpp b/base/visitor.hpp index 3ac2bb8078..e73eaf4602 100644 --- a/base/visitor.hpp +++ b/base/visitor.hpp @@ -20,8 +20,12 @@ public: m_os << DebugPrint(t); } + // This override is implemented to support deserialization with optional values + // which could be declared by DECLARE_VISITOR_AND_DEBUG_PRINT macro. + // Because of this class is used just for serialize structures into strings, + // the second parameter is used for method signature compatibility only. template - void operator()(T const & t, T const & /* with optional value */, char const * name = nullptr) + void operator()(T const & t, T const &, char const * name = nullptr) { operator()(t, name); } diff --git a/indexer/ftypes_sponsored.hpp b/indexer/ftypes_sponsored.hpp index 44cad51818..bdc7bc2482 100644 --- a/indexer/ftypes_sponsored.hpp +++ b/indexer/ftypes_sponsored.hpp @@ -21,7 +21,7 @@ protected: SPONSORED_CHECKER(IsBookingChecker, "booking"); SPONSORED_CHECKER(IsOpentableChecker, "opentable"); SPONSORED_CHECKER(IsHolidayChecker, "holiday"); -SPONSORED_CHECKER(IsCrossReferenceCityChecker, "cross_reference"); +SPONSORED_CHECKER(IsPromoCatalogChecker, "promo_catalog"); #undef SPONSORED_CHECKER } // namespace ftypes 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 - -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(m_model.GetDataSource(), *m_cityFinder)); - eye::Eye::Instance().Subscribe(m_crossReferenceApi.get()); + m_promoApi->SetDelegate(make_unique(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 m_bookingApi = make_unique(); unique_ptr m_localsApi = make_unique(); - unique_ptr m_crossReferenceApi = make_unique(); + unique_ptr m_promoApi = make_unique(); 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 similarity index 54% rename from map/cross_reference_delegate.cpp rename to 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 + +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; +}; diff --git a/metrics/eye.cpp b/metrics/eye.cpp index 86087e7fa8..36c982b479 100644 --- a/metrics/eye.cpp +++ b/metrics/eye.cpp @@ -388,7 +388,7 @@ void Eye::RegisterMapObjectEvent(MapObject const & mapObject, MapObject::Event:: type == MapObject::Event::Type::BookingReviews || type == MapObject::Event::Type::BookingDetails) { - editableInfo->m_crossReferences.m_transitionToBookingTime = eventTime; + editableInfo->m_promo.m_transitionToBookingTime = eventTime; } if (!SaveLastMapObjectEvent(result)) @@ -404,14 +404,14 @@ void Eye::RegisterMapObjectEvent(MapObject const & mapObject, MapObject::Event:: }); } -void Eye::RegisterCrossReferenceAfterBookingShown(std::string const & cityId) +void Eye::RegisterPromoAfterBookingShown(std::string const & cityId) { auto const info = m_info.Get(); auto editableInfo = std::make_shared(*info); auto const now = Clock::now(); - editableInfo->m_crossReferences.m_lastTimeShownAfterBooking = now; - editableInfo->m_crossReferences.m_lastTimeShownAfterBookingCityId = cityId; + editableInfo->m_promo.m_lastTimeShownAfterBooking = now; + editableInfo->m_promo.m_lastTimeShownAfterBookingCityId = cityId; if (!Save(editableInfo)) return; @@ -420,7 +420,7 @@ void Eye::RegisterCrossReferenceAfterBookingShown(std::string const & cityId) { for (auto subscriber : m_subscribers) { - subscriber->OnCrossReferenceAfterBookingShown(now, cityId); + subscriber->OnPromoAfterBookingShown(now, cityId); } }); } @@ -506,11 +506,11 @@ void Eye::Event::MapObjectEvent(MapObject const & mapObject, MapObject::Event::T } // static -void Eye::Event::CrossReferenceAfterBookingShown(std::string const & cityId) +void Eye::Event::PromoAfterBookingShown(std::string const & cityId) { GetPlatform().RunTask(Platform::Thread::File, [cityId] { - Instance().RegisterCrossReferenceAfterBookingShown(cityId); + Instance().RegisterPromoAfterBookingShown(cityId); }); } } // namespace eye diff --git a/metrics/eye.hpp b/metrics/eye.hpp index fd341194f1..cd2596e14e 100644 --- a/metrics/eye.hpp +++ b/metrics/eye.hpp @@ -24,7 +24,7 @@ public: virtual void OnDiscoveryItemClicked(Discovery::Event event) {} virtual void OnLayerShown(Layer const & layer) {} virtual void OnMapObjectEvent(MapObject const & poi) {} - virtual void OnCrossReferenceAfterBookingShown(Time const & time, std::string const & cityId) {} + virtual void OnPromoAfterBookingShown(Time const & time, std::string const & cityId) {} }; // Note This class IS thread-safe. @@ -48,7 +48,7 @@ public: static void LayerShown(Layer::Type type); static void MapObjectEvent(MapObject const & mapObject, MapObject::Event::Type type, m2::PointD const & userPos); - static void CrossReferenceAfterBookingShown(std::string const & cityId); + static void PromoAfterBookingShown(std::string const & cityId); }; static Eye & Instance(); @@ -77,7 +77,7 @@ private: void RegisterLayerShown(Layer::Type type); void RegisterMapObjectEvent(MapObject const & mapObject, MapObject::Event::Type type, m2::PointD const & userPos); - void RegisterCrossReferenceAfterBookingShown(std::string const & cityId); + void RegisterPromoAfterBookingShown(std::string const & cityId); base::AtomicSharedPtr m_info; std::vector m_subscribers; diff --git a/metrics/eye_info.hpp b/metrics/eye_info.hpp index 53d6f349e8..8dbe5cfeeb 100644 --- a/metrics/eye_info.hpp +++ b/metrics/eye_info.hpp @@ -258,11 +258,11 @@ private: m2::RectD m_limitRect; }; -struct CrossReferences +struct Promo { - CrossReferences() = default; + Promo() = default; - DECLARE_VISITOR_AND_DEBUG_PRINT(CrossReferences, + DECLARE_VISITOR_AND_DEBUG_PRINT(Promo, visitor(m_transitionToBookingTime, "transitionToBookingTime"), visitor(m_lastTimeShownAfterBooking, "lastTimeShownAfterBooking")) Time m_transitionToBookingTime; @@ -278,8 +278,7 @@ struct InfoV0 DECLARE_VISITOR_AND_DEBUG_PRINT(InfoV0, visitor(m_booking, "booking"), visitor(m_bookmarks, "bookmarks"), visitor(m_discovery, "discovery"), visitor(m_layers, "layers"), - visitor(m_tips, "tips"), - visitor(m_crossReferences, CrossReferences(), "crossReferences")) + visitor(m_tips, "tips"), visitor(m_promo, Promo(), "promo")) Booking m_booking; Bookmarks m_bookmarks; @@ -287,7 +286,7 @@ struct InfoV0 Layers m_layers; Tips m_tips; MapObjects m_mapObjects; - CrossReferences m_crossReferences; + Promo m_promo; }; using Info = InfoV0; diff --git a/metrics/metrics_tests/eye_tests.cpp b/metrics/metrics_tests/eye_tests.cpp index 364c8e5062..4f4096a4a4 100644 --- a/metrics/metrics_tests/eye_tests.cpp +++ b/metrics/metrics_tests/eye_tests.cpp @@ -59,7 +59,7 @@ Info MakeDefaultInfoForTesting() eventInfo.m_type = MapObject::Event::Type::BookingMore; info.m_mapObjects.Add(poi); - info.m_crossReferences.m_lastTimeShownAfterBooking = Time(std::chrono::hours(100000)); + info.m_promo.m_lastTimeShownAfterBooking = Time(std::chrono::hours(100000)); return info; } diff --git a/metrics/metrics_tests_support/eye_for_testing.hpp b/metrics/metrics_tests_support/eye_for_testing.hpp index a2e026a9ad..0672acd0fe 100644 --- a/metrics/metrics_tests_support/eye_for_testing.hpp +++ b/metrics/metrics_tests_support/eye_for_testing.hpp @@ -26,7 +26,7 @@ class ScopedEyeForTesting { public: ScopedEyeForTesting() { EyeForTesting::ResetEye(); } - virtual ~ScopedEyeForTesting() { EyeForTesting::ResetEye(); } + ~ScopedEyeForTesting() { EyeForTesting::ResetEye(); } private: Platform::ThreadRunner m_runner; diff --git a/partners_api/CMakeLists.txt b/partners_api/CMakeLists.txt index 11f2d00fb9..f7fed45e97 100644 --- a/partners_api/CMakeLists.txt +++ b/partners_api/CMakeLists.txt @@ -16,8 +16,8 @@ set( booking_block_params.cpp booking_block_params.hpp booking_params_base.hpp - cross_reference_api.cpp - cross_reference_api.hpp + promo_api.cpp + promo_api.hpp facebook_ads.cpp facebook_ads.hpp google_ads.cpp diff --git a/partners_api/cross_reference_api.cpp b/partners_api/cross_reference_api.cpp deleted file mode 100644 index b488774cf6..0000000000 --- a/partners_api/cross_reference_api.cpp +++ /dev/null @@ -1,227 +0,0 @@ -#include "cross_reference_api.hpp" - -#include "metrics/eye.hpp" - -#include "platform/http_client.hpp" -#include "platform/platform.hpp" -#include "platform/preferred_languages.hpp" -#include "platform/settings.hpp" - -#include "base/assert.hpp" - -#include -#include -#include - -#include "3party/jansson/myjansson.hpp" - -using namespace cross_reference; - -using namespace std::chrono; - -namespace -{ -constexpr minutes kMinMinutesCountAfterBooking = minutes(5); -constexpr minutes kMaxMinutesCountAfterBooking = minutes(60); -constexpr hours kShowCrossReferenceNotRaterThan = hours(24); - -std::array const kSupportedBookingTypes = {{"tourism-hotel", "tourism-apartment", - "tourism-camp_site", "tourism-chalet", - "tourism-guest_house", "tourism-hostel", - "tourism-motel", "tourism-resort", - "sponsored-booking"}}; - -bool NeedToShowImpl(eye::Eye::InfoType const & eyeInfo) -{ - auto const timeSinceLastShown = - eye::Clock::now() - eyeInfo->m_crossReferences.m_lastTimeShownAfterBooking; - auto const timeSinceLastTransitionToBooking = - eye::Clock::now() - eyeInfo->m_crossReferences.m_transitionToBookingTime; - - return timeSinceLastTransitionToBooking >= kMinMinutesCountAfterBooking || - timeSinceLastTransitionToBooking <= kMaxMinutesCountAfterBooking || - timeSinceLastShown > kShowCrossReferenceNotRaterThan; -} - -void ParseCityGallery(std::string const & src, cross_reference::CityGallery & result) -{ - base::Json root(src.c_str()); - auto const dataArray = json_object_get(root.get(), "data"); - - auto const size = json_array_size(dataArray); - - result.reserve(size); - for (size_t i = 0; i < size; ++i) - { - cross_reference::CityGalleryItem item; - auto const obj = json_array_get(dataArray, i); - FromJSONObject(obj, "name", item.m_name); - FromJSONObject(obj, "url", item.m_url); - - auto const imageUrlObj = json_object_get(obj, "image_url"); - if (!json_is_null(imageUrlObj)) - FromJSON(imageUrlObj, item.m_imageUrl); - - FromJSONObject(obj, "access", item.m_access); - - auto const tierObj = json_object_get(obj, "tier"); - if (!json_is_null(tierObj)) - FromJSON(tierObj, item.m_tier); - - auto const authorObj = json_object_get(obj, "author"); - FromJSONObject(authorObj, "key_id", item.m_author.m_id); - FromJSONObject(authorObj, "name", item.m_author.m_name); - - auto const luxCategoryObj = json_object_get(obj, "lux_category"); - - auto const luxCategoryNameobj = json_object_get(luxCategoryObj, "name"); - if (!json_is_null(luxCategoryNameobj)) - FromJSON(luxCategoryNameobj, item.m_luxCategory.m_name); - - FromJSONObject(luxCategoryObj, "color", item.m_luxCategory.m_color); - - result.emplace_back(std::move(item)); - } -} - -std::string MakeCityGalleryUrl(std::string const & baseUrl, std::string const & osmId, - std::string const & lang) -{ - return baseUrl + osmId + "/?lang=" + lang; -} - -void GetCrossReferenceCityGalleryImpl(std::string const & baseUrl, std::string const & osmId, - CityGalleryCallback const & cb) -{ - if (osmId.empty()) - { - GetPlatform().RunTask(Platform::Thread::Gui, [cb]() { cb({}); }); - return; - } - - CityGallery result; - std::string httpResult; - if (!WebApi::GetCityGalleryByOsmId(baseUrl, osmId, languages::GetCurrentNorm(), httpResult)) - { - GetPlatform().RunTask(Platform::Thread::Gui, [cb]() { cb({}); }); - return; - } - - try - { - ParseCityGallery(httpResult, result); - } - catch (base::Json::Exception const & e) - { - LOG(LERROR, (e.Msg())); - result.clear(); - } - - GetPlatform().RunTask(Platform::Thread::Gui, [ cb, result = move(result) ]() { cb(result); }); -} -} // namespace - -namespace cross_reference -{ -// static -bool WebApi::GetCityGalleryByOsmId(std::string const & baseUrl, std::string const & osmId, - std::string const & lang, std::string & result) -{ - platform::HttpClient request(MakeCityGalleryUrl(baseUrl, osmId, lang)); - return request.RunHttpRequest(result); -} - -Api::Api(std::string const & baseUrl /* = "https://routes.maps.me/gallery/v1/city/" */) - : m_baseUrl(baseUrl) -{ -} - -void Api::SetDelegate(std::unique_ptr delegate) -{ - m_delegate = std::move(delegate); -} - -void Api::OnEnterForeground() -{ - m_bookingCrossReferenceAwaitingForId.clear(); - settings::TryGet("BookingCrossReferenceAwaitingForId", m_bookingCrossReferenceAwaitingForId); - - if (m_bookingCrossReferenceAwaitingForId.empty()) - return; - - auto const eyeInfo = eye::Eye::Instance().GetInfo(); - auto const timeSinceLastTransitionToBooking = - eye::Clock::now() - eyeInfo->m_crossReferences.m_transitionToBookingTime; - - if (timeSinceLastTransitionToBooking < kMinMinutesCountAfterBooking || - timeSinceLastTransitionToBooking > kMaxMinutesCountAfterBooking) - { - settings::Delete("BookingCrossReferenceAwaitingForId"); - m_bookingCrossReferenceAwaitingForId.clear(); - } -} - -bool Api::NeedToShow() const -{ - if (m_bookingCrossReferenceAwaitingForId.empty()) - return false; - - return NeedToShowImpl(eye::Eye::Instance().GetInfo()); -} - -std::string Api::GetCrossReferenceLinkAfterBooking() const -{ - auto const eyeInfo = eye::Eye::Instance().GetInfo(); - - if (m_bookingCrossReferenceAwaitingForId.empty() || !NeedToShowImpl(eyeInfo)) - return ""; - - return MakeCityGalleryUrl(m_baseUrl, m_bookingCrossReferenceAwaitingForId, - languages::GetCurrentNorm()); -} - -void Api::GetCrossReferenceCityGallery(std::string const & osmId, - CityGalleryCallback const & cb) const -{ - GetCrossReferenceCityGalleryImpl(m_baseUrl, osmId, cb); -} - -void Api::GetCrossReferenceCityGallery(m2::PointD const & point, - CityGalleryCallback const & cb) const -{ - CHECK(m_delegate, ()); - - GetCrossReferenceCityGalleryImpl(m_baseUrl, m_delegate->GetCityOsmId(point), cb); -} - -void Api::OnMapObjectEvent(eye::MapObject const & mapObject) -{ - CHECK(!mapObject.GetEvents().empty(), ()); - - auto const typeIt = std::find(kSupportedBookingTypes.cbegin(), kSupportedBookingTypes.cend(), - mapObject.GetBestType()); - - if (typeIt == kSupportedBookingTypes.cend()) - return; - - m2::PointD pos; - bool found = false; - switch (mapObject.GetEvents().back().m_type) - { - case eye::MapObject::Event::Type::BookingBook: - case eye::MapObject::Event::Type::BookingMore: - case eye::MapObject::Event::Type::BookingReviews: - case eye::MapObject::Event::Type::BookingDetails: - { - pos = mapObject.GetPos(); - found = true; - } - default: /* do nothing */; - } - - auto const osmId = found ? m_delegate->GetCityOsmId(pos) : ""; - - if (!osmId.empty()) - settings::Set("BookingCrossReferenceAwaitingForId", osmId); -} -} // namespace cross_reference diff --git a/partners_api/partners_api_tests/CMakeLists.txt b/partners_api/partners_api_tests/CMakeLists.txt index 5916607e7c..c9710dab6f 100644 --- a/partners_api/partners_api_tests/CMakeLists.txt +++ b/partners_api/partners_api_tests/CMakeLists.txt @@ -6,7 +6,7 @@ set( SRC ads_engine_tests.cpp booking_tests.cpp - cross_reference_tests.cpp + promo_tests.cpp facebook_tests.cpp google_tests.cpp maxim_tests.cpp diff --git a/partners_api/partners_api_tests/cross_reference_tests.cpp b/partners_api/partners_api_tests/promo_tests.cpp similarity index 74% rename from partners_api/partners_api_tests/cross_reference_tests.cpp rename to partners_api/partners_api_tests/promo_tests.cpp index 8b12c62aab..39758eff8a 100644 --- a/partners_api/partners_api_tests/cross_reference_tests.cpp +++ b/partners_api/partners_api_tests/promo_tests.cpp @@ -1,6 +1,6 @@ #include "testing/testing.hpp" -#include "partners_api/cross_reference_api.hpp" +#include "partners_api/promo_api.hpp" #include "platform/settings.hpp" @@ -16,7 +16,7 @@ using namespace platform::tests_support; namespace { -std::string const kTestOsmId = "TestOsmId"; +std::string const kTestId = "TestId"; class ScopedEyeWithAsyncGuiThread : public AsyncGuiThread { @@ -32,16 +32,16 @@ public: } }; -class DelegateForTesting : public cross_reference::Api::Delegate +class DelegateForTesting : public promo::Api::Delegate { public: - std::string GetCityOsmId(m2::PointD const &) override { return kTestOsmId; } + std::string GetCityId(m2::PointD const &) override { return kTestId; } }; } // namespace -UNIT_CLASS_TEST(ScopedEyeWithAsyncGuiThread, CrossReference_NeedToShow) +UNIT_CLASS_TEST(ScopedEyeWithAsyncGuiThread, Promo_NeedToShowAfterBooking) { - cross_reference::Api api; + promo::Api api; Info info; { MapObject poi; @@ -69,9 +69,9 @@ UNIT_CLASS_TEST(ScopedEyeWithAsyncGuiThread, CrossReference_NeedToShow) } EyeForTesting::SetInfo(info); - settings::Set("BookingCrossReferenceAwaitingForId", kTestOsmId); + settings::Set("BookingPromoAwaitingForId", kTestId); api.OnEnterForeground(); - TEST_EQUAL(api.NeedToShow(), false, ()); + TEST_EQUAL(api.NeedToShowAfterBooking(), false, ()); { MapObject poi; @@ -92,11 +92,11 @@ UNIT_CLASS_TEST(ScopedEyeWithAsyncGuiThread, CrossReference_NeedToShow) info.m_mapObjects.Add(poi); } - info.m_crossReferences.m_transitionToBookingTime = Clock::now() - std::chrono::hours(2); + info.m_promo.m_transitionToBookingTime = Clock::now() - std::chrono::hours(2); EyeForTesting::SetInfo(info); - settings::Set("BookingCrossReferenceAwaitingForId", kTestOsmId); + settings::Set("BookingPromoAwaitingForId", kTestId); api.OnEnterForeground(); - TEST_EQUAL(api.NeedToShow(), false, ()); + TEST_EQUAL(api.NeedToShowAfterBooking(), false, ()); { MapObject poi; @@ -127,21 +127,21 @@ UNIT_CLASS_TEST(ScopedEyeWithAsyncGuiThread, CrossReference_NeedToShow) info.m_mapObjects.Add(poi); } - info.m_crossReferences.m_transitionToBookingTime = Clock::now() - std::chrono::minutes(6); + info.m_promo.m_transitionToBookingTime = Clock::now() - std::chrono::minutes(6); EyeForTesting::SetInfo(info); - settings::Set("BookingCrossReferenceAwaitingForId", kTestOsmId); + settings::Set("BookingPromoAwaitingForId", kTestId); api.OnEnterForeground(); - TEST_EQUAL(api.NeedToShow(), true, ()); + TEST_EQUAL(api.NeedToShowAfterBooking(), true, ()); } -UNIT_CLASS_TEST(ScopedEyeWithAsyncGuiThread, CrossReference_GetCrossReferenceCityGallery) +UNIT_CLASS_TEST(ScopedEyeWithAsyncGuiThread, Promo_GetCityGallery) { - cross_reference::Api api("http://localhost:34568/gallery/city/"); + promo::Api api("http://localhost:34568/gallery/city/"); api.SetDelegate(std::make_unique()); { - cross_reference::CityGallery result{}; - api.GetCrossReferenceCityGallery(kTestOsmId, [&result](cross_reference::CityGallery const & gallery) + promo::CityGallery result{}; + api.GetCityGallery(kTestId, [&result](promo::CityGallery const & gallery) { result = gallery; testing::Notify(); @@ -151,9 +151,9 @@ UNIT_CLASS_TEST(ScopedEyeWithAsyncGuiThread, CrossReference_GetCrossReferenceCit TEST_EQUAL(result.size(), 2, ()); } { - cross_reference::CityGallery result{}; + promo::CityGallery result{}; m2::PointD pt; - api.GetCrossReferenceCityGallery(pt, [&result](cross_reference::CityGallery const & gallery) + api.GetCityGallery(pt, [&result](promo::CityGallery const & gallery) { result = gallery; testing::Notify(); diff --git a/partners_api/promo_api.cpp b/partners_api/promo_api.cpp new file mode 100644 index 0000000000..3d9ceea9ac --- /dev/null +++ b/partners_api/promo_api.cpp @@ -0,0 +1,221 @@ +#include "partners_api/promo_api.hpp" + +#include "indexer/classificator.hpp" +#include "indexer/ftypes_matcher.hpp" + +#include "platform/http_client.hpp" +#include "platform/platform.hpp" +#include "platform/preferred_languages.hpp" +#include "platform/settings.hpp" + +#include "base/assert.hpp" + +#include +#include +#include + +#include "3party/jansson/myjansson.hpp" + +using namespace std::chrono; + +namespace promo +{ +namespace +{ +constexpr minutes kMinMinutesAfterBooking = minutes(5); +constexpr minutes kMaxMinutesAfterBooking = minutes(60); +constexpr hours kShowPromoNotRaterThan = hours(24); + +bool NeedToShowImpl(eye::Eye::InfoType const & eyeInfo) +{ + auto const timeSinceLastShown = eye::Clock::now() - eyeInfo->m_promo.m_lastTimeShownAfterBooking; + auto const timeSinceLastTransitionToBooking = + eye::Clock::now() - eyeInfo->m_promo.m_transitionToBookingTime; + + return timeSinceLastTransitionToBooking >= kMinMinutesAfterBooking && + timeSinceLastTransitionToBooking <= kMaxMinutesAfterBooking && + timeSinceLastShown > kShowPromoNotRaterThan; +} + +void ParseCityGallery(std::string const & src, promo::CityGallery & result) +{ + base::Json root(src.c_str()); + auto const dataArray = json_object_get(root.get(), "data"); + + auto const size = json_array_size(dataArray); + + result.reserve(size); + for (size_t i = 0; i < size; ++i) + { + promo::CityGalleryItem item; + auto const obj = json_array_get(dataArray, i); + FromJSONObject(obj, "name", item.m_name); + FromJSONObject(obj, "url", item.m_url); + + auto const imageUrlObj = json_object_get(obj, "image_url"); + if (!json_is_null(imageUrlObj)) + FromJSON(imageUrlObj, item.m_imageUrl); + + FromJSONObject(obj, "access", item.m_access); + + auto const tierObj = json_object_get(obj, "tier"); + if (!json_is_null(tierObj)) + FromJSON(tierObj, item.m_tier); + + auto const authorObj = json_object_get(obj, "author"); + FromJSONObject(authorObj, "key_id", item.m_author.m_id); + FromJSONObject(authorObj, "name", item.m_author.m_name); + + auto const luxCategoryObj = json_object_get(obj, "lux_category"); + + auto const luxCategoryNameobj = json_object_get(luxCategoryObj, "name"); + if (!json_is_null(luxCategoryNameobj)) + FromJSON(luxCategoryNameobj, item.m_luxCategory.m_name); + + FromJSONObject(luxCategoryObj, "color", item.m_luxCategory.m_color); + + result.emplace_back(std::move(item)); + } +} + +std::string MakeCityGalleryUrl(std::string const & baseUrl, std::string const & id, + std::string const & lang) +{ + return baseUrl + id + "/?lang=" + lang; +} + +void GetPromoCityGalleryImpl(std::string const & baseUrl, std::string const & id, + CityGalleryCallback const & cb) +{ + ASSERT(!baseUrl.empty(), ()); + ASSERT_EQUAL(baseUrl.back(), '/', ()); + + if (id.empty()) + { + GetPlatform().RunTask(Platform::Thread::Gui, [cb]() { cb({}); }); + return; + } + + CityGallery result; + std::string httpResult; + if (!WebApi::GetCityGalleryById(baseUrl, id, languages::GetCurrentNorm(), httpResult)) + { + GetPlatform().RunTask(Platform::Thread::Gui, [cb]() { cb({}); }); + return; + } + + try + { + ParseCityGallery(httpResult, result); + } + catch (base::Json::Exception const & e) + { + LOG(LERROR, (e.Msg())); + result.clear(); + } + + GetPlatform().RunTask(Platform::Thread::Gui, [ cb, result = move(result) ]() { cb(result); }); +} +} // namespace + +// static +bool WebApi::GetCityGalleryById(std::string const & baseUrl, std::string const & id, + std::string const & lang, std::string & result) +{ + platform::HttpClient request(MakeCityGalleryUrl(baseUrl, id, lang)); + return request.RunHttpRequest(result); +} + +Api::Api(std::string const & baseUrl /* = "https://routes.maps.me/gallery/v1/city/" */) + : m_baseUrl(baseUrl) +{ +} + +void Api::SetDelegate(std::unique_ptr delegate) +{ + m_delegate = std::move(delegate); +} + +void Api::OnEnterForeground() +{ + m_bookingPromoAwaitingForId.clear(); + settings::TryGet("BookingPromoAwaitingForId", m_bookingPromoAwaitingForId); + + if (m_bookingPromoAwaitingForId.empty()) + return; + + auto const eyeInfo = eye::Eye::Instance().GetInfo(); + auto const timeSinceLastTransitionToBooking = + eye::Clock::now() - eyeInfo->m_promo.m_transitionToBookingTime; + + if (timeSinceLastTransitionToBooking < kMinMinutesAfterBooking || + timeSinceLastTransitionToBooking > kMaxMinutesAfterBooking) + { + settings::Delete("BookingPromoAwaitingForId"); + m_bookingPromoAwaitingForId.clear(); + } +} + +bool Api::NeedToShowAfterBooking() const +{ + if (m_bookingPromoAwaitingForId.empty()) + return false; + + return NeedToShowImpl(eye::Eye::Instance().GetInfo()); +} + +std::string Api::GetPromoLinkAfterBooking() const +{ + auto const eyeInfo = eye::Eye::Instance().GetInfo(); + + if (m_bookingPromoAwaitingForId.empty() || !NeedToShowImpl(eyeInfo)) + return ""; + + return MakeCityGalleryUrl(m_baseUrl, m_bookingPromoAwaitingForId, languages::GetCurrentNorm()); +} + +void Api::GetCityGallery(std::string const & id, CityGalleryCallback const & cb) const +{ + GetPromoCityGalleryImpl(m_baseUrl, id, cb); +} + +void Api::GetCityGallery(m2::PointD const & point, CityGalleryCallback const & cb) const +{ + CHECK(m_delegate, ()); + + GetPromoCityGalleryImpl(m_baseUrl, m_delegate->GetCityId(point), cb); +} + +void Api::OnMapObjectEvent(eye::MapObject const & mapObject) +{ + CHECK(!mapObject.GetEvents().empty(), ()); + + auto const bestType = classif().GetTypeByReadableObjectName(mapObject.GetBestType()); + + if (!ftypes::IsHotelChecker::Instance()(bestType) && + !ftypes::IsBookingHotelChecker::Instance()(bestType)) + { + return; + } + + m2::PointD pos; + bool found = false; + switch (mapObject.GetEvents().back().m_type) + { + case eye::MapObject::Event::Type::BookingBook: + case eye::MapObject::Event::Type::BookingMore: + case eye::MapObject::Event::Type::BookingReviews: + case eye::MapObject::Event::Type::BookingDetails: + { + pos = mapObject.GetPos(); + found = true; + } + default: /* do nothing */; + } + + auto const id = found ? m_delegate->GetCityId(pos) : ""; + + if (!id.empty()) + settings::Set("BookingPromoAwaitingForId", id); +} +} // namespace promo diff --git a/partners_api/cross_reference_api.hpp b/partners_api/promo_api.hpp similarity index 60% rename from partners_api/cross_reference_api.hpp rename to partners_api/promo_api.hpp index cfd37be713..c75aac7b6f 100644 --- a/partners_api/cross_reference_api.hpp +++ b/partners_api/promo_api.hpp @@ -7,8 +7,9 @@ #include #include #include +#include -namespace cross_reference +namespace promo { struct Author { @@ -37,8 +38,8 @@ using CityGallery = std::vector; class WebApi { public: - static bool GetCityGalleryByOsmId(std::string const & baseUrl, std::string const & osmId, - std::string const & lang, std::string & result); + static bool GetCityGalleryById(std::string const & baseUrl, std::string const & id, + std::string const & lang, std::string & result); }; using CityGalleryCallback = std::function; @@ -51,18 +52,17 @@ public: public: virtual ~Delegate() = default; - virtual std::string GetCityOsmId(m2::PointD const & point) = 0; + virtual std::string GetCityId(m2::PointD const & point) = 0; }; explicit Api(std::string const & baseUrl = "https://routes.maps.me/gallery/v1/city/"); void SetDelegate(std::unique_ptr delegate); void OnEnterForeground(); - bool NeedToShow() const; - std::string GetCrossReferenceLinkAfterBooking() const; - void GetCrossReferenceCityGallery(std::string const & osmId, - CityGalleryCallback const & cb) const; - void GetCrossReferenceCityGallery(m2::PointD const & point, CityGalleryCallback const & cb) const; + bool NeedToShowAfterBooking() const; + std::string GetPromoLinkAfterBooking() const; + void GetCityGallery(std::string const & id, CityGalleryCallback const & cb) const; + void GetCityGallery(m2::PointD const & point, CityGalleryCallback const & cb) const; // eye::Subscriber overrides: void OnMapObjectEvent(eye::MapObject const & poi) override; @@ -70,7 +70,7 @@ public: private: std::unique_ptr m_delegate; - std::string m_baseUrl; - std::string m_bookingCrossReferenceAwaitingForId; + std::string const m_baseUrl; + std::string m_bookingPromoAwaitingForId; }; -} // namespace cross_reference +} // namespace promo diff --git a/tools/python/ResponseProvider.py b/tools/python/ResponseProvider.py index 31569d6f3d..61551b5b1c 100644 --- a/tools/python/ResponseProvider.py +++ b/tools/python/ResponseProvider.py @@ -147,7 +147,7 @@ class ResponseProvider: "/partners/taxi_info": self.partners_yandex_taxi_info, "/partners/get-offers-in-bbox/": self.partners_rent_nearby, "/partners/CalculateByCoords": self.partners_calculate_by_coords, - "/gallery/city/TestOsmId/": self.cross_reference_gallery_city, + "/gallery/city/TestId/": self.promo_gallery_city, }[url]() except: return self.test_404() @@ -240,8 +240,8 @@ class ResponseProvider: def partners_calculate_by_coords(self): return Payload(jsons.PARTNERS_CALCULATE_BY_COORDS) - def cross_reference_gallery_city(self): - return Payload(jsons.CROSS_REFERENCE_GALLERY_CITY) + def promo_gallery_city(self): + return Payload(jsons.PROMO_GALLERY_CITY) def kill(self): logging.debug("Kill called in ResponseProvider") diff --git a/tools/python/jsons.py b/tools/python/jsons.py index d4a541bb32..be08c3eb0e 100644 --- a/tools/python/jsons.py +++ b/tools/python/jsons.py @@ -514,7 +514,7 @@ PARTNERS_CALCULATE_BY_COORDS = """ } """ -CROSS_REFERENCE_GALLERY_CITY = """ +PROMO_GALLERY_CITY = """ { "data": [ { diff --git a/xcode/map/map.xcodeproj/project.pbxproj b/xcode/map/map.xcodeproj/project.pbxproj index 6b33e14209..b90b8016e8 100644 --- a/xcode/map/map.xcodeproj/project.pbxproj +++ b/xcode/map/map.xcodeproj/project.pbxproj @@ -23,6 +23,9 @@ 34DDA1821DBE5DF40088A609 /* libtracking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 34DDA1801DBE5DF40088A609 /* libtracking.a */; }; 3D0AEAFC1FBB0FF400AD042B /* libgenerator_tests_support.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D0AEAFF1FBB0FF400AD042B /* libgenerator_tests_support.a */; }; 3D0AEAFE1FBB0FF400AD042B /* libsearch_tests_support.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D0AEB011FBB0FF400AD042B /* libsearch_tests_support.a */; }; + 3D18DC3C22956DD100A583A6 /* framework_light_delegate.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3D18DC3922956DD100A583A6 /* framework_light_delegate.hpp */; }; + 3D18DC3D22956DD100A583A6 /* promo_delegate.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3D18DC3A22956DD100A583A6 /* promo_delegate.hpp */; }; + 3D18DC3E22956DD100A583A6 /* promo_delegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D18DC3B22956DD100A583A6 /* promo_delegate.cpp */; }; 3D47B2931F054BC5000828D2 /* taxi_delegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D47B2901F054BC5000828D2 /* taxi_delegate.cpp */; }; 3D47B2941F054BC5000828D2 /* taxi_delegate.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3D47B2911F054BC5000828D2 /* taxi_delegate.hpp */; }; 3D47B2C71F20EF06000828D2 /* displayed_categories_modifiers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D47B2C51F20EF06000828D2 /* displayed_categories_modifiers.cpp */; }; @@ -266,6 +269,9 @@ 3D0AEAFF1FBB0FF400AD042B /* libgenerator_tests_support.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libgenerator_tests_support.a; sourceTree = BUILT_PRODUCTS_DIR; }; 3D0AEB001FBB0FF400AD042B /* libindexer_tests_support.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libindexer_tests_support.a; sourceTree = BUILT_PRODUCTS_DIR; }; 3D0AEB011FBB0FF400AD042B /* libsearch_tests_support.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libsearch_tests_support.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 3D18DC3922956DD100A583A6 /* framework_light_delegate.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = framework_light_delegate.hpp; sourceTree = ""; }; + 3D18DC3A22956DD100A583A6 /* promo_delegate.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = promo_delegate.hpp; sourceTree = ""; }; + 3D18DC3B22956DD100A583A6 /* promo_delegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = promo_delegate.cpp; sourceTree = ""; }; 3D47B2901F054BC5000828D2 /* taxi_delegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = taxi_delegate.cpp; sourceTree = ""; }; 3D47B2911F054BC5000828D2 /* taxi_delegate.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = taxi_delegate.hpp; sourceTree = ""; }; 3D47B2C51F20EF06000828D2 /* displayed_categories_modifiers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = displayed_categories_modifiers.cpp; sourceTree = ""; }; @@ -793,6 +799,9 @@ 675345BD1A4054AD00A0A8C3 /* map */ = { isa = PBXGroup; children = ( + 3D18DC3922956DD100A583A6 /* framework_light_delegate.hpp */, + 3D18DC3B22956DD100A583A6 /* promo_delegate.cpp */, + 3D18DC3A22956DD100A583A6 /* promo_delegate.hpp */, 3DD692B2220AD240001C3C62 /* caching_address_getter.hpp */, 3DEE1AD921EE03B400054A91 /* power_management */, 45201E921CE4AC90008A4842 /* api_mark_point.cpp */, @@ -946,6 +955,7 @@ BBA014AE2073C784007402E4 /* bookmark_helpers.hpp in Headers */, F6B283061C1B03320081957A /* gps_track_filter.hpp in Headers */, 3DD1166821888AAC007A2ED4 /* notification_queue_storage.hpp in Headers */, + 3D18DC3D22956DD100A583A6 /* promo_delegate.hpp in Headers */, 3D62CBCC20F4DFD600E7BB6E /* search_product_info.hpp in Headers */, F69687C8201B4A3600457650 /* discovery_search_params.hpp in Headers */, 3D4E99831FB462B60025B48C /* viewport_search_params.hpp in Headers */, @@ -954,6 +964,7 @@ 3D4E99821FB462B60025B48C /* everywhere_search_params.hpp in Headers */, 675346751A4054E800A0A8C3 /* mwm_url.hpp in Headers */, 6753464B1A4054E800A0A8C3 /* bookmark.hpp in Headers */, + 3D18DC3C22956DD100A583A6 /* framework_light_delegate.hpp in Headers */, 4564FA82209497A70043CCFB /* bookmark_catalog.hpp in Headers */, 3DA5714020B5CC80007BDE27 /* booking_filter_params.hpp in Headers */, 3D47B2941F054BC5000828D2 /* taxi_delegate.hpp in Headers */, @@ -1082,6 +1093,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -1158,6 +1170,7 @@ BB4E5F251FCC664A00A77250 /* transit_display.cpp in Sources */, 3DD1166A21888AAD007A2ED4 /* notification_queue_storage.cpp in Sources */, 3D47B2931F054BC5000828D2 /* taxi_delegate.cpp in Sources */, + 3D18DC3E22956DD100A583A6 /* promo_delegate.cpp in Sources */, 675346741A4054E800A0A8C3 /* mwm_url.cpp in Sources */, 3DA5714220B5CC80007BDE27 /* booking_filter_processor.cpp in Sources */, 347B60761DD9926D0050FA24 /* traffic_manager.cpp in Sources */, diff --git a/xcode/partners_api/partners_api.xcodeproj/project.pbxproj b/xcode/partners_api/partners_api.xcodeproj/project.pbxproj index 898de38651..f281674565 100644 --- a/xcode/partners_api/partners_api.xcodeproj/project.pbxproj +++ b/xcode/partners_api/partners_api.xcodeproj/project.pbxproj @@ -32,6 +32,10 @@ 3D15ACE6214AA1B000F725D5 /* taxi_delegate.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3D15ACE3214AA1AF00F725D5 /* taxi_delegate.hpp */; }; 3D15ACE7214AA1B000F725D5 /* rutaxi_api.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3D15ACE4214AA1B000F725D5 /* rutaxi_api.hpp */; }; 3D15ACE8214AA1B000F725D5 /* rutaxi_api.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D15ACE5214AA1B000F725D5 /* rutaxi_api.cpp */; }; + 3D18DC3422953FF600A583A6 /* rutaxi_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D18DC3222953FF600A583A6 /* rutaxi_tests.cpp */; }; + 3D18DC4122956DFA00A583A6 /* promo_api.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3D18DC3F22956DFA00A583A6 /* promo_api.hpp */; }; + 3D18DC4222956DFA00A583A6 /* promo_api.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D18DC4022956DFA00A583A6 /* promo_api.cpp */; }; + 3D18DC4422956E0900A583A6 /* promo_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D18DC4322956E0900A583A6 /* promo_tests.cpp */; }; 3D452AEF1EE6D202009EAB9B /* google_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D452AED1EE6D202009EAB9B /* google_tests.cpp */; }; 3D452AF01EE6D202009EAB9B /* mopub_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D452AEE1EE6D202009EAB9B /* mopub_tests.cpp */; }; 3D452AF31EE6D20D009EAB9B /* google_ads.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D452AF11EE6D20D009EAB9B /* google_ads.cpp */; }; @@ -114,6 +118,10 @@ 3D15ACE3214AA1AF00F725D5 /* taxi_delegate.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = taxi_delegate.hpp; sourceTree = ""; }; 3D15ACE4214AA1B000F725D5 /* rutaxi_api.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = rutaxi_api.hpp; sourceTree = ""; }; 3D15ACE5214AA1B000F725D5 /* rutaxi_api.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rutaxi_api.cpp; sourceTree = ""; }; + 3D18DC3222953FF600A583A6 /* rutaxi_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rutaxi_tests.cpp; sourceTree = ""; }; + 3D18DC3F22956DFA00A583A6 /* promo_api.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = promo_api.hpp; sourceTree = ""; }; + 3D18DC4022956DFA00A583A6 /* promo_api.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = promo_api.cpp; sourceTree = ""; }; + 3D18DC4322956E0900A583A6 /* promo_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = promo_tests.cpp; sourceTree = ""; }; 3D452AED1EE6D202009EAB9B /* google_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = google_tests.cpp; sourceTree = ""; }; 3D452AEE1EE6D202009EAB9B /* mopub_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = mopub_tests.cpp; sourceTree = ""; }; 3D452AF11EE6D20D009EAB9B /* google_ads.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = google_ads.cpp; sourceTree = ""; }; @@ -233,6 +241,8 @@ F6B5363B1DA520B20067EEA5 /* partners_api */ = { isa = PBXGroup; children = ( + 3D18DC4022956DFA00A583A6 /* promo_api.cpp */, + 3D18DC3F22956DFA00A583A6 /* promo_api.hpp */, 3D15ACE5214AA1B000F725D5 /* rutaxi_api.cpp */, 3D15ACE4214AA1B000F725D5 /* rutaxi_api.hpp */, 3D15ACE3214AA1AF00F725D5 /* taxi_delegate.hpp */, @@ -291,6 +301,8 @@ F6B536441DA521060067EEA5 /* partners_api_tests */ = { isa = PBXGroup; children = ( + 3D18DC4322956E0900A583A6 /* promo_tests.cpp */, + 3D18DC3222953FF600A583A6 /* rutaxi_tests.cpp */, 346E889D1E9D088200D4CE9B /* ads_engine_tests.cpp */, F6B536451DA5213D0067EEA5 /* booking_tests.cpp */, 3DBC1C501E4B14810016897F /* facebook_tests.cpp */, @@ -349,6 +361,7 @@ buildActionMask = 2147483647; files = ( 3DA5713420B57358007BDE27 /* booking_params_base.hpp in Headers */, + 3D18DC4122956DFA00A583A6 /* promo_api.hpp in Headers */, 346E88971E9D087400D4CE9B /* ads_base.hpp in Headers */, 3DCD415420DAB33700143533 /* booking_block_params.hpp in Headers */, F67E75261DB8F06F00D6741F /* opentable_api.hpp in Headers */, @@ -438,6 +451,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -467,10 +481,12 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 3D18DC4222956DFA00A583A6 /* promo_api.cpp in Sources */, 349CFD0B2045720000569949 /* maxim_api.cpp in Sources */, 3DFEBFA41EFBFC2300317D5C /* yandex_tests.cpp in Sources */, 3D452AEF1EE6D202009EAB9B /* google_tests.cpp in Sources */, 3D452AF01EE6D202009EAB9B /* mopub_tests.cpp in Sources */, + 3D18DC3422953FF600A583A6 /* rutaxi_tests.cpp in Sources */, 3D4E997F1FB439300025B48C /* utils.cpp in Sources */, 3D15ACE8214AA1B000F725D5 /* rutaxi_api.cpp in Sources */, 3430643C1E9FBCF500DC7665 /* mopub_ads.cpp in Sources */, @@ -488,6 +504,7 @@ 3D452AF31EE6D20D009EAB9B /* google_ads.cpp in Sources */, 346E88981E9D087400D4CE9B /* ads_engine.cpp in Sources */, F67E75251DB8F06F00D6741F /* opentable_api.cpp in Sources */, + 3D18DC4422956E0900A583A6 /* promo_tests.cpp in Sources */, BB1956E61F543D7C003ECE6C /* locals_api.cpp in Sources */, 3DFEBFA31EFBFC2300317D5C /* taxi_engine_tests.cpp in Sources */, F6B536401DA520E40067EEA5 /* booking_api.cpp in Sources */,