From 40cb975384d86c2ebebc4386b44e9391b520c659 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Sat, 29 Aug 2020 21:34:14 -0400 Subject: [PATCH] support dm message type "clip" (which is glorified "media_share" for reels) --- .../instagrabber/adapters/DirectMessageItemsAdapter.java | 3 ++- .../viewholder/DirectMessageInboxItemViewHolder.java | 1 + .../directmessages/DirectMessageThreadFragment.java | 2 ++ .../awais/instagrabber/models/enums/DirectItemType.java | 3 ++- app/src/main/java/awais/instagrabber/utils/Utils.java | 8 +++++++- 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/adapters/DirectMessageItemsAdapter.java b/app/src/main/java/awais/instagrabber/adapters/DirectMessageItemsAdapter.java index 8070aaf9..547f3cce 100644 --- a/app/src/main/java/awais/instagrabber/adapters/DirectMessageItemsAdapter.java +++ b/app/src/main/java/awais/instagrabber/adapters/DirectMessageItemsAdapter.java @@ -106,7 +106,8 @@ public final class DirectMessageItemsAdapter extends ListAdapter map = new HashMap<>(); diff --git a/app/src/main/java/awais/instagrabber/utils/Utils.java b/app/src/main/java/awais/instagrabber/utils/Utils.java index ef5f8222..d1d8492d 100755 --- a/app/src/main/java/awais/instagrabber/utils/Utils.java +++ b/app/src/main/java/awais/instagrabber/utils/Utils.java @@ -426,7 +426,7 @@ public final class Utils { if (userObj != null) { user = new ProfileModel( userObj.getBoolean("is_private"), - false, // temporary + false, userObj.optBoolean("is_verified"), String.valueOf(userObj.get("pk")), userObj.getString("username"), @@ -467,6 +467,7 @@ public final class Utils { 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 ("clip".equals(itemType)) return DirectItemType.CLIP; return DirectItemType.TEXT; } @@ -705,6 +706,11 @@ public final class Utils { directMedia = getDirectMediaModel(itemObject.getJSONObject("media_share")); break; + case CLIP: + Log.d("austin_debug", "clip: "+itemObject.getJSONObject("clip").getJSONObject("clip")); + directMedia = getDirectMediaModel(itemObject.getJSONObject("clip").getJSONObject("clip")); + break; + case MEDIA: directMedia = getDirectMediaModel(itemObject.optJSONObject("media")); break;