From 420e9518bc1e4bd8bc0b623425b04ed90c68eb91 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Sat, 4 Apr 2020 17:38:46 +0800 Subject: Support redd.it links. --- .../infinityforreddit/Activity/LinkResolverActivity.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'app/src/main/java') 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 2cd62f20..18799121 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java @@ -37,6 +37,7 @@ public class LinkResolverActivity extends AppCompatActivity { private static final String USER_PATTERN_2 = "/[uU]/\\w+/{0,1}"; private static final String SIDEBAR_PATTERN = "/[rR]/\\w+/about/sidebar"; private static final String MULTIREDDIT_PATTERN = "/user/\\w+/m/\\w+/{0,1}"; + private static final String REDD_IT_POST_PATTERN = "/\\w+/{0,1}"; @Inject @Named("default") @@ -130,7 +131,12 @@ public class LinkResolverActivity extends AppCompatActivity { Intent intent = new Intent(this, ViewMultiRedditDetailActivity.class); intent.putExtra(ViewMultiRedditDetailActivity.EXTRA_MULTIREDDIT_PATH, path); startActivity(intent); - } else { + } else if (path.matches(REDD_IT_POST_PATTERN)) { + Intent intent = new Intent(this, ViewPostDetailActivity.class); + intent.putExtra(ViewPostDetailActivity.EXTRA_POST_ID, path.substring(1)); + startActivity(intent); + } + else { deepLinkError(uri); } } -- cgit v1.2.3