[android][promo] log promo after booking shown

This commit is contained in:
Arsentiy Milchakov 2019-07-09 17:05:53 +03:00 committed by Aleksandr Zatsepin
parent f2959d7ad4
commit 147cfb7b84
7 changed files with 38 additions and 7 deletions

View file

@ -99,4 +99,11 @@ Java_com_mapswithme_maps_metrics_UserActionsLogger_nativeBookingDetailsClicked(J
{
RegisterEventIfPossible(eye::MapObject::Event::Type::BookingDetails);
}
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_metrics_UserActionsLogger_nativePromoAfterBookingShown(JNIEnv * env,
jclass, jstring id)
{
eye::Eye::Event::PromoAfterBookingShown(jni::ToNativeString(env, id));
}
}

View file

@ -62,8 +62,9 @@ void PrepareClassRefs(JNIEnv * env)
"(Lcom/mapswithme/maps/promo/PromoCityGallery;)V");
g_onErrorReceived = jni::GetMethodID(env, promoInstance, "onErrorReceived", "()V");
g_afterBooking = jni::GetGlobalClassRef(env, "com/mapswithme/maps/promo/PromoAfterBooking");
g_afterBookingConstructor = jni::GetConstructorID(env, g_afterBooking,
"(Ljava/lang/String;Ljava/lang/String;)V");
g_afterBookingConstructor =
jni::GetConstructorID(env, g_afterBooking,
"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
}
void OnSuccess(uint64_t requestId, promo::CityGallery const & gallery)
@ -153,9 +154,11 @@ Java_com_mapswithme_maps_promo_Promo_nativeGetPromoAfterBooking(JNIEnv * env, jc
if (result.IsEmpty())
return nullptr;
auto const id = jni::ToJavaString(env, result.m_id);
auto const promoUrl = jni::ToJavaString(env, result.m_promoUrl);
auto const pictureUrl = jni::ToJavaString(env, result.m_pictureUrl);
return env->NewObject(g_afterBooking, g_afterBookingConstructor, promoUrl, pictureUrl);
return env->NewObject(g_afterBooking, g_afterBookingConstructor, id, promoUrl, pictureUrl);
}
} // extern "C"

View file

@ -72,6 +72,7 @@ import com.mapswithme.maps.maplayer.subway.SubwayManager;
import com.mapswithme.maps.maplayer.traffic.OnTrafficLayerToggleListener;
import com.mapswithme.maps.maplayer.traffic.TrafficManager;
import com.mapswithme.maps.maplayer.traffic.widget.TrafficButton;
import com.mapswithme.maps.metrics.UserActionsLogger;
import com.mapswithme.maps.news.IntroductionDialogFragment;
import com.mapswithme.maps.news.IntroductionScreenFactory;
import com.mapswithme.maps.promo.Promo;
@ -2224,6 +2225,8 @@ public class MwmActivity extends BaseMwmFragmentActivity
final DialogFragment fragment = (DialogFragment) Fragment.instantiate(this, dialogName, args);
fragment.show(getSupportFragmentManager(), dialogName);
UserActionsLogger.logPromoAfterBookingShown(promo.getId());
return true;
}

View file

@ -65,6 +65,11 @@ public class UserActionsLogger
nativeBookingDetailsClicked();
}
public static void logPromoAfterBookingShown(@NonNull String id)
{
nativePromoAfterBookingShown(id);
}
private static native void nativeTipClicked(int type, int event);
private static native void nativeBookingFilterUsed();
private static native void nativeBookmarksCatalogShown();
@ -77,4 +82,5 @@ public class UserActionsLogger
private static native void nativeBookingMoreClicked();
private static native void nativeBookingReviewsClicked();
private static native void nativeBookingDetailsClicked();
private static native void nativePromoAfterBookingShown(@NonNull String id);
}

View file

@ -4,6 +4,8 @@ import android.support.annotation.NonNull;
public class PromoAfterBooking
{
@NonNull
private String mId;
@NonNull
private String mGuidesUrl;
@NonNull
@ -11,12 +13,19 @@ public class PromoAfterBooking
// Called from JNI.
@SuppressWarnings("unused")
public PromoAfterBooking(@NonNull String guidesUrl, @NonNull String imageUrl)
public PromoAfterBooking(@NonNull String id, @NonNull String guidesUrl, @NonNull String imageUrl)
{
mId = id;
mGuidesUrl = guidesUrl;
mImageUrl = imageUrl;
}
@NonNull
public String getId()
{
return mId;
}
@NonNull
public String getGuidesUrl()
{

View file

@ -209,9 +209,9 @@ AfterBooking Api::GetAfterBooking(std::string const & lang) const
auto const promoId = LoadPromoIdForBooking(eyeInfo);
if (!NeedToShowImpl(promoId, eyeInfo))
return {"", ""};
return {};
return {GetCityCatalogueUrl(m_baseUrl, promoId),
return {promoId, GetCityCatalogueUrl(m_baseUrl, promoId),
GetPictureUrl(m_basePicturesUrl, promoId)};
}

View file

@ -46,11 +46,14 @@ struct CityGallery
struct AfterBooking
{
AfterBooking() = default;
bool IsEmpty() const
{
return m_promoUrl.empty() || m_pictureUrl.empty();
return m_id.empty() || m_promoUrl.empty() || m_pictureUrl.empty();
}
std::string m_id;
std::string m_promoUrl;
std::string m_pictureUrl;
};