From 795cbd14c4071208b4c2f236d23413c8a972f5fb Mon Sep 17 00:00:00 2001 From: alexzatsepin Date: Fri, 21 Oct 2016 19:35:55 +0300 Subject: [android] Fixed the order of parameters in booking info request --- android/jni/com/mapswithme/maps/Sponsored.cpp | 2 +- .../maps/widget/placepage/PlacePageView.java | 12 ++++++------ .../mapswithme/maps/widget/placepage/Sponsored.java | 20 ++++++++++---------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/android/jni/com/mapswithme/maps/Sponsored.cpp b/android/jni/com/mapswithme/maps/Sponsored.cpp index 0b2b234470..ac8bb04fc5 100644 --- a/android/jni/com/mapswithme/maps/Sponsored.cpp +++ b/android/jni/com/mapswithme/maps/Sponsored.cpp @@ -65,7 +65,7 @@ void PrepareClassRefs(JNIEnv * env, jclass sponsoredClass) "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V"); // static void onDescriptionReceived(final String id, final String description) g_infoCallback = jni::GetStaticMethodID( - env, g_sponsoredClass, "onInfoReceived", + env, g_sponsoredClass, "onHotelInfoReceived", "(Ljava/lang/String;Lcom/mapswithme/maps/widget/placepage/Sponsored$HotelInfo;)V"); } diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java index a26dd2e0d3..61b9beaa62 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java +++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java @@ -89,7 +89,7 @@ public class PlacePageView extends RelativeLayout implements View.OnClickListener, View.OnLongClickListener, Sponsored.OnPriceReceivedListener, - Sponsored.OnInfoReceivedListener, + Sponsored.OnHotelInfoReceivedListener, LineCountTextView.OnLineCountCalculatedListener, RecyclerClickListener, NearbyAdapter.OnItemClickListener @@ -536,7 +536,7 @@ public class PlacePageView extends RelativeLayout } @Override - public void onInfoReceived(@NonNull String id, @NonNull Sponsored.HotelInfo info) + public void onHotelInfoReceived(@NonNull String id, @NonNull Sponsored.HotelInfo info) { if (mSponsored == null || !TextUtils.equals(id, mSponsored.getId())) return; @@ -654,7 +654,7 @@ public class PlacePageView extends RelativeLayout if (info == null) return; - String event = Statistics.EventName.PP_SPONSORED_NONE; + String event = null; Map params = new HashMap<>(); switch (info.getType()) { @@ -671,7 +671,7 @@ public class PlacePageView extends RelativeLayout case Sponsored.TYPE_GEOCHAT: break; case Sponsored.TYPE_OPENTABLE: - params.put("provider", "Opentable.Com"); + params.put("provider", "OpenTable"); params.put("restaurant_lat", (mMapObject == null ? "N/A" : String.valueOf(mMapObject.getLat()))); params.put("restaurant_lon", @@ -684,7 +684,8 @@ public class PlacePageView extends RelativeLayout } final Location location = LocationHelper.INSTANCE.getLastKnownLocation(); - Statistics.INSTANCE.trackEvent(event, location, params); + if (!TextUtils.isEmpty(event)) + Statistics.INSTANCE.trackEvent(event, location, params); try { @@ -1024,7 +1025,6 @@ public class PlacePageView extends RelativeLayout { switch (mSponsored.getType()) { - case Sponsored.TYPE_BOOKING: buttons.add(PlacePageButtons.Item.BOOKING); break; diff --git a/android/src/com/mapswithme/maps/widget/placepage/Sponsored.java b/android/src/com/mapswithme/maps/widget/placepage/Sponsored.java index d3dd79efc5..61296a9dce 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/Sponsored.java +++ b/android/src/com/mapswithme/maps/widget/placepage/Sponsored.java @@ -158,7 +158,7 @@ public final class Sponsored void onPriceReceived(@NonNull String id, @NonNull String price, @NonNull String currency); } - interface OnInfoReceivedListener + interface OnHotelInfoReceivedListener { /** * This method is called from the native core on the UI thread @@ -168,7 +168,7 @@ public final class Sponsored * @param info A hotel info */ @UiThread - void onInfoReceived(@NonNull String id, @NonNull HotelInfo info); + void onHotelInfoReceived(@NonNull String id, @NonNull HotelInfo info); } // Hotel ID -> Price @@ -180,7 +180,7 @@ public final class Sponsored @NonNull private static WeakReference sPriceListener = new WeakReference<>(null); @NonNull - private static WeakReference sInfoListener = new WeakReference<>(null); + private static WeakReference sInfoListener = new WeakReference<>(null); @Nullable private String mId; @@ -252,7 +252,7 @@ public final class Sponsored sPriceListener = new WeakReference<>(listener); } - static void setInfoListener(@NonNull OnInfoReceivedListener listener) + static void setInfoListener(@NonNull OnHotelInfoReceivedListener listener) { sInfoListener = new WeakReference<>(listener); } @@ -284,7 +284,7 @@ public final class Sponsored switch (sponsored.getType()) { case TYPE_BOOKING: - requestHotelInfo(locale, id); + requestHotelInfo(id, locale); break; case TYPE_GEOCHAT: // TODO: request geochat info @@ -300,7 +300,7 @@ public final class Sponsored /** * Make request to obtain hotel information. * This method also checks cache for requested hotel id - * and if cache exists - call {@link #onInfoReceived(String, HotelInfo) onInfoReceived} immediately + * and if cache exists - call {@link #onHotelInfoReceived(String, HotelInfo) onHotelInfoReceived} immediately * * @param id A Hotel id * @param locale A user locale @@ -309,7 +309,7 @@ public final class Sponsored { HotelInfo info = sInfoCache.get(id); if (info != null) - onInfoReceived(id, info); + onHotelInfoReceived(id, info); nativeRequestHotelInfo(id, locale); } @@ -328,13 +328,13 @@ public final class Sponsored listener.onPriceReceived(id, price, currency); } - private static void onInfoReceived(@NonNull String id, @NonNull HotelInfo info) + private static void onHotelInfoReceived(@NonNull String id, @NonNull HotelInfo info) { sInfoCache.put(id, info); - OnInfoReceivedListener listener = sInfoListener.get(); + OnHotelInfoReceivedListener listener = sInfoListener.get(); if (listener != null) - listener.onInfoReceived(id, info); + listener.onHotelInfoReceived(id, info); } @Nullable -- cgit v1.2.3