From 1fb3ba6e3fa57904bdde486d5f6bb793be788f71 Mon Sep 17 00:00:00 2001 From: andrewrasch Date: Tue, 21 Sep 2021 22:10:38 -0400 Subject: Update link handling for amp and v.redd.it Added manifest entries for google.com amp links (reddit only) and v.redd.it. Updated handling of google amp links in LinkResolverActivity. --- .../infinityforreddit/activities/LinkResolverActivity.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/src/main/java/ml') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java index a6596edb..a9049cfb 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java @@ -50,6 +50,7 @@ public class LinkResolverActivity extends AppCompatActivity { private static final String IMGUR_IMAGE_PATTERN = "/\\w+/?"; private static final String RPAN_BROADCAST_PATTERN = "/rpan/r/[\\w-]+/\\w+/?\\w+/?"; private static final String WIKI_PATTERN = "/[rR]/[\\w-]+/(wiki|w)/?\\w+"; + private static final String GOOGLE_AMP_PATTERN = "/amp/s/amp.reddit.com/.*"; @Inject @Named("default") @@ -266,6 +267,13 @@ public class LinkResolverActivity extends AppCompatActivity { } else { deepLinkError(uri); } + } else if (authority.contains("google.com") ){ + if ( path.matches(GOOGLE_AMP_PATTERN) ) { + String url = path.substring(11, path.length()); // skipping past amp straight to reddit + handleUri(Uri.parse("https://" + url)); + } else { + deepLinkError(uri); + } } else { deepLinkError(uri); } -- cgit v1.2.3