From bb63846d766958cea7df92b205dd950c291bf30b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80=20?= =?UTF-8?q?=D0=97=D0=B0=D1=86=D0=B5=D0=BF=D0=B8=D0=BD?= Date: Fri, 19 Apr 2019 17:43:36 +0300 Subject: [PATCH] [android] Added handling of deeplinks when they came silmultaneously on the first launch, i.e. made last incoming deeplink main --- .../maps/DownloadResourcesLegacyActivity.java | 12 +++++++----- android/src/com/mapswithme/maps/intent/Factory.java | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/android/src/com/mapswithme/maps/DownloadResourcesLegacyActivity.java b/android/src/com/mapswithme/maps/DownloadResourcesLegacyActivity.java index d014cd80ef..62e28df4aa 100644 --- a/android/src/com/mapswithme/maps/DownloadResourcesLegacyActivity.java +++ b/android/src/com/mapswithme/maps/DownloadResourcesLegacyActivity.java @@ -492,13 +492,15 @@ public class DownloadResourcesLegacyActivity extends BaseMwmFragmentActivity if (intent == null) return null; - MwmApplication application = (MwmApplication) getApplicationContext(); - String firstLaunchDeeplink = application.getMediator().retrieveFirstLaunchDeeplink(); - if (!TextUtils.isEmpty(firstLaunchDeeplink)) + MwmApplication application = MwmApplication.from(this); + intent.putExtra(Factory.EXTRA_IS_FIRST_LAUNCH, application.isFirstLaunch()); + if (intent.getData() == null) { - intent.setData(Uri.parse(firstLaunchDeeplink)); - intent.putExtra(Factory.EXTRA_IS_FIRST_LAUNCH_DEEPLINK, true); + String firstLaunchDeeplink = application.getMediator().retrieveFirstLaunchDeeplink(); + if (!TextUtils.isEmpty(firstLaunchDeeplink)) + intent.setData(Uri.parse(firstLaunchDeeplink)); } + MapTask mapTaskToForward; for (IntentProcessor ip : mIntentProcessors) { diff --git a/android/src/com/mapswithme/maps/intent/Factory.java b/android/src/com/mapswithme/maps/intent/Factory.java index a8f74e3b75..cb73163018 100644 --- a/android/src/com/mapswithme/maps/intent/Factory.java +++ b/android/src/com/mapswithme/maps/intent/Factory.java @@ -51,7 +51,7 @@ import java.util.Locale; public class Factory { - public static final String EXTRA_IS_FIRST_LAUNCH_DEEPLINK = "extra_is_first_launch_deeplink"; + public static final String EXTRA_IS_FIRST_LAUNCH = "extra_is_first_launch"; @NonNull public static IntentProcessor createBuildRouteProcessor() { @@ -150,7 +150,7 @@ public class Factory @Override public final MapTask process(@NonNull Intent intent) { - mFirstLaunch = intent.getBooleanExtra(Factory.EXTRA_IS_FIRST_LAUNCH_DEEPLINK, false); + mFirstLaunch = intent.getBooleanExtra(Factory.EXTRA_IS_FIRST_LAUNCH, false); Uri data = intent.getData(); if (data == null) throw new AssertionError("Data must be non-null!");