diff options
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java index f932427f..ff39b7f3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java @@ -56,6 +56,10 @@ public class LinkResolverActivity extends AppCompatActivity { ((Infinity) getApplication()).getAppComponent().inject(this); Uri uri = getIntent().getData(); + handleUri(uri); + } + + private void handleUri(Uri uri) { if (uri == null) { Toast.makeText(this, R.string.no_link_available, Toast.LENGTH_SHORT).show(); finish(); @@ -73,7 +77,10 @@ public class LinkResolverActivity extends AppCompatActivity { String authority = uri.getAuthority(); if (authority != null && (authority.contains("reddit.com") || authority.contains("redd.it") || authority.contains("reddit.app"))) { - if (path.matches(POST_PATTERN)) { + if (authority.equals("reddit.app.link") && path.isEmpty()) { + String redirect = uri.getQueryParameter("$og_redirect"); + handleUri(Uri.parse(redirect)); + } else if (path.matches(POST_PATTERN)) { List<String> segments = uri.getPathSegments(); int commentsIndex = segments.lastIndexOf("comments"); if (commentsIndex >= 0 && commentsIndex < segments.size() - 1) { |