diff options
author | Docile-Alligator <chineseperson5@gmail.com> | 2021-09-23 12:00:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-23 12:00:57 +0000 |
commit | cf9829046ac7ba92aa42db67468d23dd5b25cf97 (patch) | |
tree | 592ae5c660158011ea9bf3e338fa20d28ea6a413 /app/src/main | |
parent | 64f0c7336066c0001d83f9a85ccb50f1b3ab5787 (diff) | |
parent | f2fd1633754f88bc8bcaca51ca32a389892835db (diff) | |
download | infinity-for-reddit-cf9829046ac7ba92aa42db67468d23dd5b25cf97.tar infinity-for-reddit-cf9829046ac7ba92aa42db67468d23dd5b25cf97.tar.gz infinity-for-reddit-cf9829046ac7ba92aa42db67468d23dd5b25cf97.tar.bz2 infinity-for-reddit-cf9829046ac7ba92aa42db67468d23dd5b25cf97.tar.lz infinity-for-reddit-cf9829046ac7ba92aa42db67468d23dd5b25cf97.tar.xz infinity-for-reddit-cf9829046ac7ba92aa42db67468d23dd5b25cf97.tar.zst infinity-for-reddit-cf9829046ac7ba92aa42db67468d23dd5b25cf97.zip |
Merge pull request #469 from andrewrasch/link-handling-fixes
Update link handling for amp and v.redd.it
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/AndroidManifest.xml | 74 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java | 8 |
2 files changed, 60 insertions, 22 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 78090f43..e709293f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -272,70 +272,100 @@ <data android:host="www.reddit.com" - android:scheme="https" /> + android:scheme="https" + android:pathPattern=".*"/> <data android:host="reddit.com" - android:scheme="https" /> + android:scheme="https" + android:pathPattern=".*" /> + <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" + android:pathPattern=".*" /> <data android:host="amp.reddit.com" - android:scheme="https" /> + android:scheme="https" + android:pathPattern=".*" /> <data android:host="m.reddit.com" - android:scheme="https" /> + android:scheme="https" + android:pathPattern=".*" /> <data android:host="old.reddit.com" - android:scheme="https" /> + android:scheme="https" + android:pathPattern=".*" /> <data android:host="new.reddit.com" - android:scheme="https" /> + android:scheme="https" + android:pathPattern=".*" /> <data android:host="np.reddit.com" - android:scheme="https" /> + android:scheme="https" + android:pathPattern=".*" /> <data android:host="reddit.app.link" - android:scheme="https" /> + android:scheme="https" + android:pathPattern=".*" /> <data android:host="redd.it" - android:scheme="https" /> + android:scheme="https" + android:pathPattern=".*" /> <data android:host="s.reddit.com" - android:scheme="https" /> + android:scheme="https" + android:pathPattern=".*" /> <data android:host="click.redditmail.com" - android:scheme="https" /> + android:scheme="https" + android:pathPattern=".*" /> <data android:host="www.reddit.com" - android:scheme="http" /> + android:scheme="http" + android:pathPattern=".*" /> <data android:host="reddit.com" - android:scheme="http" /> + android:scheme="http" + android:pathPattern=".*" /> <data android:host="amp.reddit.com" - android:scheme="http" /> + android:scheme="http" + android:pathPattern=".*" /> <data android:host="m.reddit.com" - android:scheme="http" /> + android:scheme="http" + android:pathPattern=".*" /> <data android:host="old.reddit.com" - android:scheme="http" /> + android:scheme="http" + android:pathPattern=".*" /> <data android:host="new.reddit.com" - android:scheme="http" /> + android:scheme="http" + android:pathPattern=".*" /> <data android:host="np.reddit.com" - android:scheme="http" /> + android:scheme="http" + android:pathPattern=".*" /> <data android:host="reddit.app.link" - android:scheme="http" /> + android:scheme="http" + android:pathPattern=".*" /> <data android:host="redd.it" - android:scheme="http" /> + android:scheme="http" + android:pathPattern=".*" /> <data android:host="s.reddit.com" - android:scheme="http" /> + android:scheme="http" + android:pathPattern=".*" /> <data android:host="click.redditmail.com" - android:scheme="http" /> + android:scheme="http" + android:pathPattern=".*" /> </intent-filter> </activity> <activity 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 a4668cc5..3db1af77 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") @@ -268,6 +269,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); } |