From 14c2d083e2a61812588660e8ad18a63eb2225b70 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: Mon, 22 Apr 2019 14:02:27 +0300 Subject: [PATCH] [android] Added converting guides page raw url to guides page deeplink for both cases: introduction screen and map target task --- .../bookmarks/BookmarksCatalogActivity.java | 8 +------- .../src/com/mapswithme/maps/intent/Factory.java | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/android/src/com/mapswithme/maps/bookmarks/BookmarksCatalogActivity.java b/android/src/com/mapswithme/maps/bookmarks/BookmarksCatalogActivity.java index 04ee24969c..9978c8fac3 100644 --- a/android/src/com/mapswithme/maps/bookmarks/BookmarksCatalogActivity.java +++ b/android/src/com/mapswithme/maps/bookmarks/BookmarksCatalogActivity.java @@ -3,12 +3,10 @@ package com.mapswithme.maps.bookmarks; import android.app.Activity; import android.content.Context; import android.content.Intent; -import android.net.Uri; import android.support.annotation.NonNull; import android.support.v4.app.Fragment; import com.mapswithme.maps.base.BaseToolbarActivity; -import com.mapswithme.maps.bookmarks.data.BookmarkManager; public class BookmarksCatalogActivity extends BaseToolbarActivity { @@ -30,11 +28,7 @@ public class BookmarksCatalogActivity extends BaseToolbarActivity public static void startByGuidesPageDeeplink(@NonNull Activity context, @NonNull String deeplink) { - String baseCatalogUrl = BookmarkManager.INSTANCE.getCatalogFrontendUrl(); - String relativePath = Uri.parse(deeplink).getQueryParameter("url"); - Uri.Builder builder = Uri.parse(baseCatalogUrl) - .buildUpon().appendEncodedPath(relativePath); - BookmarksCatalogActivity.start(context, builder.toString()); + BookmarksCatalogActivity.start(context, deeplink); } public static void start(@NonNull Activity context, @NonNull String catalogUrl) diff --git a/android/src/com/mapswithme/maps/intent/Factory.java b/android/src/com/mapswithme/maps/intent/Factory.java index cb73163018..12bb8a37ae 100644 --- a/android/src/com/mapswithme/maps/intent/Factory.java +++ b/android/src/com/mapswithme/maps/intent/Factory.java @@ -142,6 +142,15 @@ public class Factory return new MapsmeProcessor(); } + @NonNull + private static String convertUrlToGuidesPageDeeplink(@NonNull String url) + { + String baseCatalogUrl = BookmarkManager.INSTANCE.getCatalogFrontendUrl(); + String relativePath = Uri.parse(url).getQueryParameter("url"); + return Uri.parse(baseCatalogUrl) + .buildUpon().appendEncodedPath(relativePath).toString(); + } + private static abstract class LogIntentProcessor implements IntentProcessor { private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.MISC); @@ -702,8 +711,9 @@ public class Factory @Override public boolean run(@NonNull MwmActivity target) { - BookmarksCatalogActivity.startByGuidesPageDeeplink(target, getUrl()); - return false; + String deeplink = convertUrlToGuidesPageDeeplink(getUrl()); + BookmarksCatalogActivity.startByGuidesPageDeeplink(target, deeplink); + return true; } } @@ -736,7 +746,8 @@ public class Factory @Override public boolean run(@NonNull MwmActivity target) { - target.showIntroductionScreenForDeeplink(getUrl(), IntroductionScreenFactory.GUIDES_PAGE); + String deeplink = convertUrlToGuidesPageDeeplink(getUrl()); + target.showIntroductionScreenForDeeplink(deeplink, IntroductionScreenFactory.GUIDES_PAGE); return true; } }