mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 12:47:26 +01:00
Parse raw markdown of posts and comments instead of html.
This commit is contained in:
parent
1ce9650935
commit
90b01df2e9
@ -12,7 +12,7 @@ public class JSONUtils {
|
||||
static final String TITLE_KEY = "title";
|
||||
static final String NAME_KEY = "name";
|
||||
static final String SUBREDDIT_NAME_PREFIX_KEY = "subreddit_name_prefixed";
|
||||
static final String SELFTEXT_HTML_KEY = "selftext_html";
|
||||
static final String SELFTEXT_KEY = "selftext";
|
||||
static final String AUTHOR_KEY = "author";
|
||||
static final String LINK_FLAIR_TEXT_KEY = "link_flair_text";
|
||||
static final String SCORE_KEY = "score";
|
||||
@ -37,7 +37,7 @@ public class JSONUtils {
|
||||
static final String CROSSPOST_PARENT_LIST = "crosspost_parent_list";
|
||||
static final String REDDIT_VIDEO_PREVIEW_KEY = "reddit_video_preview";
|
||||
static final String STICKIED_KEY = "stickied";
|
||||
static final String BODY_HTML_KEY = "body_html";
|
||||
static final String BODY_KEY = "body";
|
||||
static final String COLLAPSED_KEY = "collapsed";
|
||||
static final String IS_SUBMITTER_KEY = "is_submitter";
|
||||
static final String REPLIES_KEY = "replies";
|
||||
|
@ -221,8 +221,8 @@ class ParseComment {
|
||||
String parentId = singleCommentData.getString(JSONUtils.PARENT_ID_KEY);
|
||||
boolean isSubmitter = singleCommentData.getBoolean(JSONUtils.IS_SUBMITTER_KEY);
|
||||
String commentContent = "";
|
||||
if(!singleCommentData.isNull(JSONUtils.BODY_HTML_KEY)) {
|
||||
commentContent = singleCommentData.getString(JSONUtils.BODY_HTML_KEY).trim();
|
||||
if(!singleCommentData.isNull(JSONUtils.BODY_KEY)) {
|
||||
commentContent = singleCommentData.getString(JSONUtils.BODY_KEY).trim();
|
||||
}
|
||||
String permalink = Html.fromHtml(singleCommentData.getString(JSONUtils.PERMALINK_KEY)).toString();
|
||||
int score = singleCommentData.getInt(JSONUtils.SCORE_KEY);
|
||||
|
@ -220,10 +220,10 @@ class ParsePost {
|
||||
post = new Post(id, fullName, subredditNamePrefixed, author, formattedPostTime,
|
||||
title, permalink, score, postType, voteType, gilded, flair, spoiler, nsfw,
|
||||
stickied, archived, isCrosspost);
|
||||
if(data.isNull(JSONUtils.SELFTEXT_HTML_KEY)) {
|
||||
if(data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
||||
post.setSelfText("");
|
||||
} else {
|
||||
post.setSelfText(data.getString(JSONUtils.SELFTEXT_HTML_KEY).trim());
|
||||
post.setSelfText(data.getString(JSONUtils.SELFTEXT_KEY).trim());
|
||||
}
|
||||
} else {
|
||||
//No preview link post
|
||||
@ -232,10 +232,10 @@ class ParsePost {
|
||||
post = new Post(id, fullName, subredditNamePrefixed, author, formattedPostTime,
|
||||
title, previewUrl, url, permalink, score, postType,
|
||||
voteType, gilded, flair, spoiler, nsfw, stickied, archived, isCrosspost);
|
||||
if(data.isNull(JSONUtils.SELFTEXT_HTML_KEY)) {
|
||||
if(data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
||||
post.setSelfText("");
|
||||
} else {
|
||||
post.setSelfText(data.getString(JSONUtils.SELFTEXT_HTML_KEY).trim());
|
||||
post.setSelfText(data.getString(JSONUtils.SELFTEXT_KEY).trim());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -315,10 +315,10 @@ class ParsePost {
|
||||
post.setPreviewWidth(previewWidth);
|
||||
post.setPreviewHeight(previewHeight);
|
||||
|
||||
if(data.isNull(JSONUtils.SELFTEXT_HTML_KEY)) {
|
||||
if(data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
||||
post.setSelfText("");
|
||||
} else {
|
||||
post.setSelfText(data.getString(JSONUtils.SELFTEXT_HTML_KEY).trim());
|
||||
post.setSelfText(data.getString(JSONUtils.SELFTEXT_KEY).trim());
|
||||
}
|
||||
} else {
|
||||
//Link post
|
||||
@ -328,10 +328,10 @@ class ParsePost {
|
||||
post = new Post(id, fullName, subredditNamePrefixed, author, formattedPostTime,
|
||||
title, previewUrl, url, permalink, score, postType, voteType, gilded,
|
||||
flair, spoiler, nsfw, stickied, archived, isCrosspost);
|
||||
if(data.isNull(JSONUtils.SELFTEXT_HTML_KEY)) {
|
||||
if(data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
||||
post.setSelfText("");
|
||||
} else {
|
||||
post.setSelfText(data.getString(JSONUtils.SELFTEXT_HTML_KEY).trim());
|
||||
post.setSelfText(data.getString(JSONUtils.SELFTEXT_KEY).trim());
|
||||
}
|
||||
|
||||
post.setPreviewWidth(previewWidth);
|
||||
|
Loading…
Reference in New Issue
Block a user