diff options
author | andrewrasch <raschykid@gmail.com> | 2021-09-22 02:10:38 +0000 |
---|---|---|
committer | andrewrasch <raschykid@gmail.com> | 2021-09-22 02:10:38 +0000 |
commit | 1fb3ba6e3fa57904bdde486d5f6bb793be788f71 (patch) | |
tree | 169cba2723c54410e045e8e234035e900df05e4f /app/src | |
parent | d6c3bfddd713b064e545461238978d3fa6c9941e (diff) | |
download | infinity-for-reddit-1fb3ba6e3fa57904bdde486d5f6bb793be788f71.tar infinity-for-reddit-1fb3ba6e3fa57904bdde486d5f6bb793be788f71.tar.gz infinity-for-reddit-1fb3ba6e3fa57904bdde486d5f6bb793be788f71.tar.bz2 infinity-for-reddit-1fb3ba6e3fa57904bdde486d5f6bb793be788f71.tar.lz infinity-for-reddit-1fb3ba6e3fa57904bdde486d5f6bb793be788f71.tar.xz infinity-for-reddit-1fb3ba6e3fa57904bdde486d5f6bb793be788f71.tar.zst infinity-for-reddit-1fb3ba6e3fa57904bdde486d5f6bb793be788f71.zip |
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.
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/AndroidManifest.xml | 7 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java | 8 |
2 files changed, 15 insertions, 0 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 78090f43..f17f60e8 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -277,6 +277,13 @@ android:host="reddit.com" android:scheme="https" /> <data + android:host="www.google.com" + android:scheme="https" + android:pathPattern="/amp/s/amp.reddit.com/.*"/> + <data + android:host="v.redd.it" + android:scheme="https" /> + <data android:host="amp.reddit.com" android:scheme="https" /> <data 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); } |