Browse Source
support dm message type "clip" (which is glorified "media_share" for reels)
legacy
Austin Huang
4 years ago
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
5 changed files with
14 additions and
3 deletions
-
app/src/main/java/awais/instagrabber/adapters/DirectMessageItemsAdapter.java
-
app/src/main/java/awais/instagrabber/adapters/viewholder/DirectMessageInboxItemViewHolder.java
-
app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java
-
app/src/main/java/awais/instagrabber/models/enums/DirectItemType.java
-
app/src/main/java/awais/instagrabber/utils/Utils.java
|
|
@ -106,7 +106,8 @@ public final class DirectMessageItemsAdapter extends ListAdapter<DirectItemModel |
|
|
|
final LayoutDmRavenMediaBinding binding = LayoutDmRavenMediaBinding.inflate(layoutInflater, itemViewParent, false); |
|
|
|
return new DirectMessageReelShareViewHolder(baseBinding, binding, onClickListener, mentionClickListener); |
|
|
|
} |
|
|
|
case MEDIA_SHARE: { |
|
|
|
case MEDIA_SHARE: |
|
|
|
case CLIP: { |
|
|
|
final LayoutDmMediaShareBinding binding = LayoutDmMediaShareBinding.inflate(layoutInflater, itemViewParent, false); |
|
|
|
return new DirectMessageMediaShareViewHolder(baseBinding, binding, onClickListener); |
|
|
|
} |
|
|
|
|
|
@ -74,6 +74,7 @@ public final class DirectMessageInboxItemViewHolder extends RecyclerView.ViewHol |
|
|
|
case MEDIA: |
|
|
|
case MEDIA_SHARE: |
|
|
|
case RAVEN_MEDIA: |
|
|
|
case CLIP: |
|
|
|
messageText = context.getString(R.string.direct_messages_sent_media); |
|
|
|
break; |
|
|
|
case ACTION_LOG: |
|
|
|
|
|
@ -205,6 +205,7 @@ public class DirectMessageThreadFragment extends Fragment { |
|
|
|
final DirectItemType itemType = directItemModel.getItemType(); |
|
|
|
switch (itemType) { |
|
|
|
case MEDIA_SHARE: |
|
|
|
case CLIP: |
|
|
|
startActivity(new Intent(requireContext(), PostViewer.class) |
|
|
|
.putExtra(Constants.EXTRAS_POST, new PostModel(directItemModel.getMediaModel().getCode(), false))); |
|
|
|
break; |
|
|
@ -281,6 +282,7 @@ public class DirectMessageThreadFragment extends Fragment { |
|
|
|
|
|
|
|
switch (itemType) { |
|
|
|
case MEDIA_SHARE: |
|
|
|
case CLIP: |
|
|
|
firstOption = R.string.view_post; |
|
|
|
break; |
|
|
|
case LINK: |
|
|
|
|
|
@ -18,7 +18,8 @@ public enum DirectItemType implements Serializable { |
|
|
|
REEL_SHARE(11), |
|
|
|
ACTION_LOG(12), |
|
|
|
PLACEHOLDER(13), |
|
|
|
STORY_SHARE(14); |
|
|
|
STORY_SHARE(14), |
|
|
|
CLIP(15); // clip is just media_share but reel |
|
|
|
|
|
|
|
private final int id; |
|
|
|
private static Map<Integer, DirectItemType> map = new HashMap<>(); |
|
|
|
|
|
@ -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; |
|
|
|