From b2143a0bb85dee92859799fb11aa4193339fc891 Mon Sep 17 00:00:00 2001 From: Arsentiy Milchakov Date: Thu, 23 May 2019 18:43:15 +0300 Subject: [PATCH] [promo_api][android][ios] build fix --- .../maps/discovery/DiscoveryManager.cpp | 15 +++++++++++++-- .../UI/Discovery/DiscoveryControllerViewModel.hpp | 2 ++ .../Maps/UI/Discovery/MWMDiscoveryController.mm | 12 ++++++++++-- .../Maps/UI/Discovery/MWMDiscoveryTableManager.mm | 13 +++++++++++++ map/framework.cpp | 2 +- 5 files changed, 39 insertions(+), 5 deletions(-) diff --git a/android/jni/com/mapswithme/maps/discovery/DiscoveryManager.cpp b/android/jni/com/mapswithme/maps/discovery/DiscoveryManager.cpp index 0c72c6d69e..69b48be4b2 100644 --- a/android/jni/com/mapswithme/maps/discovery/DiscoveryManager.cpp +++ b/android/jni/com/mapswithme/maps/discovery/DiscoveryManager.cpp @@ -6,10 +6,13 @@ #include "map/discovery/discovery_manager.hpp" #include "map/search_product_info.hpp" -#include "geometry/mercator.hpp" - #include "search/result.hpp" +#include "partners_api/locals_api.hpp" +#include "partners_api/promo_api.hpp" + +#include "geometry/mercator.hpp" + #include "platform/preferred_languages.hpp" #include @@ -89,6 +92,14 @@ struct DiscoveryCallback jni::HandleJavaException(env); } + + void operator()(uint32_t const requestId, promo::CityGallery const & cityGallery) const + { + if (g_lastRequestId != requestId) + return; + + // Dummy. Please add code here. + } }; void OnDiscoveryError(uint32_t const requestId, discovery::ItemType const type) diff --git a/iphone/Maps/UI/Discovery/DiscoveryControllerViewModel.hpp b/iphone/Maps/UI/Discovery/DiscoveryControllerViewModel.hpp index cb9797b1c7..fe83be1e16 100644 --- a/iphone/Maps/UI/Discovery/DiscoveryControllerViewModel.hpp +++ b/iphone/Maps/UI/Discovery/DiscoveryControllerViewModel.hpp @@ -47,6 +47,8 @@ public: case ItemType::Cafes: return m_cafes.m_results.GetCount(); case ItemType::Hotels: return m_hotels.m_results.GetCount(); case ItemType::LocalExperts: return m_experts.size(); + // TODO: Add correct value here. + case ItemType::Promo: return 0; } } diff --git a/iphone/Maps/UI/Discovery/MWMDiscoveryController.mm b/iphone/Maps/UI/Discovery/MWMDiscoveryController.mm index d77371d5e3..8e9e3ea3b9 100644 --- a/iphone/Maps/UI/Discovery/MWMDiscoveryController.mm +++ b/iphone/Maps/UI/Discovery/MWMDiscoveryController.mm @@ -16,10 +16,11 @@ #include "map/discovery/discovery_client_params.hpp" #include "map/search_product_info.hpp" -#include "partners_api/locals_api.hpp" - #include "search/result.hpp" +#include "partners_api/locals_api.hpp" +#include "partners_api/promo_api.hpp" + #include "platform/localization.hpp" #include "platform/platform.hpp" @@ -56,6 +57,11 @@ struct Callback m_setLocalExperts(experts); m_refreshSection(ItemType::LocalExperts); } + + void operator()(uint32_t const requestId, promo::CityGallery const & experts) const + { + // TODO: Please add correct implementation here. + } using SetSearchResults = function const & productInfo, @@ -264,6 +270,8 @@ struct Callback case ItemType::LocalExperts: CHECK(false, ("Attempt to route to item with type:", static_cast(type))); break; + // TODO: Add correct code here. + case ItemType::Promo: break; } MWMRoutePoint * pt = [[MWMRoutePoint alloc] initWithPoint:point diff --git a/iphone/Maps/UI/Discovery/MWMDiscoveryTableManager.mm b/iphone/Maps/UI/Discovery/MWMDiscoveryTableManager.mm index 7a8affb911..271daa4268 100644 --- a/iphone/Maps/UI/Discovery/MWMDiscoveryTableManager.mm +++ b/iphone/Maps/UI/Discovery/MWMDiscoveryTableManager.mm @@ -38,6 +38,8 @@ NSString * StatProvider(ItemType const type) case ItemType::Attractions: return kStatSearchAttractions; case ItemType::Cafes: return kStatSearchRestaurants; case ItemType::Hotels: return kStatBooking; + // TODO: Add correct stat key here. + case ItemType::Promo: return @""; } } @@ -302,6 +304,8 @@ string GetDistance(m2::PointD const & from, m2::PointD const & to) return [self searchCollectionHolderCell:indexPath]; } case ItemType::Hotels: return [self bookingCollectionHolderCell:indexPath]; + // TODO: Add correct value here. + case ItemType::Promo: return 0; } } @@ -445,6 +449,15 @@ string GetDistance(m2::PointD const & from, m2::PointD const & to) }]; return cell; } + case ItemType::Promo: + { + // TODO: Add correct implementation here. + auto cls = [MWMDiscoveryMoreCell class]; + auto cell = static_cast([collectionView + dequeueReusableCellWithCellClass:cls + indexPath:indexPath]); + return cell; + } } } diff --git a/map/framework.cpp b/map/framework.cpp index 636049e699..fad48d2e53 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -1558,7 +1558,7 @@ void Framework::InitDiscoveryManager() CHECK(m_searchAPI.get(), ("InitDiscoveryManager() must be called after InitSearchApi()")); CHECK(m_cityFinder.get(), ("InitDiscoveryManager() must be called after InitCityFinder()")); - discovery::Manager::APIs const apis(*m_searchAPI.get(), *m_localsApi.get()); + discovery::Manager::APIs const apis(*m_searchAPI, *m_promoApi, *m_localsApi); m_discoveryManager = make_unique(m_model.GetDataSource(), apis); }