mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-28 11:58:23 +01:00
Fixed handling of wiki pages
LinkResolverActivity now handles wiki pages other than index and their subpages.
This commit is contained in:
parent
5cfe8a6016
commit
2d5829830e
@ -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);
|
||||
|
@ -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()) {
|
||||
|
Loading…
Reference in New Issue
Block a user