Browse Source

Type story_share is now covered

legacy
Austin Huang 4 years ago
parent
commit
9d49b937e4
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 24
      app/src/main/java/awais/instagrabber/adapters/MessageItemsAdapter.java
  2. 1
      app/src/main/java/awais/instagrabber/models/enums/DirectItemType.java
  3. 21
      app/src/main/java/awais/instagrabber/utils/Utils.java

24
app/src/main/java/awais/instagrabber/adapters/MessageItemsAdapter.java

@ -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();

1
app/src/main/java/awais/instagrabber/models/enums/DirectItemType.java

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

21
app/src/main/java/awais/instagrabber/utils/Utils.java

@ -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"))

Loading…
Cancel
Save