From 4a4c8f750af0e15b155030d97ee4958293582500 Mon Sep 17 00:00:00 2001 From: Dmitry Donskoy Date: Tue, 2 Jun 2020 17:26:53 +0300 Subject: [PATCH] [android] Fixed review notes --- .../mapswithme/maps/auth/SocialAuthDialogFragment.java | 5 +++-- .../src/com/mapswithme/maps/base/BaseAuthFragment.java | 7 +------ .../mapswithme/maps/base/BaseToolbarAuthFragment.java | 2 +- .../com/mapswithme/maps/bookmarks/AuthBundleFactory.java | 9 +++++++-- android/src/com/mapswithme/maps/intent/Factory.java | 3 ++- .../purchase/AbstractBookmarkSubscriptionFragment.java | 6 ++++++ 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/android/src/com/mapswithme/maps/auth/SocialAuthDialogFragment.java b/android/src/com/mapswithme/maps/auth/SocialAuthDialogFragment.java index ff79d4b7bf..1b220d684f 100644 --- a/android/src/com/mapswithme/maps/auth/SocialAuthDialogFragment.java +++ b/android/src/com/mapswithme/maps/auth/SocialAuthDialogFragment.java @@ -107,8 +107,7 @@ public class SocialAuthDialogFragment extends BaseMwmDialogFragment .requestIdToken(PrivateVariables.googleWebClientId()) .requestEmail() .build(); - mGoogleSignInClient = GoogleSignIn.getClient(getActivity(), gso); - trackStatsIfArgsExist(Statistics.EventName.AUTH_SHOWN); + mGoogleSignInClient = GoogleSignIn.getClient(requireActivity(), gso); } private void trackStatsIfArgsExist(@NonNull String action) @@ -165,6 +164,8 @@ public class SocialAuthDialogFragment extends BaseMwmDialogFragment setButtonAvailability(view, false, R.id.google_button, R.id.facebook_button, R.id.phone_button); + + trackStatsIfArgsExist(Statistics.EventName.AUTH_SHOWN); return view; } diff --git a/android/src/com/mapswithme/maps/base/BaseAuthFragment.java b/android/src/com/mapswithme/maps/base/BaseAuthFragment.java index 49d05fe4ce..14ea9f44b3 100644 --- a/android/src/com/mapswithme/maps/base/BaseAuthFragment.java +++ b/android/src/com/mapswithme/maps/base/BaseAuthFragment.java @@ -17,12 +17,7 @@ public abstract class BaseAuthFragment extends BaseAsyncOperationFragment @NonNull private final Authorizer mAuthorizer = new Authorizer(this); - protected void authorize() - { - mAuthorizer.authorize(AuthBundleFactory.subscription()); - } - - protected void authorize(@NonNull Bundle bundle) + protected final void authorize(@NonNull Bundle bundle) { mAuthorizer.authorize(bundle); } diff --git a/android/src/com/mapswithme/maps/base/BaseToolbarAuthFragment.java b/android/src/com/mapswithme/maps/base/BaseToolbarAuthFragment.java index 44068d9f42..da26fe3bc2 100644 --- a/android/src/com/mapswithme/maps/base/BaseToolbarAuthFragment.java +++ b/android/src/com/mapswithme/maps/base/BaseToolbarAuthFragment.java @@ -21,7 +21,7 @@ public abstract class BaseToolbarAuthFragment extends BaseMwmToolbarFragment @NonNull private final Authorizer mAuthorizer = new Authorizer(this); - protected void authorize(@NonNull Bundle bundle) + protected final void authorize(@NonNull Bundle bundle) { mAuthorizer.authorize(bundle); } diff --git a/android/src/com/mapswithme/maps/bookmarks/AuthBundleFactory.java b/android/src/com/mapswithme/maps/bookmarks/AuthBundleFactory.java index 9f409f7f98..5068d07521 100644 --- a/android/src/com/mapswithme/maps/bookmarks/AuthBundleFactory.java +++ b/android/src/com/mapswithme/maps/bookmarks/AuthBundleFactory.java @@ -5,34 +5,39 @@ import android.os.Bundle; import androidx.annotation.NonNull; import com.mapswithme.util.statistics.Statistics; -public abstract class AuthBundleFactory +public class AuthBundleFactory { - + @NonNull public static Bundle saveReview() { return buildBundle(Statistics.EventParam.AFTER_SAVE_REVIEW); } + @NonNull public static Bundle bookmarksBackup() { return buildBundle(Statistics.EventParam.BOOKMARKS_BACKUP); } + @NonNull public static Bundle guideCatalogue() { return buildBundle(Statistics.EventParam.GUIDE_CATALOGUE); } + @NonNull public static Bundle subscription() { return buildBundle(Statistics.EventParam.SUBSCRIPTION); } + @NonNull public static Bundle exportBookmarks() { return buildBundle(Statistics.EventParam.EXPORT_BOOKMARKS); } + @NonNull private static Bundle buildBundle(@NonNull String value) { Bundle bundle = new Bundle(); diff --git a/android/src/com/mapswithme/maps/intent/Factory.java b/android/src/com/mapswithme/maps/intent/Factory.java index dbf70b8f0d..77e7ccd09f 100644 --- a/android/src/com/mapswithme/maps/intent/Factory.java +++ b/android/src/com/mapswithme/maps/intent/Factory.java @@ -1306,7 +1306,8 @@ public class Factory private static Bundle toDialogArgs(@NonNull List pairs) { Bundle bundle = new Bundle(); - for (KeyValue each : pairs) bundle.putString(each.getKey(), each.getValue()); + for (KeyValue each : pairs) + bundle.putString(each.getKey(), each.getValue()); return bundle; } } diff --git a/android/src/com/mapswithme/maps/purchase/AbstractBookmarkSubscriptionFragment.java b/android/src/com/mapswithme/maps/purchase/AbstractBookmarkSubscriptionFragment.java index 3f9e9e744a..adb31041db 100644 --- a/android/src/com/mapswithme/maps/purchase/AbstractBookmarkSubscriptionFragment.java +++ b/android/src/com/mapswithme/maps/purchase/AbstractBookmarkSubscriptionFragment.java @@ -16,6 +16,7 @@ import com.android.billingclient.api.SkuDetails; import com.mapswithme.maps.Framework; import com.mapswithme.maps.R; import com.mapswithme.maps.base.BaseAuthFragment; +import com.mapswithme.maps.bookmarks.AuthBundleFactory; import com.mapswithme.maps.bookmarks.data.BookmarkManager; import com.mapswithme.maps.dialog.AlertDialog; import com.mapswithme.maps.dialog.AlertDialogCallback; @@ -112,6 +113,11 @@ abstract class AbstractBookmarkSubscriptionFragment extends BaseAuthFragment activateState(BookmarkSubscriptionPaymentState.CHECK_NETWORK_CONNECTION); } + protected void authorize() + { + authorize(AuthBundleFactory.subscription()); + } + @Override public final void onDestroyView() {