forked from organicmaps/organicmaps
[android] Added converting guides page raw url to guides page deeplink for both cases: introduction screen and map target task
This commit is contained in:
parent
a543a0d10b
commit
14c2d083e2
2 changed files with 15 additions and 10 deletions
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue