[promo_api] Search by CityFinder always. This changes are for integration with data section.

This commit is contained in:
Arsentiy Milchakov 2019-06-20 19:46:32 +03:00 committed by Roman Kuznetsov
parent a2360a241d
commit ef79fb8ed6
7 changed files with 9 additions and 14 deletions

View file

@ -4,6 +4,8 @@
#include "partners_api/promo_api.hpp"
#include "geometry/mercator.hpp"
#include <utility>
using namespace std::placeholders;
@ -124,11 +126,13 @@ jobject MakeCityGallery(JNIEnv * env, promo::CityGallery const & gallery)
extern "C" {
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_promo_Promo_nativeRequestCityGallery(JNIEnv * env, jclass,
jobject policy, jstring id)
jobject policy, jdouble lat,
jdouble lon)
{
PrepareClassRefs(env);
auto const point = MercatorBounds::FromLatLon(static_cast<double>(lat), static_cast<double>(lon));
++g_lastRequestId;
g_framework->GetPromoCityGallery(env, policy, id, std::bind(OnSuccess, g_lastRequestId, _1),
g_framework->GetPromoCityGallery(env, policy, point, std::bind(OnSuccess, g_lastRequestId, _1),
std::bind(OnError, g_lastRequestId));
}
} // extern "C"

View file

@ -49,5 +49,5 @@ public enum Promo
mListener.onErrorReceived();
}
public native void nativeRequestCityGallery(@NonNull NetworkPolicy policy, @NonNull String id);
public native void nativeRequestCityGallery(@NonNull NetworkPolicy policy, double lat, double lon);
}

View file

@ -892,7 +892,7 @@ NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS";
};
auto appInfo = AppInfo.sharedInfo;
auto locale = appInfo.twoLetterLanguageId.UTF8String;
api->GetCityGallery("", locale, resultHandler, errorHandler);
api->GetCityGallery(self.mercator, locale, resultHandler, errorHandler);
});
}

View file

@ -18,7 +18,6 @@
#include "indexer/ftypes_matcher.hpp"
#include "indexer/map_object.hpp"
#include "geometry/latlon.hpp"
#include "geometry/mercator.hpp"
#include "geometry/point2d.hpp"

View file

@ -144,7 +144,7 @@ UNIT_CLASS_TEST(ScopedEyeWithAsyncGuiThread, Promo_GetCityGallery)
{
promo::CityGallery result{};
api.GetCityGallery(kTestId, lang, [&result](promo::CityGallery const & gallery)
api.GetCityGallery({}, lang, [&result](promo::CityGallery const & gallery)
{
result = gallery;
testing::Notify();

View file

@ -207,12 +207,6 @@ std::string Api::GetMoreUrl(std::string const & id) const
return m_baseUrl + "v2/mobilefront/city/" + ToSignedId(id);
}
void Api::GetCityGallery(std::string const & id, std::string const & lang,
CityGalleryCallback const & onSuccess, OnError const & onError) const
{
GetPromoCityGalleryImpl(m_baseUrl, id, lang, onSuccess, onError);
}
void Api::GetCityGallery(m2::PointD const & point, std::string const & lang,
CityGalleryCallback const & onSuccess, OnError const & onError) const
{

View file

@ -71,8 +71,6 @@ public:
std::string GetPromoLinkAfterBooking(std::string const & lang) const;
std::string GetPromoLinkForDownloader(std::string const & id, std::string const & lang) const;
std::string GetMoreUrl(std::string const & id) const;
void GetCityGallery(std::string const & id, std::string const & lang,
CityGalleryCallback const & onSuccess, OnError const & onError) const;
void GetCityGallery(m2::PointD const & point, std::string const & lang,
CityGalleryCallback const & onSuccess, OnError const & onError) const;