[android] TaxiType enum is added

This commit is contained in:
Arsentiy Milchakov 2018-03-13 17:04:22 +03:00 committed by Aleksandr Zatsepin
parent a5ec52e7cd
commit 6a019c2ef2
13 changed files with 164 additions and 186 deletions

View file

@ -56,7 +56,7 @@ jobject CreateMapObject(JNIEnv * env, string const & mwmName, int64_t mwmVersion
// @MapObjectType int mapObjectType, String title, @Nullable String
// secondaryTitle,
// String subtitle, String address, double lat, double lon, String apiId,
// @Nullable Banner[] banners, @TaxiType int[] reachableByTaxiTypes,
// @Nullable Banner[] banners, int[] reachableByTaxiTypes,
// @Nullable String bookingSearchUrl, @Nullable LocalAdInfo localAdInfo,
// @Nullable RoutePointInfo routePointInfo)
static jmethodID const ctorId = jni::GetConstructorID(

View file

@ -27,11 +27,10 @@ public class Bookmark extends MapObject
public Bookmark(@NonNull FeatureId featureId, @IntRange(from = 0) long categoryId,
@IntRange(from = 0) long bookmarkId, String title, @Nullable String secondaryTitle,
@Nullable String subtitle, @Nullable String address, @Nullable Banner[] banners,
@TaxiManager.TaxiType int[] reachableByTaxiTypes,
@Nullable String bookingSearchUrl, @Nullable LocalAdInfo localAdInfo,
@Nullable RoutePointInfo routePointInfo, boolean isExtendedView,
boolean shouldShowUGC, boolean canBeRated, boolean canBeReviewed,
@Nullable UGC.Rating[] ratings)
@Nullable int[] reachableByTaxiTypes, @Nullable String bookingSearchUrl,
@Nullable LocalAdInfo localAdInfo, @Nullable RoutePointInfo routePointInfo,
boolean isExtendedView, boolean shouldShowUGC, boolean canBeRated,
boolean canBeReviewed, @Nullable UGC.Rating[] ratings)
{
super(featureId, BOOKMARK, title, secondaryTitle, subtitle, address, 0, 0, "",
banners, reachableByTaxiTypes, bookingSearchUrl, localAdInfo, routePointInfo,

View file

@ -11,6 +11,7 @@ import com.mapswithme.maps.ads.Banner;
import com.mapswithme.maps.ads.LocalAdInfo;
import com.mapswithme.maps.routing.RoutePointInfo;
import com.mapswithme.maps.taxi.TaxiManager;
import com.mapswithme.maps.taxi.TaxiType;
import com.mapswithme.maps.ugc.UGC;
import java.lang.annotation.Retention;
@ -24,8 +25,10 @@ import java.util.List;
public class MapObject implements Parcelable
{
@Retention(RetentionPolicy.SOURCE)
@IntDef({POI, API_POINT, BOOKMARK, MY_POSITION, SEARCH})
public @interface MapObjectType {}
@IntDef({ POI, API_POINT, BOOKMARK, MY_POSITION, SEARCH })
public @interface MapObjectType
{
}
public static final int POI = 0;
public static final int API_POINT = 1;
@ -50,7 +53,7 @@ public class MapObject implements Parcelable
@Nullable
private List<Banner> mBanners;
@Nullable
private List<Integer> mReachableByTaxiTypes;
private List<TaxiType> mReachableByTaxiTypes;
@Nullable
private String mBookingSearchUrl;
@Nullable
@ -66,12 +69,11 @@ public class MapObject implements Parcelable
public MapObject(@NonNull FeatureId featureId, @MapObjectType int mapObjectType, String title,
@Nullable String secondaryTitle, String subtitle, String address,
double lat, double lon, String apiId,
@Nullable Banner[] banners, @Nullable @TaxiManager.TaxiType int[] types,
@Nullable String bookingSearchUrl, @Nullable LocalAdInfo localAdInfo,
@Nullable RoutePointInfo routePointInfo, boolean isExtendedView,
boolean shouldShowUGC, boolean canBeRated, boolean canBeReviewed,
@Nullable UGC.Rating[] ratings)
double lat, double lon, String apiId, @Nullable Banner[] banners,
@Nullable int[] types, @Nullable String bookingSearchUrl,
@Nullable LocalAdInfo localAdInfo, @Nullable RoutePointInfo routePointInfo,
boolean isExtendedView, boolean shouldShowUGC, boolean canBeRated,
boolean canBeReviewed, @Nullable UGC.Rating[] ratings)
{
this(featureId, mapObjectType, title, secondaryTitle,
subtitle, address, lat, lon, new Metadata(), apiId, banners,
@ -80,9 +82,9 @@ public class MapObject implements Parcelable
}
public MapObject(@NonNull FeatureId featureId, @MapObjectType int mapObjectType,
String title, @Nullable String secondaryTitle,
String subtitle, String address, double lat, double lon, Metadata metadata,
String apiId, @Nullable Banner[] banners, @Nullable @TaxiManager.TaxiType int[] taxiTypes,
String title, @Nullable String secondaryTitle, String subtitle, String address,
double lat, double lon, Metadata metadata, String apiId,
@Nullable Banner[] banners, @Nullable int[] taxiTypes,
@Nullable String bookingSearchUrl, @Nullable LocalAdInfo localAdInfo,
@Nullable RoutePointInfo routePointInfo, boolean isExtendedView,
boolean shouldShowUGC, boolean canBeRated, boolean canBeReviewed,
@ -111,7 +113,7 @@ public class MapObject implements Parcelable
{
mReachableByTaxiTypes = new ArrayList<>();
for (int type : taxiTypes)
mReachableByTaxiTypes.add(type);
mReachableByTaxiTypes.add(TaxiType.values()[type]);
}
if (ratings != null)
mRatings = new ArrayList<>(Arrays.asList(ratings));
@ -148,7 +150,7 @@ public class MapObject implements Parcelable
@NonNull
public static MapObject createMapObject(@NonNull FeatureId featureId, @MapObjectType int mapObjectType,
@NonNull String title, @NonNull String subtitle, double lat, double lon)
@NonNull String title, @NonNull String subtitle, double lat, double lon)
{
return new MapObject(featureId, mapObjectType, title,
"", subtitle, "", lat, lon, "", null,
@ -169,15 +171,16 @@ public class MapObject implements Parcelable
private ArrayList<UGC.Rating> readRatings(@NonNull Parcel source)
{
ArrayList<UGC.Rating> ratings = new ArrayList<>();
source.readTypedList(ratings, UGC.Rating.CREATOR);;
source.readTypedList(ratings, UGC.Rating.CREATOR);
;
return ratings.isEmpty() ? null : ratings;
}
@NonNull
private List<Integer> readTaxiTypes(@NonNull Parcel source)
private List<TaxiType> readTaxiTypes(@NonNull Parcel source)
{
List<Integer> types = new ArrayList<>();
source.readList(types, Integer.class.getClassLoader());
List<TaxiType> types = new ArrayList<>();
source.readList(types, TaxiType.class.getClassLoader());
return types;
}
@ -213,20 +216,41 @@ public class MapObject implements Parcelable
return (one != null && one.sameAs(another));
}
public double getScale() { return 0; }
public double getScale()
{
return 0;
}
public String getTitle() { return mTitle; }
public String getTitle()
{
return mTitle;
}
@Nullable
public String getSecondaryTitle() { return mSecondaryTitle; }
public String getSecondaryTitle()
{
return mSecondaryTitle;
}
public String getSubtitle() { return mSubtitle; }
public String getSubtitle()
{
return mSubtitle;
}
public double getLat() { return mLat; }
public double getLat()
{
return mLat;
}
public double getLon() { return mLon; }
public double getLon()
{
return mLon;
}
public String getAddress() { return mAddress; }
public String getAddress()
{
return mAddress;
}
@NonNull
public String getMetadata(Metadata.MetadataType type)
@ -259,7 +283,7 @@ public class MapObject implements Parcelable
}
@Nullable
public List<Integer> getReachableByTaxiTypes()
public List<TaxiType> getReachableByTaxiTypes()
{
return mReachableByTaxiTypes;
}
@ -349,7 +373,7 @@ public class MapObject implements Parcelable
return mFeatureId;
}
private static MapObject readFromParcel(Parcel source)
private static MapObject readFromParcel(Parcel source)
{
@MapObjectType int type = source.readInt();
if (type == BOOKMARK)

View file

@ -166,7 +166,8 @@ final class RoutingBottomMenuController implements View.OnClickListener
void showTaxiInfo(@NonNull TaxiInfo info)
{
UiUtils.hide(mError, mAltitudeChartFrame, mActionFrame, mTransitFrame);
TaxiManager.setTaxiIcon(mTaxiFrame.findViewById(R.id.iv__logo), info.getType());
ImageView logo = mTaxiFrame.findViewById(R.id.iv__logo);
logo.setImageResource(info.getType().getIcon());
final List<TaxiInfo.Product> products = info.getProducts();
mTaxiInfo = info;
mTaxiProduct = products.get(0);
@ -251,8 +252,7 @@ final class RoutingBottomMenuController implements View.OnClickListener
{
if (RoutingController.get().isTaxiRouterType() && mTaxiInfo != null)
{
String packageName = TaxiManager.getTaxiPackageName(mTaxiInfo.getType());
mStart.setText(Utils.isAppInstalled(mContext, packageName)
mStart.setText(Utils.isAppInstalled(mContext, mTaxiInfo.getType().getPackageName())
? R.string.taxi_order : R.string.install_app);
mStart.setOnClickListener(new View.OnClickListener()
{

View file

@ -1163,7 +1163,7 @@ public class RoutingController implements TaxiManager.TaxiListener
mContainer.onTaxiInfoReceived(provider);
completeTaxiRequest();
Statistics.INSTANCE.trackTaxiEvent(Statistics.EventName.ROUTING_TAXI_ROUTE_BUILT,
provider.getType());
provider.getType().getProviderName());
}
}

View file

@ -20,10 +20,10 @@ public class TaxiAdapter extends PagerAdapter
private final Context mContext;
@NonNull
private final List<TaxiInfo.Product> mProducts;
@TaxiManager.TaxiType
private final int mType;
@NonNull
private final TaxiType mType;
public TaxiAdapter(@NonNull Context context, @TaxiManager.TaxiType int type,
public TaxiAdapter(@NonNull Context context, @NonNull TaxiType type,
@NonNull List<TaxiInfo.Product> products)
{
mContext = context;
@ -53,9 +53,9 @@ public class TaxiAdapter extends PagerAdapter
String separator;
// We ignore all Yandex.Taxi product names until they do support of passing product parameters
// to their app via deeplink.
if (mType == TaxiManager.PROVIDER_YANDEX || mType == TaxiManager.PROVIDER_MAXIM)
if (mType == TaxiType.PROVIDER_YANDEX || mType == TaxiType.PROVIDER_MAXIM)
{
TaxiManager.setTaxiTitle(name, mType);
name.setText(mType.getTitle());
separator = " • ~";
}
else
@ -76,7 +76,7 @@ public class TaxiAdapter extends PagerAdapter
@NonNull
private String formatPrice(@NonNull TaxiInfo.Product product)
{
if (mType == TaxiManager.PROVIDER_YANDEX)
if (mType == TaxiType.PROVIDER_YANDEX)
return Utils.formatCurrencyString(product.getPrice(), product.getCurrency());
// For Uber and Maxim we don't do formatting, because Uber and Maxim does it on its side.
return product.getPrice();

View file

@ -25,28 +25,28 @@ public class TaxiInfo implements Parcelable
}
};
@TaxiManager.TaxiType
private final int mType;
@NonNull
private final TaxiType mType;
@NonNull
private final List<Product> mProducts;
private TaxiInfo(@TaxiManager.TaxiType int type, @NonNull Product[] products)
private TaxiInfo(int type, @NonNull Product[] products)
{
mType = type;
mType = TaxiType.values()[type];
mProducts = new ArrayList<>(Arrays.asList(products));
}
private TaxiInfo(@NonNull Parcel parcel)
{
//noinspection WrongConstant
mType = parcel.readInt();
mType = TaxiType.values()[parcel.readInt()];
List<Product> products = new ArrayList<>();
parcel.readTypedList(products, Product.CREATOR);
mProducts = products;
}
@TaxiManager.TaxiType
public int getType()
@NonNull
public final TaxiType getType()
{
return mType;
}
@ -75,7 +75,7 @@ public class TaxiInfo implements Parcelable
@Override
public void writeToParcel(Parcel dest, int flags)
{
dest.writeInt(mType);
dest.writeInt(mType.ordinal());
dest.writeTypedList(mProducts);
}

View file

@ -4,14 +4,14 @@ import android.support.annotation.NonNull;
public class TaxiInfoError
{
@TaxiManager.TaxiType
private final int mType;
@NonNull
private final TaxiType mType;
@NonNull
private final TaxiManager.ErrorCode mCode;
public TaxiInfoError(int type, @NonNull String errorCode)
{
mType = type;
mType = TaxiType.values()[type];
mCode = TaxiManager.ErrorCode.valueOf(errorCode);
}
@ -21,10 +21,10 @@ public class TaxiInfoError
return mCode;
}
@TaxiManager.TaxiType
public int getType()
@NonNull
public String getProviderName()
{
return mType;
return mType.getProviderName();
}
@Override

View file

@ -2,14 +2,10 @@ package com.mapswithme.maps.taxi;
import android.content.Context;
import android.location.Location;
import android.support.annotation.IntDef;
import android.support.annotation.MainThread;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.widget.ImageView;
import android.widget.TextView;
import com.mapswithme.maps.R;
import com.mapswithme.maps.bookmarks.data.MapObject;
import com.mapswithme.maps.location.LocationHelper;
import com.mapswithme.maps.routing.RoutingController;
@ -19,8 +15,6 @@ import com.mapswithme.util.Utils;
import com.mapswithme.util.concurrency.UiThread;
import com.mapswithme.util.statistics.Statistics;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -28,16 +22,8 @@ import java.util.List;
@MainThread
public class TaxiManager
{
public static final int PROVIDER_UBER = 0;
public static final int PROVIDER_YANDEX = 1;
public static final int PROVIDER_MAXIM = 2;
public static final TaxiManager INSTANCE = new TaxiManager();
@Retention(RetentionPolicy.SOURCE)
@IntDef({ PROVIDER_UBER, PROVIDER_YANDEX, PROVIDER_MAXIM })
public @interface TaxiType {}
@NonNull
private final List<TaxiInfo> mProviders = new ArrayList<>();
@NonNull
@ -47,7 +33,6 @@ public class TaxiManager
private TaxiManager()
{
}
// Called from JNI.
@ -95,119 +80,33 @@ public class TaxiManager
}
@Nullable
public static SponsoredLinks getTaxiLink(@NonNull String productId, @TaxiType int type,
public static SponsoredLinks getTaxiLink(@NonNull String productId, @NonNull TaxiType type,
@Nullable MapObject startPoint, @Nullable MapObject endPoint)
{
if (startPoint == null || endPoint == null)
return null;
return TaxiManager.INSTANCE.nativeGetTaxiLinks(NetworkPolicy.newInstance(true /* canUse */),
type, productId, startPoint.getLat(),
type.ordinal(), productId, startPoint.getLat(),
startPoint.getLon(), endPoint.getLat(),
endPoint.getLon());
}
public static void setTaxiIcon(@NonNull ImageView logo, @TaxiManager.TaxiType int type)
{
switch (type)
{
case TaxiManager.PROVIDER_UBER:
logo.setImageResource(R.drawable.ic_logo_uber);
break;
case TaxiManager.PROVIDER_YANDEX:
logo.setImageResource(R.drawable.ic_logo_yandex_taxi);
break;
case TaxiManager.PROVIDER_MAXIM:
logo.setImageResource(R.drawable.ic_taxi_logo_maksim);
break;
default:
throw new AssertionError("Unsupported taxi type: " + type);
}
}
public static void setTaxiTitle(@NonNull TextView title, @TaxiManager.TaxiType int type)
{
switch (type)
{
case TaxiManager.PROVIDER_UBER:
title.setText(R.string.uber);
break;
case TaxiManager.PROVIDER_YANDEX:
title.setText(R.string.yandex_taxi_title);
break;
case TaxiManager.PROVIDER_MAXIM:
title.setText(R.string.maxim_taxi_title);
break;
default:
throw new AssertionError("Unsupported taxi type: " + type);
}
}
@NonNull
public static String getTaxiPackageName(@TaxiManager.TaxiType int type)
{
switch (type)
{
case TaxiManager.PROVIDER_UBER:
return "com.ubercab";
case TaxiManager.PROVIDER_YANDEX:
return "ru.yandex.taxi";
case TaxiManager.PROVIDER_MAXIM:
return "maximzakaz";
default:
throw new AssertionError("Unsupported taxi type: " + type);
}
}
@NonNull
public static String getTaxiStatisticsName(@TaxiManager.TaxiType int type)
{
switch (type)
{
case TaxiManager.PROVIDER_UBER:
return "Uber";
case TaxiManager.PROVIDER_YANDEX:
return "Yandex";
case TaxiManager.PROVIDER_MAXIM:
return "Maxim";
default:
throw new AssertionError("Unsupported taxi type: " + type);
}
}
public static void launchTaxiApp(@NonNull Context context, @NonNull SponsoredLinks links,
@TaxiManager.TaxiType int type)
@NonNull TaxiType type)
{
String packageName = TaxiManager.getTaxiPackageName(type);
boolean isTaxiInstalled = Utils.isAppInstalled(context, packageName);
Utils.PartnerAppOpenMode openMode;
Utils.openPartner(context, links, type.getPackageName(), type.getOpenMode());
switch (type)
{
case TaxiManager.PROVIDER_UBER:
openMode = Utils.PartnerAppOpenMode.Direct;
break;
case TaxiManager.PROVIDER_YANDEX:
openMode = Utils.PartnerAppOpenMode.Indirect;
break;
case TaxiManager.PROVIDER_MAXIM:
openMode = Utils.PartnerAppOpenMode.Direct;
break;
default:
throw new AssertionError("Unsupported taxi type: " + type);
}
Utils.openPartner(context, links, packageName, openMode);
trackTaxiStatistics(type, isTaxiInstalled);
boolean isTaxiInstalled = Utils.isAppInstalled(context, type.getPackageName());
trackTaxiStatistics(type.getProviderName(), isTaxiInstalled);
}
private static void trackTaxiStatistics(@TaxiManager.TaxiType int type, boolean isTaxiAppInstalled)
private static void trackTaxiStatistics(@NonNull String taxiName, boolean isTaxiAppInstalled)
{
MapObject from = RoutingController.get().getStartPoint();
MapObject to = RoutingController.get().getEndPoint();
Location location = LocationHelper.INSTANCE.getLastKnownLocation();
Statistics.INSTANCE.trackTaxiInRoutePlanning(from, to, location, type, isTaxiAppInstalled);
Statistics.INSTANCE.trackTaxiInRoutePlanning(from, to, location, taxiName, isTaxiAppInstalled);
}
public void setTaxiListener(@Nullable TaxiListener listener)
{
@ -218,7 +117,7 @@ public class TaxiManager
double srcLon, double dstLat, double dstLon);
@NonNull
public native SponsoredLinks nativeGetTaxiLinks(@NonNull NetworkPolicy policy, @TaxiType int type,
public native SponsoredLinks nativeGetTaxiLinks(@NonNull NetworkPolicy policy, int type,
@NonNull String productId, double srcLon,
double srcLat, double dstLat, double dstLon);

View file

@ -0,0 +1,52 @@
package com.mapswithme.maps.taxi;
import android.support.annotation.NonNull;
import com.mapswithme.maps.R;
import com.mapswithme.util.Utils;
public enum TaxiType
{
PROVIDER_UBER
{
@NonNull
public String getPackageName() { return "com.ubercab"; }
@NonNull
public Utils.PartnerAppOpenMode getOpenMode() { return Utils.PartnerAppOpenMode.Direct; }
public int getIcon() { return R.drawable.ic_logo_uber; }
public int getTitle() { return R.string.uber; }
@NonNull
public String getProviderName() { return "Uber"; }
},
PROVIDER_YANDEX
{
@NonNull
public String getPackageName() { return "ru.yandex.taxi"; }
@NonNull
public Utils.PartnerAppOpenMode getOpenMode() { return Utils.PartnerAppOpenMode.Indirect; }
public int getIcon() { return R.drawable.ic_logo_yandex_taxi; }
public int getTitle() { return R.string.yandex_taxi_title; }
@NonNull
public String getProviderName() { return "Yandex"; }
},
PROVIDER_MAXIM
{
@NonNull
public String getPackageName() { return "com.taxsee.taxsee"; }
@NonNull
public Utils.PartnerAppOpenMode getOpenMode() { return Utils.PartnerAppOpenMode.Direct; }
public int getIcon() { return R.drawable.ic_taxi_logo_maksim; }
public int getTitle() { return R.string.maxim_taxi_title; }
@NonNull
public String getProviderName() { return "Maxim"; }
};
@NonNull
public abstract String getPackageName();
@NonNull
public abstract Utils.PartnerAppOpenMode getOpenMode();
public abstract int getIcon();
public abstract int getTitle();
@NonNull
public abstract String getProviderName();
}

View file

@ -69,6 +69,7 @@ import com.mapswithme.maps.location.LocationHelper;
import com.mapswithme.maps.review.Review;
import com.mapswithme.maps.routing.RoutingController;
import com.mapswithme.maps.taxi.TaxiManager;
import com.mapswithme.maps.taxi.TaxiType;
import com.mapswithme.maps.ugc.Impress;
import com.mapswithme.maps.ugc.UGCController;
import com.mapswithme.maps.viator.Viator;
@ -1437,7 +1438,7 @@ public class PlacePageView extends RelativeLayout
private void showTaxiOffer(@NonNull MapObject mapObject)
{
List<Integer> taxiTypes = mapObject.getReachableByTaxiTypes();
List<TaxiType> taxiTypes = mapObject.getReachableByTaxiTypes();
boolean showTaxiOffer = taxiTypes != null && !taxiTypes.isEmpty() &&
LocationHelper.INSTANCE.getMyPosition() != null &&
@ -1448,11 +1449,12 @@ public class PlacePageView extends RelativeLayout
return;
// At this moment we display only a one taxi provider at the same time.
@TaxiManager.TaxiType
int type = taxiTypes.get(0);
TaxiManager.setTaxiIcon(mTaxi.findViewById(R.id.iv__place_page_taxi), type);
TaxiManager.setTaxiTitle(mTaxi.findViewById(R.id.tv__place_page_taxi), type);
Statistics.INSTANCE.trackTaxiEvent(Statistics.EventName.ROUTING_TAXI_SHOW_IN_PP, type);
TaxiType type = taxiTypes.get(0);
ImageView logo = mTaxi.findViewById(R.id.iv__place_page_taxi);
logo.setImageResource(type.getIcon());
TextView title = mTaxi.findViewById(R.id.tv__place_page_taxi);
title.setText(type.getTitle());
Statistics.INSTANCE.trackTaxiEvent(Statistics.EventName.ROUTING_TAXI_SHOW_IN_PP, type.getProviderName());
}
private void hideHotelViews()
@ -1865,12 +1867,12 @@ public class PlacePageView extends RelativeLayout
Framework.nativeDeactivatePopup();
if (mMapObject != null)
{
List<Integer> types = mMapObject.getReachableByTaxiTypes();
List<TaxiType> types = mMapObject.getReachableByTaxiTypes();
if (types != null && !types.isEmpty())
{
@TaxiManager.TaxiType
int type = types.get(0);
Statistics.INSTANCE.trackTaxiEvent(Statistics.EventName.ROUTING_TAXI_CLICK_IN_PP, type);
String providerName = types.get(0).getProviderName();
Statistics.INSTANCE.trackTaxiEvent(Statistics.EventName.ROUTING_TAXI_CLICK_IN_PP,
providerName);
}
}
break;

View file

@ -8,6 +8,7 @@ import android.view.View;
import com.mapswithme.maps.R;
import com.mapswithme.maps.bookmarks.data.MapObject;
import com.mapswithme.maps.taxi.TaxiManager;
import com.mapswithme.maps.taxi.TaxiType;
import com.mapswithme.maps.widget.placepage.PlacePageView;
import com.mapswithme.maps.widget.placepage.Sponsored;
import com.mapswithme.util.UiUtils;
@ -63,12 +64,12 @@ public class PlacePageTracker
{
if (!mTaxiTracked && isViewOnScreen(mTaxi, VISIBILITY_RATIO_TAXI) && mMapObject != null)
{
List<Integer> taxiTypes = mMapObject.getReachableByTaxiTypes();
List<TaxiType> taxiTypes = mMapObject.getReachableByTaxiTypes();
if (taxiTypes != null && !taxiTypes.isEmpty())
{
@TaxiManager.TaxiType
int type = taxiTypes.get(0);
Statistics.INSTANCE.trackTaxiEvent(Statistics.EventName.ROUTING_TAXI_REAL_SHOW_IN_PP, type);
String providerName = taxiTypes.get(0).getProviderName();
Statistics.INSTANCE.trackTaxiEvent(Statistics.EventName.ROUTING_TAXI_REAL_SHOW_IN_PP,
providerName);
mTaxiTracked = true;
}
}

View file

@ -606,10 +606,11 @@ public enum Statistics
}
public void trackTaxiInRoutePlanning(@Nullable MapObject from, @Nullable MapObject to,
@Nullable Location location, @TaxiManager.TaxiType int type, boolean isAppInstalled)
@Nullable Location location, @NonNull String providerName,
boolean isAppInstalled)
{
Statistics.ParameterBuilder params = Statistics.params();
params.add(Statistics.EventParam.PROVIDER, TaxiManager.getTaxiStatisticsName(type));
params.add(Statistics.EventParam.PROVIDER, providerName);
params.add(Statistics.EventParam.FROM_LAT, from != null ? String.valueOf(from.getLat()) : "N/A")
.add(Statistics.EventParam.FROM_LON, from != null ? String.valueOf(from.getLon()) : "N/A");
@ -622,17 +623,17 @@ public enum Statistics
trackEvent(event, location, params.get());
}
public void trackTaxiEvent(@NonNull String eventName, @TaxiManager.TaxiType int type)
public void trackTaxiEvent(@NonNull String eventName, @NonNull String providerName)
{
Statistics.ParameterBuilder params = Statistics.params();
params.add(Statistics.EventParam.PROVIDER, TaxiManager.getTaxiStatisticsName(type));
params.add(Statistics.EventParam.PROVIDER, providerName);
trackEvent(eventName, params);
}
public void trackTaxiError(@NonNull TaxiInfoError error)
{
Statistics.ParameterBuilder params = Statistics.params();
params.add(Statistics.EventParam.PROVIDER, TaxiManager.getTaxiStatisticsName(error.getType()));
params.add(Statistics.EventParam.PROVIDER, error.getProviderName());
params.add(ERROR_CODE, error.getCode().name());
trackEvent(EventName.ROUTING_TAXI_ROUTE_BUILT, params);
}