diff --git a/android/src/com/mapswithme/maps/MwmActivity.java b/android/src/com/mapswithme/maps/MwmActivity.java index a2481d7f93..bd511a2e3e 100644 --- a/android/src/com/mapswithme/maps/MwmActivity.java +++ b/android/src/com/mapswithme/maps/MwmActivity.java @@ -41,7 +41,6 @@ import com.mapswithme.maps.base.BaseMwmFragmentActivity; import com.mapswithme.maps.base.CustomNavigateUpListener; import com.mapswithme.maps.base.NoConnectionListener; import com.mapswithme.maps.base.OnBackPressListener; -import com.mapswithme.maps.bookmarks.AuthBundleFactory; import com.mapswithme.maps.bookmarks.BookmarkCategoriesActivity; import com.mapswithme.maps.bookmarks.BookmarksCatalogActivity; import com.mapswithme.maps.bookmarks.data.BookmarkCategory; @@ -2724,8 +2723,7 @@ public class MwmActivity extends BaseMwmFragmentActivity public void onGalleryGuideSelected(@NonNull String url) { BookmarksCatalogActivity.startForResult( - this, BookmarkCategoriesActivity.REQ_CODE_DOWNLOAD_BOOKMARK_CATEGORY, url, - AuthBundleFactory.guideCatalogue()); + this, BookmarkCategoriesActivity.REQ_CODE_DOWNLOAD_BOOKMARK_CATEGORY, url); } private void toggleLayer(@NonNull Mode mode) diff --git a/android/src/com/mapswithme/maps/auth/Authorizer.java b/android/src/com/mapswithme/maps/auth/Authorizer.java index e2bdf8bfe5..2f90a785ca 100644 --- a/android/src/com/mapswithme/maps/auth/Authorizer.java +++ b/android/src/com/mapswithme/maps/auth/Authorizer.java @@ -57,7 +57,7 @@ public class Authorizer implements AuthorizationListener mCallback = null; } - public final void authorize(@NonNull Bundle bundle) + public final void authorize() { if (isAuthorized()) { @@ -73,7 +73,6 @@ public class Authorizer implements AuthorizationListener return; fragment = (DialogFragment) Fragment.instantiate(mFragment.getContext(), name); - fragment.setArguments(bundle); // A communication with the SocialAuthDialogFragment is implemented via getParentFragment method // because of 'setTargetFragment' paradigm doesn't survive the activity configuration change // due to this issue https://issuetracker.google.com/issues/36969568 diff --git a/android/src/com/mapswithme/maps/auth/PassportAuthDialogFragment.java b/android/src/com/mapswithme/maps/auth/PassportAuthDialogFragment.java index 77470c9d42..5a91f5e209 100644 --- a/android/src/com/mapswithme/maps/auth/PassportAuthDialogFragment.java +++ b/android/src/com/mapswithme/maps/auth/PassportAuthDialogFragment.java @@ -36,7 +36,7 @@ public class PassportAuthDialogFragment extends BaseMwmDialogFragment super.onStart(); mAuthorizer.attach(mAuthCallback); if (mSavedInstanceState == null) - mAuthorizer.authorize(getArgumentsOrThrow()); + mAuthorizer.authorize(); } @Override diff --git a/android/src/com/mapswithme/maps/base/BaseAuthFragment.java b/android/src/com/mapswithme/maps/base/BaseAuthFragment.java index 14ea9f44b3..4bcbbae7d3 100644 --- a/android/src/com/mapswithme/maps/base/BaseAuthFragment.java +++ b/android/src/com/mapswithme/maps/base/BaseAuthFragment.java @@ -9,7 +9,6 @@ import androidx.annotation.Nullable; import com.mapswithme.maps.auth.Authorizer; import com.mapswithme.maps.auth.TargetFragmentCallback; -import com.mapswithme.maps.bookmarks.AuthBundleFactory; public abstract class BaseAuthFragment extends BaseAsyncOperationFragment implements Authorizer.Callback, TargetFragmentCallback @@ -17,9 +16,9 @@ public abstract class BaseAuthFragment extends BaseAsyncOperationFragment @NonNull private final Authorizer mAuthorizer = new Authorizer(this); - protected final void authorize(@NonNull Bundle bundle) + protected final void authorize() { - mAuthorizer.authorize(bundle); + mAuthorizer.authorize(); } @Override diff --git a/android/src/com/mapswithme/maps/base/BaseToolbarAuthFragment.java b/android/src/com/mapswithme/maps/base/BaseToolbarAuthFragment.java index da26fe3bc2..016f0999bc 100644 --- a/android/src/com/mapswithme/maps/base/BaseToolbarAuthFragment.java +++ b/android/src/com/mapswithme/maps/base/BaseToolbarAuthFragment.java @@ -21,9 +21,9 @@ public abstract class BaseToolbarAuthFragment extends BaseMwmToolbarFragment @NonNull private final Authorizer mAuthorizer = new Authorizer(this); - protected final void authorize(@NonNull Bundle bundle) + protected final void authorize() { - mAuthorizer.authorize(bundle); + mAuthorizer.authorize(); } @Override diff --git a/android/src/com/mapswithme/maps/bookmarks/AuthBundleFactory.java b/android/src/com/mapswithme/maps/bookmarks/AuthBundleFactory.java deleted file mode 100644 index 6982fd05d0..0000000000 --- a/android/src/com/mapswithme/maps/bookmarks/AuthBundleFactory.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.mapswithme.maps.bookmarks; - -import android.os.Bundle; - -import androidx.annotation.NonNull; - -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(); - bundle.putString(Statistics.EventParam.FROM, value); - return bundle; - } -} diff --git a/android/src/com/mapswithme/maps/bookmarks/BookmarkBackupController.java b/android/src/com/mapswithme/maps/bookmarks/BookmarkBackupController.java index 8625e8f69a..7fc26f7a7f 100644 --- a/android/src/com/mapswithme/maps/bookmarks/BookmarkBackupController.java +++ b/android/src/com/mapswithme/maps/bookmarks/BookmarkBackupController.java @@ -57,7 +57,7 @@ public class BookmarkBackupController implements Authorizer.Callback, @Override public void onClick(View v) { - mAuthorizer.authorize(AuthBundleFactory.bookmarksBackup()); + mAuthorizer.authorize(); } }; @NonNull diff --git a/android/src/com/mapswithme/maps/bookmarks/BookmarksCatalogActivity.java b/android/src/com/mapswithme/maps/bookmarks/BookmarksCatalogActivity.java index 2b8883ca41..c17069722a 100644 --- a/android/src/com/mapswithme/maps/bookmarks/BookmarksCatalogActivity.java +++ b/android/src/com/mapswithme/maps/bookmarks/BookmarksCatalogActivity.java @@ -18,30 +18,20 @@ public class BookmarksCatalogActivity extends BaseToolbarActivity public static void startForResult(@NonNull Fragment fragment, int requestCode, @NonNull String catalogUrl) { - fragment.startActivityForResult(makeLaunchIntent(fragment.requireContext(), catalogUrl, - AuthBundleFactory.guideCatalogue()), + fragment.startActivityForResult(makeLaunchIntent(fragment.requireContext(), catalogUrl), requestCode); } - public static void startForResult(@NonNull Activity context, int requestCode, - @NonNull String catalogUrl) + public static void startForResult(@NonNull Activity context, int requestCode, @NonNull String catalogUrl) { - startForResult(context, requestCode, catalogUrl, AuthBundleFactory.guideCatalogue()); - } - - public static void startForResult(@NonNull Activity context, int requestCode, - @NonNull String catalogUrl, @NonNull Bundle bundle) - { - context.startActivityForResult(makeLaunchIntent(context, catalogUrl, bundle), requestCode); + context.startActivityForResult(makeLaunchIntent(context, catalogUrl), requestCode); } @NonNull - private static Intent makeLaunchIntent(@NonNull Context context, @NonNull String catalogUrl, - @NonNull Bundle bundle) + private static Intent makeLaunchIntent(@NonNull Context context, @NonNull String catalogUrl) { return new Intent(context, BookmarksCatalogActivity.class) .putExtra(BookmarksCatalogFragment.EXTRA_BOOKMARKS_CATALOG_URL, catalogUrl) - .putExtra(EXTRA_ARGS, bundle) .setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); } diff --git a/android/src/com/mapswithme/maps/bookmarks/BookmarksCatalogFragment.java b/android/src/com/mapswithme/maps/bookmarks/BookmarksCatalogFragment.java index 8384cce5e0..c8bcc72b60 100644 --- a/android/src/com/mapswithme/maps/bookmarks/BookmarksCatalogFragment.java +++ b/android/src/com/mapswithme/maps/bookmarks/BookmarksCatalogFragment.java @@ -117,9 +117,7 @@ public class BookmarksCatalogFragment extends BaseWebViewMwmFragment public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); - Bundle extra = requireActivity().getIntent() - .getBundleExtra(BookmarksCatalogActivity.EXTRA_ARGS); - mDelegate = new BookmarksDownloadFragmentDelegate(this, extra, mAuthorizationListener); + mDelegate = new BookmarksDownloadFragmentDelegate(this, mAuthorizationListener); mDelegate.onCreate(savedInstanceState); mInvalidSubsDialogCallback = new InvalidSubscriptionAlertDialogCallback(this); } diff --git a/android/src/com/mapswithme/maps/bookmarks/BookmarksDownloadFragmentDelegate.java b/android/src/com/mapswithme/maps/bookmarks/BookmarksDownloadFragmentDelegate.java index 1210fe035d..c1f48e142f 100644 --- a/android/src/com/mapswithme/maps/bookmarks/BookmarksDownloadFragmentDelegate.java +++ b/android/src/com/mapswithme/maps/bookmarks/BookmarksDownloadFragmentDelegate.java @@ -52,21 +52,17 @@ class BookmarksDownloadFragmentDelegate implements Authorizer.Callback, Bookmark private final AuthorizationListener mAuthorizationListener; @NonNull private final ExpiredCategoriesListener mExpiredCategoriesListener; - @NonNull - private final Bundle mBundle; BookmarksDownloadFragmentDelegate(@NonNull Fragment fragment) { - this(fragment, AuthBundleFactory.guideCatalogue(), null); + this(fragment, null); } BookmarksDownloadFragmentDelegate(@NonNull Fragment fragment, - @NonNull Bundle bundle, @Nullable AuthorizationListener authorizationListener) { mFragment = fragment; mExpiredCategoriesListener = new ExpiredCategoriesListener(fragment); - mBundle = bundle; mAuthorizationListener = authorizationListener; } @@ -246,7 +242,7 @@ class BookmarksDownloadFragmentDelegate implements Authorizer.Callback, Bookmark void authorize(@NonNull Runnable completionRunnable) { mAuthCompletionRunnable = completionRunnable; - mAuthorizer.authorize(mBundle); + mAuthorizer.authorize(); } private static class ExpiredCategoriesListener implements BookmarkManager.BookmarksExpiredCategoriesListener, Detachable diff --git a/android/src/com/mapswithme/maps/purchase/AbstractBookmarkSubscriptionFragment.java b/android/src/com/mapswithme/maps/purchase/AbstractBookmarkSubscriptionFragment.java index ed4a477aa9..ef8975e49f 100644 --- a/android/src/com/mapswithme/maps/purchase/AbstractBookmarkSubscriptionFragment.java +++ b/android/src/com/mapswithme/maps/purchase/AbstractBookmarkSubscriptionFragment.java @@ -15,7 +15,6 @@ 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; @@ -99,11 +98,6 @@ abstract class AbstractBookmarkSubscriptionFragment extends BaseAuthFragment activateState(BookmarkSubscriptionPaymentState.CHECK_NETWORK_CONNECTION); } - protected void authorize() - { - authorize(AuthBundleFactory.subscription()); - } - @Override public final void onDestroyView() { diff --git a/android/src/com/mapswithme/maps/ugc/UGCEditorFragment.java b/android/src/com/mapswithme/maps/ugc/UGCEditorFragment.java index 7a9f1928db..6b60ce11ff 100644 --- a/android/src/com/mapswithme/maps/ugc/UGCEditorFragment.java +++ b/android/src/com/mapswithme/maps/ugc/UGCEditorFragment.java @@ -15,7 +15,6 @@ import com.mapswithme.maps.Framework; import com.mapswithme.maps.R; import com.mapswithme.maps.base.BaseToolbarAuthFragment; import com.mapswithme.maps.background.Notifier; -import com.mapswithme.maps.bookmarks.AuthBundleFactory; import com.mapswithme.maps.bookmarks.data.FeatureId; import com.mapswithme.maps.metrics.UserActionsLogger; import com.mapswithme.maps.widget.ToolbarController; @@ -127,7 +126,7 @@ public class UGCEditorFragment extends BaseToolbarAuthFragment finishActivity(); return; } - authorize(AuthBundleFactory.saveReview()); + authorize(); }); } diff --git a/android/src/com/mapswithme/maps/ugc/routes/SendLinkPlaceholderFragment.java b/android/src/com/mapswithme/maps/ugc/routes/SendLinkPlaceholderFragment.java index 96a6cd171d..ad634c3d1f 100644 --- a/android/src/com/mapswithme/maps/ugc/routes/SendLinkPlaceholderFragment.java +++ b/android/src/com/mapswithme/maps/ugc/routes/SendLinkPlaceholderFragment.java @@ -11,7 +11,6 @@ import android.view.ViewGroup; import com.mapswithme.maps.R; import com.mapswithme.maps.base.BaseAuthFragment; -import com.mapswithme.maps.bookmarks.AuthBundleFactory; import com.mapswithme.maps.bookmarks.data.BookmarkCategory; import com.mapswithme.maps.bookmarks.data.BookmarkManager; import com.mapswithme.maps.bookmarks.data.CatalogCustomProperty; @@ -105,7 +104,7 @@ public class SendLinkPlaceholderFragment extends BaseAuthFragment implements Boo if (uploadResult == BookmarkManager.UploadResult.UPLOAD_RESULT_SUCCESS) onUploadSucceeded(); else if (uploadResult == BookmarkManager.UploadResult.UPLOAD_RESULT_AUTH_ERROR) - authorize(AuthBundleFactory.exportBookmarks()); + authorize(); else onUploadFailed(); } diff --git a/android/src/com/mapswithme/maps/ugc/routes/UgcSharingOptionsFragment.java b/android/src/com/mapswithme/maps/ugc/routes/UgcSharingOptionsFragment.java index 0502497a18..0256335585 100644 --- a/android/src/com/mapswithme/maps/ugc/routes/UgcSharingOptionsFragment.java +++ b/android/src/com/mapswithme/maps/ugc/routes/UgcSharingOptionsFragment.java @@ -19,7 +19,6 @@ import com.mapswithme.maps.Framework; import com.mapswithme.maps.R; import com.mapswithme.maps.base.BaseToolbarAuthFragment; import com.mapswithme.maps.base.FinishActivityToolbarController; -import com.mapswithme.maps.bookmarks.AuthBundleFactory; import com.mapswithme.maps.bookmarks.data.AbstractCategoriesSnapshot; import com.mapswithme.maps.bookmarks.data.BookmarkCategory; import com.mapswithme.maps.bookmarks.data.BookmarkManager; @@ -339,7 +338,7 @@ public class UgcSharingOptionsFragment extends BaseToolbarAuthFragment implement if (isAuthorized()) onPostAuthCompleted(); else - authorize(AuthBundleFactory.exportBookmarks()); + authorize(); } private void onPostAuthCompleted()