diff options
author | andrewrasch <raschykid@gmail.com> | 2021-09-22 03:50:30 +0000 |
---|---|---|
committer | andrewrasch <raschykid@gmail.com> | 2021-09-22 03:50:30 +0000 |
commit | 2d5829830e062d5cef8ca3ffa55e7dab607b84a7 (patch) | |
tree | adf6d3729bf32ac88f71a1ccfd5f24aa4323def8 | |
parent | 5cfe8a601645383d0068f9acded1e99aa5f28459 (diff) | |
download | infinity-for-reddit-2d5829830e062d5cef8ca3ffa55e7dab607b84a7.tar infinity-for-reddit-2d5829830e062d5cef8ca3ffa55e7dab607b84a7.tar.gz infinity-for-reddit-2d5829830e062d5cef8ca3ffa55e7dab607b84a7.tar.bz2 infinity-for-reddit-2d5829830e062d5cef8ca3ffa55e7dab607b84a7.tar.lz infinity-for-reddit-2d5829830e062d5cef8ca3ffa55e7dab607b84a7.tar.xz infinity-for-reddit-2d5829830e062d5cef8ca3ffa55e7dab607b84a7.tar.zst infinity-for-reddit-2d5829830e062d5cef8ca3ffa55e7dab607b84a7.zip |
Fixed handling of wiki pages
LinkResolverActivity now handles wiki pages other than index and their subpages.
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java | 4 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java | 4 |
2 files changed, 5 insertions, 3 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 a6596edb..a4668cc5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java @@ -49,7 +49,7 @@ public class LinkResolverActivity extends AppCompatActivity { private static final String IMGUR_ALBUM_PATTERN = "/(album|a)/\\w+/?"; 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 WIKI_PATTERN = "/[rR]/[\\w-]+/(wiki|w)?(?:/\\w+)+"; @Inject @Named("default") @@ -173,8 +173,10 @@ public class LinkResolverActivity extends AppCompatActivity { deepLinkError(uri); } } else if (path.matches(WIKI_PATTERN)) { + final String wikiPage = path.substring(path.lastIndexOf("/wiki/") + 6); Intent intent = new Intent(this, WikiActivity.class); intent.putExtra(WikiActivity.EXTRA_SUBREDDIT_NAME, segments.get(1)); + intent.putExtra(WikiActivity.EXTRA_WIKI_PATH, wikiPage); startActivity(intent); } else if (path.matches(SUBREDDIT_PATTERN)) { Intent intent = new Intent(this, ViewSubredditDetailActivity.class); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java index b6fc29af..372d3c6f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java @@ -71,7 +71,7 @@ import retrofit2.Retrofit; public class WikiActivity extends BaseActivity { public static final String EXTRA_SUBREDDIT_NAME = "ESN"; - public static final String WIKI_PATH = "WP"; + public static final String EXTRA_WIKI_PATH = "EWP"; private static final String WIKI_MARKDOWN_STATE = "WMS"; @BindView(R.id.coordinator_layout_comment_wiki_activity) @@ -282,7 +282,7 @@ public class WikiActivity extends BaseActivity { Glide.with(this).clear(mFetchWikiInfoImageView); mFetchWikiInfoLinearLayout.setVisibility(View.GONE); - retrofit.create(RedditAPI.class).getWiki(getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME)).enqueue(new Callback<String>() { + retrofit.create(RedditAPI.class).getWikiPage(getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME), getIntent().getStringExtra(EXTRA_WIKI_PATH)).enqueue(new Callback<String>() { @Override public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) { if (response.isSuccessful()) { |