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

support dm message type "clip" (which is glorified "media_share" for reels)

This commit is contained in:
Austin Huang 2020-08-29 21:34:14 -04:00
parent c3d92b8fc0
commit 40cb975384
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
5 changed files with 14 additions and 3 deletions

View File

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

View File

@ -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:

View File

@ -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:

View File

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

View File

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