1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-12-23 05:16:58 +00:00

Type story_share is now covered

This commit is contained in:
Austin Huang 2020-07-01 16:00:26 -04:00
parent 19763f3edd
commit 9d49b937e4
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
3 changed files with 42 additions and 4 deletions

View File

@ -271,6 +271,30 @@ public final class MessageItemsAdapter extends RecyclerView.Adapter<TextMessageV
}
break;
case STORY_SHARE: {
final DirectItemReelShareModel reelShare = directItemModel.getReelShare();
if (reelShare == null) {
holder.tvMessage.setText(HtmlCompat.fromHtml(directItemModel.getText().toString(), 63));
holder.tvMessage.setVisibility(View.VISIBLE);
}
else {
if (!Utils.isEmpty(text = reelShare.getText())) {
holder.tvMessage.setText(text);
holder.tvMessage.setVisibility(View.VISIBLE);
}
final DirectItemMediaModel reelShareMedia = reelShare.getMedia();
final MediaItemType mediaType = reelShareMedia.getMediaType();
holder.mediaTypeIcon.setVisibility(mediaType == MediaItemType.MEDIA_TYPE_VIDEO ||
mediaType == MediaItemType.MEDIA_TYPE_SLIDER ? View.VISIBLE : View.GONE);
glideRequestManager.load(reelShareMedia.getThumbUrl()).into(holder.ivMediaPreview);
holder.mediaMessageContainer.setVisibility(View.VISIBLE);
}
}
break;
case VOICE_MEDIA: {
final DirectItemVoiceMediaModel voiceMediaModel = directItemModel.getVoiceMediaModel();

View File

@ -16,4 +16,5 @@ public enum DirectItemType implements Serializable {
REEL_SHARE,
ACTION_LOG,
PLACEHOLDER,
STORY_SHARE,
}

View File

@ -402,7 +402,7 @@ public final class Utils {
if ("video_call_event".equals(itemType)) return DirectItemType.VIDEO_CALL_EVENT;
if ("animated_media".equals(itemType)) return DirectItemType.ANIMATED_MEDIA;
if ("voice_media".equals(itemType)) return DirectItemType.VOICE_MEDIA;
//if ("story_share".equals(itemType)) return DirectItemType.STORY_SHARE;
if ("story_share".equals(itemType)) return DirectItemType.STORY_SHARE;
return DirectItemType.TEXT;
}
@ -524,7 +524,6 @@ public final class Utils {
case REEL_SHARE: {
final JSONObject reelShare = itemObject.getJSONObject("reel_share");
Log.d("AWAISKING_APP", "(rs) itemObject: " + itemObject); // todo
reelShareModel = new DirectItemReelShareModel(
reelShare.optBoolean("is_reel_persisted"),
reelShare.getLong("reel_owner_id"),
@ -635,8 +634,22 @@ public final class Utils {
((SpannableString) text).setSpan(new RelativeSizeSpan(15f), 0, text.length(), 0);
break;
/*case STORY_SHARE:
if*/
case STORY_SHARE:
final JSONObject storyShare = itemObject.getJSONObject("story_share");
if (!storyShare.has("media"))
text = "<small>" + storyShare.optString("message") + "</small>";
else {
reelShareModel = new DirectItemReelShareModel(
storyShare.optBoolean("is_reel_persisted"),
storyShare.getJSONObject("media").getJSONObject("user").getLong("pk"),
storyShare.getString("text"),
storyShare.getString("story_share_type"),
storyShare.getString("reel_type"),
storyShare.optString("reel_name"),
storyShare.optString("reel_id"),
getDirectMediaModel(storyShare.optJSONObject("media")));
}
break;
case TEXT:
if (!itemObject.has("text"))