Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android/src/com/mapswithme/maps/auth/SocialAuthDialogFragment.java22
-rw-r--r--android/src/com/mapswithme/maps/ugc/UGCController.java6
-rw-r--r--android/src/com/mapswithme/maps/ugc/UGCEditorActivity.java12
-rw-r--r--android/src/com/mapswithme/maps/ugc/UGCEditorFragment.java17
-rw-r--r--android/src/com/mapswithme/util/statistics/Statistics.java51
5 files changed, 100 insertions, 8 deletions
diff --git a/android/src/com/mapswithme/maps/auth/SocialAuthDialogFragment.java b/android/src/com/mapswithme/maps/auth/SocialAuthDialogFragment.java
index 1f271e3764..0c17ad39bb 100644
--- a/android/src/com/mapswithme/maps/auth/SocialAuthDialogFragment.java
+++ b/android/src/com/mapswithme/maps/auth/SocialAuthDialogFragment.java
@@ -2,6 +2,7 @@ package com.mapswithme.maps.auth;
import android.app.Activity;
import android.app.Dialog;
+import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
@@ -24,6 +25,7 @@ import com.mapswithme.maps.R;
import com.mapswithme.maps.base.BaseMwmDialogFragment;
import com.mapswithme.util.log.Logger;
import com.mapswithme.util.log.LoggerFactory;
+import com.mapswithme.util.statistics.Statistics;
import java.lang.ref.WeakReference;
@@ -61,12 +63,15 @@ public class SocialAuthDialogFragment extends BaseMwmDialogFragment
{
super.onResume();
AccessToken token = AccessToken.getCurrentAccessToken();
- if (token == null)
- return;
+ String tokenValue = null;
+ if (token != null)
+ tokenValue = token.getToken();
- String tokenValue = token.getToken();
if (TextUtils.isEmpty(tokenValue))
+ {
+ Statistics.INSTANCE.trackEvent(Statistics.EventName.UGC_AUTH_SHOWN);
return;
+ }
LOGGER.i(TAG, "Social token is already obtained");
sendResult(Activity.RESULT_OK, tokenValue, Framework.SOCIAL_TOKEN_FACEBOOK);
@@ -97,6 +102,13 @@ public class SocialAuthDialogFragment extends BaseMwmDialogFragment
mCallbackManager.onActivityResult(requestCode, resultCode, data);
}
+ @Override
+ public void onDismiss(DialogInterface dialog)
+ {
+ Statistics.INSTANCE.trackEvent(Statistics.EventName.UGC_AUTH_DECLINED);
+ super.onDismiss(dialog);
+ }
+
private static class FBCallback implements FacebookCallback<LoginResult>
{
@NonNull
@@ -110,6 +122,7 @@ public class SocialAuthDialogFragment extends BaseMwmDialogFragment
@Override
public void onSuccess(LoginResult loginResult)
{
+ Statistics.INSTANCE.trackUGCExternalAuthSucceed(Statistics.ParamValue.FACEBOOK);
AccessToken accessToken = loginResult.getAccessToken();
LOGGER.d(TAG, "onSuccess, access token: " + accessToken);
sendResult(Activity.RESULT_OK, accessToken.getToken(), Framework.SOCIAL_TOKEN_FACEBOOK);
@@ -118,6 +131,7 @@ public class SocialAuthDialogFragment extends BaseMwmDialogFragment
@Override
public void onCancel()
{
+ Statistics.INSTANCE.trackEvent(Statistics.EventName.UGC_AUTH_DECLINED);
LOGGER.w(TAG, "onCancel");
sendResult(Activity.RESULT_CANCELED, null, Framework.SOCIAL_TOKEN_FACEBOOK);
}
@@ -125,6 +139,8 @@ public class SocialAuthDialogFragment extends BaseMwmDialogFragment
@Override
public void onError(FacebookException error)
{
+ Statistics.INSTANCE.trackUGCAuthFailed(Statistics.ParamValue.FACEBOOK,
+ error != null ? error.getMessage() : null);
LOGGER.e(TAG, "onError", error);
sendResult(Activity.RESULT_CANCELED, null, Framework.SOCIAL_TOKEN_FACEBOOK);
}
diff --git a/android/src/com/mapswithme/maps/ugc/UGCController.java b/android/src/com/mapswithme/maps/ugc/UGCController.java
index 028c6c9529..729cf26028 100644
--- a/android/src/com/mapswithme/maps/ugc/UGCController.java
+++ b/android/src/com/mapswithme/maps/ugc/UGCController.java
@@ -62,7 +62,8 @@ public class UGCController implements View.OnClickListener, UGC.UGCListener
UGCEditorActivity.start((Activity) mPlacePage.getContext(), mMapObject.getTitle(),
mMapObject.getFeatureId(),
- UGC.getUserRatings(), UGC.RATING_NONE, mMapObject.canBeReviewed());
+ UGC.getUserRatings(), UGC.RATING_NONE, mMapObject.canBeReviewed(),
+ true /* isFromPPP */);
}
};
@NonNull
@@ -217,7 +218,8 @@ public class UGCController implements View.OnClickListener, UGC.UGCListener
UGCEditorActivity.start((Activity) mPlacePage.getContext(), mMapObject.getTitle(),
mMapObject.getFeatureId(),
- mUgc.getUserRatings(), rating, mMapObject.canBeReviewed());
+ mUgc.getUserRatings(), rating, mMapObject.canBeReviewed(),
+ false /* isFromPPP */);
}
private void seUserReviewAndRatingsView(@Nullable UGCUpdate update)
diff --git a/android/src/com/mapswithme/maps/ugc/UGCEditorActivity.java b/android/src/com/mapswithme/maps/ugc/UGCEditorActivity.java
index ea8b8dd645..15b5491c03 100644
--- a/android/src/com/mapswithme/maps/ugc/UGCEditorActivity.java
+++ b/android/src/com/mapswithme/maps/ugc/UGCEditorActivity.java
@@ -10,17 +10,18 @@ import android.support.v4.app.Fragment;
import com.mapswithme.maps.base.BaseMwmFragmentActivity;
import com.mapswithme.maps.bookmarks.data.FeatureId;
import com.mapswithme.util.ThemeUtils;
+import com.mapswithme.util.statistics.Statistics;
import java.util.ArrayList;
public class UGCEditorActivity extends BaseMwmFragmentActivity
{
-
//TODO: refactor to EditorParams with builder.
public static void start(@NonNull Activity activity, @NonNull String title,
@NonNull FeatureId featureId, @NonNull ArrayList<UGC.Rating> ratings,
- @UGC.Impress int defaultRating, boolean canBeReviewed)
+ @UGC.Impress int defaultRating, boolean canBeReviewed, boolean isFromPPP)
{
+ Statistics.INSTANCE.trackUGCStart(false /* isEdit */, isFromPPP);
final Intent i = new Intent(activity, UGCEditorActivity.class);
Bundle args = new Bundle();
args.putParcelable(UGCEditorFragment.ARG_FEATURE_ID, featureId);
@@ -44,4 +45,11 @@ public class UGCEditorActivity extends BaseMwmFragmentActivity
{
return UGCEditorFragment.class;
}
+
+ @Override
+ public void onBackPressed()
+ {
+ Statistics.INSTANCE.trackEvent(Statistics.EventName.UGC_REVIEW_CANCEL);
+ super.onBackPressed();
+ }
}
diff --git a/android/src/com/mapswithme/maps/ugc/UGCEditorFragment.java b/android/src/com/mapswithme/maps/ugc/UGCEditorFragment.java
index 3a59cb61d1..f3d71eaff0 100644
--- a/android/src/com/mapswithme/maps/ugc/UGCEditorFragment.java
+++ b/android/src/com/mapswithme/maps/ugc/UGCEditorFragment.java
@@ -13,9 +13,11 @@ import android.widget.EditText;
import com.mapswithme.maps.R;
import com.mapswithme.maps.auth.BaseMwmAuthorizationFragment;
import com.mapswithme.maps.bookmarks.data.FeatureId;
+import com.mapswithme.maps.widget.ToolbarController;
import com.mapswithme.util.UiUtils;
import com.mapswithme.util.log.Logger;
import com.mapswithme.util.log.LoggerFactory;
+import com.mapswithme.util.statistics.Statistics;
import java.util.List;
@@ -74,6 +76,20 @@ public class UGCEditorFragment extends BaseMwmAuthorizationFragment
}
@Override
+ protected ToolbarController onCreateToolbarController(@NonNull View root)
+ {
+ return new ToolbarController(root, getActivity())
+ {
+ @Override
+ public void onUpClick()
+ {
+ Statistics.INSTANCE.trackEvent(Statistics.EventName.UGC_REVIEW_CANCEL);
+ super.onUpClick();
+ }
+ };
+ }
+
+ @Override
protected void onSubmitButtonClick()
{
super.onSubmitButtonClick();
@@ -86,6 +102,7 @@ public class UGCEditorFragment extends BaseMwmAuthorizationFragment
if (featureId == null)
throw new AssertionError("Feature ID must be passed to this fragment!");
UGC.setUGCUpdate(featureId, update);
+ Statistics.INSTANCE.trackEvent(Statistics.EventName.UGC_REVIEW_SUCCESS);
getActivity().finish();
}
diff --git a/android/src/com/mapswithme/util/statistics/Statistics.java b/android/src/com/mapswithme/util/statistics/Statistics.java
index db92c58767..a69acf6d3e 100644
--- a/android/src/com/mapswithme/util/statistics/Statistics.java
+++ b/android/src/com/mapswithme/util/statistics/Statistics.java
@@ -16,6 +16,7 @@ import com.facebook.ads.AdError;
import com.facebook.appevents.AppEventsLogger;
import com.flurry.android.FlurryAgent;
import com.mapswithme.maps.BuildConfig;
+import com.mapswithme.maps.Framework;
import com.mapswithme.maps.MwmApplication;
import com.mapswithme.maps.PrivateVariables;
import com.mapswithme.maps.ads.MwmNativeAd;
@@ -58,6 +59,10 @@ import static com.mapswithme.util.statistics.Statistics.EventName.PP_SPONSORED_E
import static com.mapswithme.util.statistics.Statistics.EventName.PP_SPONSORED_OPEN;
import static com.mapswithme.util.statistics.Statistics.EventName.PP_SPONSORED_SHOWN;
import static com.mapswithme.util.statistics.Statistics.EventName.ROUTING_PLAN_TOOLTIP_CLICK;
+import static com.mapswithme.util.statistics.Statistics.EventName.UGC_AUTH_ERROR;
+import static com.mapswithme.util.statistics.Statistics.EventName.UGC_AUTH_EXTERNAL_REQUEST_SUCCESS;
+import static com.mapswithme.util.statistics.Statistics.EventName.UGC_AUTH_SHOWN;
+import static com.mapswithme.util.statistics.Statistics.EventName.UGC_REVIEW_START;
import static com.mapswithme.util.statistics.Statistics.EventParam.BANNER;
import static com.mapswithme.util.statistics.Statistics.EventParam.BANNER_STATE;
import static com.mapswithme.util.statistics.Statistics.EventParam.BATTERY;
@@ -89,8 +94,8 @@ import static com.mapswithme.util.statistics.Statistics.ParamValue.CIAN;
import static com.mapswithme.util.statistics.Statistics.ParamValue.GEOCHAT;
import static com.mapswithme.util.statistics.Statistics.ParamValue.OPENTABLE;
import static com.mapswithme.util.statistics.Statistics.ParamValue.SEARCH_BOOKING_COM;
-import static com.mapswithme.util.statistics.Statistics.ParamValue.VIATOR;
import static com.mapswithme.util.statistics.Statistics.ParamValue.THOR;
+import static com.mapswithme.util.statistics.Statistics.ParamValue.VIATOR;
public enum Statistics
{
@@ -248,6 +253,15 @@ public enum Statistics
// Cold start
public static final String APPLICATION_COLD_STARTUP_INFO = "Application_ColdStartup_info";
+ // Ugc.
+ public static final String UGC_REVIEW_START = "UGC_Review_start";
+ public static final String UGC_REVIEW_CANCEL = "UGC_Review_cancel";
+ public static final String UGC_REVIEW_SUCCESS = "UGC_Review_success";
+ public static final String UGC_AUTH_SHOWN = "UGC_Auth_shown";
+ public static final String UGC_AUTH_DECLINED = "UGC_Auth_declined";
+ public static final String UGC_AUTH_EXTERNAL_REQUEST_SUCCESS = "UGC_Auth_external_request_success";
+ public static final String UGC_AUTH_ERROR = "UGC_Auth_error";
+
public static class Settings
{
public static final String WEB_SITE = "Setings. Go to website";
@@ -355,6 +369,12 @@ public enum Statistics
public static final String CIAN = "Cian.Ru";
public static final String THOR = "Thor";
public static final String NO_PRODUCTS = "no_products";
+ public static final String ADD = "add";
+ public static final String EDIT = "edit";
+ public static final String AFTER_SAVE = "after_save";
+ public static final String PLACEPAGE_PREVIEW = "placepage_preview";
+ public static final String PLACEPAGE = "placepage";
+ public static final String FACEBOOK = "facebook";
}
// Initialized once in constructor and does not change until the process restarts.
@@ -872,6 +892,35 @@ public enum Statistics
}
}
+ public void trackUGCStart(boolean isEdit, boolean isPPPreview)
+ {
+ trackEvent(UGC_REVIEW_START,
+ params()
+ .add(EventParam.IS_AUTHENTICATED, Framework.nativeIsUserAuthenticated())
+ .add(EventParam.IS_ONLINE, ConnectionState.isConnected())
+ .add(EventParam.MODE, isEdit ? ParamValue.EDIT : ParamValue.ADD)
+ .add(EventParam.FROM, isPPPreview ? ParamValue.PLACEPAGE_PREVIEW : ParamValue.PLACEPAGE)
+ .get());
+ }
+
+ public void trackUGCAuthDialogShown()
+ {
+ trackEvent(UGC_AUTH_SHOWN, params().add(EventParam.FROM, ParamValue.AFTER_SAVE).get());
+ }
+
+ public void trackUGCExternalAuthSucceed(@NonNull String provider)
+ {
+ trackEvent(UGC_AUTH_EXTERNAL_REQUEST_SUCCESS, params().add(EventParam.PROVIDER, provider));
+ }
+
+ public void trackUGCAuthFailed(@NonNull String provider, @Nullable String error)
+ {
+ trackEvent(UGC_AUTH_ERROR, params()
+ .add(EventParam.PROVIDER, provider)
+ .add(EventParam.ERROR, error)
+ .get());
+ }
+
public static ParameterBuilder params()
{
return new ParameterBuilder();