aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-05-14 22:15:48 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-05-14 22:15:48 +0000
commit382f3e8167f20f1f3042439c10c546d38e5edfb9 (patch)
tree357e90d1bac9596bd65842946eba5a1cee307306 /app/src/main/java/ml
parentcc9880cadd93cccfc211fde90a73a4ce2113da81 (diff)
downloadinfinity-for-reddit-382f3e8167f20f1f3042439c10c546d38e5edfb9.tar
infinity-for-reddit-382f3e8167f20f1f3042439c10c546d38e5edfb9.tar.gz
infinity-for-reddit-382f3e8167f20f1f3042439c10c546d38e5edfb9.tar.bz2
infinity-for-reddit-382f3e8167f20f1f3042439c10c546d38e5edfb9.tar.lz
infinity-for-reddit-382f3e8167f20f1f3042439c10c546d38e5edfb9.tar.xz
infinity-for-reddit-382f3e8167f20f1f3042439c10c546d38e5edfb9.tar.zst
infinity-for-reddit-382f3e8167f20f1f3042439c10c546d38e5edfb9.zip
Fix https://github.com/Docile-Alligator/Infinity-For-Reddit/issues/1636
Diffstat (limited to 'app/src/main/java/ml')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java5
1 files changed, 5 insertions, 0 deletions
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 5a4c0311..3e2d47c8 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java
@@ -57,6 +57,7 @@ public class LinkResolverActivity extends AppCompatActivity {
private static final String IMGUR_GALLERY_PATTERN = "/gallery/\\w+/?";
private static final String IMGUR_ALBUM_PATTERN = "/(album|a)/\\w+/?";
private static final String IMGUR_IMAGE_PATTERN = "/\\w+/?";
+ private static final String MEDIA_PATTERN = "/media/?";
private static final String WIKI_PATTERN = "/[rR]/[\\w-]+/(wiki|w)(?:/[\\w-]+)*";
private static final String GOOGLE_AMP_PATTERN = "/amp/s/amp.reddit.com/.*";
private static final String STREAMABLE_PATTERN = "/\\w+/?";
@@ -186,6 +187,10 @@ public class LinkResolverActivity extends AppCompatActivity {
startActivity(intent);
} else if (path.equals("/report")) {
openInWebView(uri);
+ } else if (path.matches(MEDIA_PATTERN)) {
+ // TODO: check if this can be video.
+ // Example: https://www.reddit.com/media?url=https%3A%2F%2Fpreview.redd.it%2F9iamzovpcrta1.png%3Fwidth%3D720%26auto%3Dwebp%26s%3Da6d1287094fc6ad986e1245a5fc3869b2f0c7da4
+ deepLinkError(uri);
} else if (path.matches(POST_PATTERN) || path.matches(POST_PATTERN_2)) {
int commentsIndex = segments.lastIndexOf("comments");
if (commentsIndex >= 0 && commentsIndex < segments.size() - 1) {