1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-22 14:47:29 +00:00

Convert to kotlin

This commit is contained in:
Ammar Githam 2021-05-25 01:22:59 +09:00
parent 54a03e0d2b
commit eab6fea0ab
23 changed files with 158 additions and 951 deletions

View File

@ -22,6 +22,7 @@ import awais.instagrabber.repositories.responses.User;
import awais.instagrabber.repositories.responses.directmessages.DirectItem; import awais.instagrabber.repositories.responses.directmessages.DirectItem;
import awais.instagrabber.repositories.responses.directmessages.DirectItemActionLog; import awais.instagrabber.repositories.responses.directmessages.DirectItemActionLog;
import awais.instagrabber.repositories.responses.directmessages.DirectThread; import awais.instagrabber.repositories.responses.directmessages.DirectThread;
import awais.instagrabber.repositories.responses.directmessages.TextRange;
import awais.instagrabber.utils.TextUtils; import awais.instagrabber.utils.TextUtils;
public class DirectItemActionLogViewHolder extends DirectItemViewHolder { public class DirectItemActionLogViewHolder extends DirectItemViewHolder {
@ -45,16 +46,16 @@ public class DirectItemActionLogViewHolder extends DirectItemViewHolder {
final DirectItemActionLog actionLog = directItemModel.getActionLog(); final DirectItemActionLog actionLog = directItemModel.getActionLog();
final String text = actionLog.getDescription(); final String text = actionLog.getDescription();
final SpannableStringBuilder sb = new SpannableStringBuilder(text); final SpannableStringBuilder sb = new SpannableStringBuilder(text);
final List<DirectItemActionLog.TextRange> bold = actionLog.getBold(); final List<TextRange> bold = actionLog.getBold();
if (bold != null && !bold.isEmpty()) { if (bold != null && !bold.isEmpty()) {
for (final DirectItemActionLog.TextRange textRange : bold) { for (final TextRange textRange : bold) {
final StyleSpan boldStyleSpan = new StyleSpan(Typeface.BOLD); final StyleSpan boldStyleSpan = new StyleSpan(Typeface.BOLD);
sb.setSpan(boldStyleSpan, textRange.getStart(), textRange.getEnd(), Spannable.SPAN_INCLUSIVE_INCLUSIVE); sb.setSpan(boldStyleSpan, textRange.getStart(), textRange.getEnd(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
} }
} }
final List<DirectItemActionLog.TextRange> textAttributes = actionLog.getTextAttributes(); final List<TextRange> textAttributes = actionLog.getTextAttributes();
if (textAttributes != null && !textAttributes.isEmpty()) { if (textAttributes != null && !textAttributes.isEmpty()) {
for (final DirectItemActionLog.TextRange textAttribute : textAttributes) { for (final TextRange textAttribute : textAttributes) {
if (!TextUtils.isEmpty(textAttribute.getColor())) { if (!TextUtils.isEmpty(textAttribute.getColor())) {
final ForegroundColorSpan colorSpan = new ForegroundColorSpan(itemView.getResources().getColor(R.color.deep_orange_400)); final ForegroundColorSpan colorSpan = new ForegroundColorSpan(itemView.getResources().getColor(R.color.deep_orange_400));
sb.setSpan(colorSpan, textAttribute.getStart(), textAttribute.getEnd(), Spannable.SPAN_INCLUSIVE_INCLUSIVE); sb.setSpan(colorSpan, textAttribute.getStart(), textAttribute.getEnd(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);

View File

@ -17,9 +17,9 @@ import awais.instagrabber.databinding.LayoutDmActionLogBinding;
import awais.instagrabber.databinding.LayoutDmBaseBinding; import awais.instagrabber.databinding.LayoutDmBaseBinding;
import awais.instagrabber.repositories.responses.User; import awais.instagrabber.repositories.responses.User;
import awais.instagrabber.repositories.responses.directmessages.DirectItem; import awais.instagrabber.repositories.responses.directmessages.DirectItem;
import awais.instagrabber.repositories.responses.directmessages.DirectItemActionLog;
import awais.instagrabber.repositories.responses.directmessages.DirectItemVideoCallEvent; import awais.instagrabber.repositories.responses.directmessages.DirectItemVideoCallEvent;
import awais.instagrabber.repositories.responses.directmessages.DirectThread; import awais.instagrabber.repositories.responses.directmessages.DirectThread;
import awais.instagrabber.repositories.responses.directmessages.TextRange;
import awais.instagrabber.utils.TextUtils; import awais.instagrabber.utils.TextUtils;
public class DirectItemVideoCallEventViewHolder extends DirectItemViewHolder { public class DirectItemVideoCallEventViewHolder extends DirectItemViewHolder {
@ -41,9 +41,9 @@ public class DirectItemVideoCallEventViewHolder extends DirectItemViewHolder {
final DirectItemVideoCallEvent videoCallEvent = directItemModel.getVideoCallEvent(); final DirectItemVideoCallEvent videoCallEvent = directItemModel.getVideoCallEvent();
final String text = videoCallEvent.getDescription(); final String text = videoCallEvent.getDescription();
final SpannableStringBuilder sb = new SpannableStringBuilder(text); final SpannableStringBuilder sb = new SpannableStringBuilder(text);
final List<DirectItemActionLog.TextRange> textAttributes = videoCallEvent.getTextAttributes(); final List<TextRange> textAttributes = videoCallEvent.getTextAttributes();
if (textAttributes != null && !textAttributes.isEmpty()) { if (textAttributes != null && !textAttributes.isEmpty()) {
for (final DirectItemActionLog.TextRange textAttribute : textAttributes) { for (final TextRange textAttribute : textAttributes) {
if (!TextUtils.isEmpty(textAttribute.getColor())) { if (!TextUtils.isEmpty(textAttribute.getColor())) {
final ForegroundColorSpan colorSpan = new ForegroundColorSpan(itemView.getResources().getColor(R.color.deep_orange_400)); final ForegroundColorSpan colorSpan = new ForegroundColorSpan(itemView.getResources().getColor(R.color.deep_orange_400));
sb.setSpan(colorSpan, textAttribute.getStart(), textAttribute.getEnd(), Spannable.SPAN_INCLUSIVE_INCLUSIVE); sb.setSpan(colorSpan, textAttribute.getStart(), textAttribute.getEnd(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);

View File

@ -15,6 +15,7 @@ import awais.instagrabber.repositories.responses.User;
import awais.instagrabber.repositories.responses.directmessages.DirectItem; import awais.instagrabber.repositories.responses.directmessages.DirectItem;
import awais.instagrabber.repositories.responses.directmessages.DirectItemXma; import awais.instagrabber.repositories.responses.directmessages.DirectItemXma;
import awais.instagrabber.repositories.responses.directmessages.DirectThread; import awais.instagrabber.repositories.responses.directmessages.DirectThread;
import awais.instagrabber.repositories.responses.directmessages.XmaUrlInfo;
import awais.instagrabber.utils.NullSafePair; import awais.instagrabber.utils.NullSafePair;
import awais.instagrabber.utils.NumberUtils; import awais.instagrabber.utils.NumberUtils;
@ -35,13 +36,13 @@ public class DirectItemXmaViewHolder extends DirectItemViewHolder {
@Override @Override
public void bindItem(final DirectItem item, final MessageDirection messageDirection) { public void bindItem(final DirectItem item, final MessageDirection messageDirection) {
final DirectItemXma xma = item.getXma(); final DirectItemXma xma = item.getXma();
final DirectItemXma.XmaUrlInfo playableUrlInfo = xma.getPlayableUrlInfo(); final XmaUrlInfo playableUrlInfo = xma.getPlayableUrlInfo();
final DirectItemXma.XmaUrlInfo previewUrlInfo = xma.getPreviewUrlInfo(); final XmaUrlInfo previewUrlInfo = xma.getPreviewUrlInfo();
if (playableUrlInfo == null && previewUrlInfo == null) { if (playableUrlInfo == null && previewUrlInfo == null) {
binding.ivAnimatedMessage.setController(null); binding.ivAnimatedMessage.setController(null);
return; return;
} }
final DirectItemXma.XmaUrlInfo urlInfo = playableUrlInfo != null ? playableUrlInfo : previewUrlInfo; final XmaUrlInfo urlInfo = playableUrlInfo != null ? playableUrlInfo : previewUrlInfo;
final String url = urlInfo.getUrl(); final String url = urlInfo.getUrl();
final NullSafePair<Integer, Integer> widthHeight = NumberUtils.calculateWidthHeight( final NullSafePair<Integer, Integer> widthHeight = NumberUtils.calculateWidthHeight(
urlInfo.getHeight(), urlInfo.getHeight(),

View File

@ -49,7 +49,7 @@ import awais.instagrabber.repositories.responses.directmessages.DirectItem;
import awais.instagrabber.repositories.responses.directmessages.DirectItemEmojiReaction; import awais.instagrabber.repositories.responses.directmessages.DirectItemEmojiReaction;
import awais.instagrabber.repositories.responses.directmessages.DirectItemReactions; import awais.instagrabber.repositories.responses.directmessages.DirectItemReactions;
import awais.instagrabber.repositories.responses.directmessages.DirectItemSeenResponse; import awais.instagrabber.repositories.responses.directmessages.DirectItemSeenResponse;
import awais.instagrabber.repositories.responses.directmessages.DirectItemSeenResponse.DirectItemSeenResponsePayload; import awais.instagrabber.repositories.responses.directmessages.DirectItemSeenResponsePayload;
import awais.instagrabber.repositories.responses.directmessages.DirectThread; import awais.instagrabber.repositories.responses.directmessages.DirectThread;
import awais.instagrabber.repositories.responses.directmessages.DirectThreadBroadcastResponse; import awais.instagrabber.repositories.responses.directmessages.DirectThreadBroadcastResponse;
import awais.instagrabber.repositories.responses.directmessages.DirectThreadBroadcastResponseMessageMetadata; import awais.instagrabber.repositories.responses.directmessages.DirectThreadBroadcastResponseMessageMetadata;

View File

@ -1,92 +1,9 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages
import java.io.Serializable; import java.io.Serializable
import java.util.List;
import java.util.Objects;
public class DirectItemActionLog implements Serializable { data class DirectItemActionLog(
private final String description; val description: String? = null,
private final List<TextRange> bold; val bold: List<TextRange>? = null,
private final List<TextRange> textAttributes; val textAttributes: List<TextRange>? = null
) : Serializable
public DirectItemActionLog(final String description,
final List<TextRange> bold,
final List<TextRange> textAttributes) {
this.description = description;
this.bold = bold;
this.textAttributes = textAttributes;
}
public String getDescription() {
return description;
}
public List<TextRange> getBold() {
return bold;
}
public List<TextRange> getTextAttributes() {
return textAttributes;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final DirectItemActionLog that = (DirectItemActionLog) o;
return Objects.equals(description, that.description) &&
Objects.equals(bold, that.bold) &&
Objects.equals(textAttributes, that.textAttributes);
}
@Override
public int hashCode() {
return Objects.hash(description, bold, textAttributes);
}
public static class TextRange implements Serializable {
private final int start;
private final int end;
private final String color;
private final String intent;
public TextRange(final int start, final int end, final String color, final String intent) {
this.start = start;
this.end = end;
this.color = color;
this.intent = intent;
}
public int getStart() {
return start;
}
public int getEnd() {
return end;
}
public String getColor() {
return color;
}
public String getIntent() {
return intent;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final TextRange textRange = (TextRange) o;
return start == textRange.start &&
end == textRange.end &&
Objects.equals(color, textRange.color) &&
Objects.equals(intent, textRange.intent);
}
@Override
public int hashCode() {
return Objects.hash(start, end, color, intent);
}
}
}

View File

@ -1,53 +1,11 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages
import java.io.Serializable; import awais.instagrabber.repositories.responses.AnimatedMediaImages
import java.util.Objects; import java.io.Serializable
import awais.instagrabber.repositories.responses.AnimatedMediaImages; data class DirectItemAnimatedMedia(
val id: String? = null,
public final class DirectItemAnimatedMedia implements Serializable { val images: AnimatedMediaImages? = null,
private final String id; val isRandom: Boolean = false,
private final AnimatedMediaImages images; val isSticker: Boolean = false,
private final boolean isRandom; ) : Serializable
private final boolean isSticker;
public DirectItemAnimatedMedia(final String id, final AnimatedMediaImages images, final boolean isRandom, final boolean isSticker) {
this.id = id;
this.images = images;
this.isRandom = isRandom;
this.isSticker = isSticker;
}
public String getId() {
return id;
}
public AnimatedMediaImages getImages() {
return images;
}
public boolean isRandom() {
return isRandom;
}
public boolean isSticker() {
return isSticker;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final DirectItemAnimatedMedia that = (DirectItemAnimatedMedia) o;
return isRandom == that.isRandom &&
isSticker == that.isSticker &&
Objects.equals(id, that.id) &&
Objects.equals(images, that.images);
}
@Override
public int hashCode() {
return Objects.hash(id, images, isRandom, isSticker);
}
}

View File

@ -1,60 +1,10 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages
import java.io.Serializable; import java.io.Serializable
import java.util.Objects;
public class DirectItemEmojiReaction implements Serializable { data class DirectItemEmojiReaction(
private final long senderId; val senderId: Long = 0,
private final long timestamp; val timestamp: Long = 0,
private final String emoji; val emoji: String? = null,
private final String superReactType; val superReactType: String? = null
) : Serializable
public DirectItemEmojiReaction(final long senderId, final long timestamp, final String emoji, final String superReactType) {
this.senderId = senderId;
this.timestamp = timestamp;
this.emoji = emoji;
this.superReactType = superReactType;
}
public long getSenderId() {
return senderId;
}
public long getTimestamp() {
return timestamp;
}
public String getEmoji() {
return emoji;
}
public String getSuperReactType() {
return superReactType;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final DirectItemEmojiReaction that = (DirectItemEmojiReaction) o;
return senderId == that.senderId &&
timestamp == that.timestamp &&
Objects.equals(emoji, that.emoji) &&
Objects.equals(superReactType, that.superReactType);
}
@Override
public int hashCode() {
return Objects.hash(senderId, timestamp, emoji, superReactType);
}
@Override
public String toString() {
return "DirectItemEmojiReaction{" +
"senderId=" + senderId +
", timestamp=" + timestamp +
", emoji='" + emoji + '\'' +
", superReactType='" + superReactType + '\'' +
'}';
}
}

View File

@ -1,53 +1,10 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages
import java.io.Serializable; import java.io.Serializable
import java.util.Objects;
public class DirectItemLink implements Serializable { data class DirectItemLink(
private final String text; val text: String? = null,
private final DirectItemLinkContext linkContext; val linkContext: DirectItemLinkContext? = null,
private final String clientContext; val clientContext: String? = null,
private final String mutationToken; val mutationToken: String? = null,
) : Serializable
public DirectItemLink(final String text,
final DirectItemLinkContext linkContext,
final String clientContext,
final String mutationToken) {
this.text = text;
this.linkContext = linkContext;
this.clientContext = clientContext;
this.mutationToken = mutationToken;
}
public String getText() {
return text;
}
public DirectItemLinkContext getLinkContext() {
return linkContext;
}
public String getClientContext() {
return clientContext;
}
public String getMutationToken() {
return mutationToken;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final DirectItemLink that = (DirectItemLink) o;
return Objects.equals(text, that.text) &&
Objects.equals(linkContext, that.linkContext) &&
Objects.equals(clientContext, that.clientContext) &&
Objects.equals(mutationToken, that.mutationToken);
}
@Override
public int hashCode() {
return Objects.hash(text, linkContext, clientContext, mutationToken);
}
}

View File

@ -1,53 +1,10 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages
import java.io.Serializable; import java.io.Serializable
import java.util.Objects;
public class DirectItemLinkContext implements Serializable { data class DirectItemLinkContext(
private final String linkUrl; val linkUrl: String? = null,
private final String linkTitle; val linkTitle: String? = null,
private final String linkSummary; val linkSummary: String? = null,
private final String linkImageUrl; val linkImageUrl: String? = null
) : Serializable
public DirectItemLinkContext(final String linkUrl,
final String linkTitle,
final String linkSummary,
final String linkImageUrl) {
this.linkUrl = linkUrl;
this.linkTitle = linkTitle;
this.linkSummary = linkSummary;
this.linkImageUrl = linkImageUrl;
}
public String getLinkUrl() {
return linkUrl;
}
public String getLinkTitle() {
return linkTitle;
}
public String getLinkSummary() {
return linkSummary;
}
public String getLinkImageUrl() {
return linkImageUrl;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final DirectItemLinkContext that = (DirectItemLinkContext) o;
return Objects.equals(linkUrl, that.linkUrl) &&
Objects.equals(linkTitle, that.linkTitle) &&
Objects.equals(linkSummary, that.linkSummary) &&
Objects.equals(linkImageUrl, that.linkImageUrl);
}
@Override
public int hashCode() {
return Objects.hash(linkUrl, linkTitle, linkSummary, linkImageUrl);
}
}

View File

@ -1,45 +1,9 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages
import java.io.Serializable; import java.io.Serializable
import java.util.Objects;
public class DirectItemPlaceholder implements Serializable { data class DirectItemPlaceholder(
private final boolean isLinked; val isLinked: Boolean = false,
private final String title; val title: String? = null,
private final String message; val message: String? = null,
) : Serializable
public DirectItemPlaceholder(final boolean isLinked,
final String title,
final String message) {
this.isLinked = isLinked;
this.title = title;
this.message = message;
}
public boolean isLinked() {
return isLinked;
}
public String getTitle() {
return title;
}
public String getMessage() {
return message;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final DirectItemPlaceholder that = (DirectItemPlaceholder) o;
return isLinked == that.isLinked &&
Objects.equals(title, that.title) &&
Objects.equals(message, that.message);
}
@Override
public int hashCode() {
return Objects.hash(isLinked, title, message);
}
}

View File

@ -1,62 +1,13 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages
import androidx.annotation.NonNull; import java.io.Serializable
import java.io.Serializable; data class DirectItemReactions(
import java.util.List; var emojis: List<DirectItemEmojiReaction>? = null,
import java.util.Objects; var likes: List<DirectItemEmojiReaction>? = null,
) : Cloneable, Serializable {
public class DirectItemReactions implements Cloneable, Serializable { @Throws(CloneNotSupportedException::class)
private List<DirectItemEmojiReaction> emojis; public override fun clone(): Any {
private List<DirectItemEmojiReaction> likes; return super.clone()
public DirectItemReactions(final List<DirectItemEmojiReaction> emojis,
final List<DirectItemEmojiReaction> likes) {
this.emojis = emojis;
this.likes = likes;
}
public List<DirectItemEmojiReaction> getEmojis() {
return emojis;
}
public List<DirectItemEmojiReaction> getLikes() {
return likes;
}
public void setLikes(final List<DirectItemEmojiReaction> likes) {
this.likes = likes;
}
public void setEmojis(final List<DirectItemEmojiReaction> emojis) {
this.emojis = emojis;
}
@NonNull
@Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final DirectItemReactions that = (DirectItemReactions) o;
return Objects.equals(emojis, that.emojis) &&
Objects.equals(likes, that.likes);
}
@Override
public int hashCode() {
return Objects.hash(emojis, likes);
}
@Override
public String toString() {
return "DirectItemReactions{" +
"emojis=" + emojis +
", likes=" + likes +
'}';
} }
} }

View File

@ -1,95 +1,7 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages
import androidx.annotation.NonNull; data class DirectItemSeenResponse(
val action: String? = null,
import java.util.Objects; val payload: DirectItemSeenResponsePayload? = null,
val status: String? = null,
public class DirectItemSeenResponse { )
private final String action;
private final DirectItemSeenResponsePayload payload;
private final String status;
public DirectItemSeenResponse(final String action, final DirectItemSeenResponsePayload payload, final String status) {
this.action = action;
this.payload = payload;
this.status = status;
}
public String getAction() {
return action;
}
public DirectItemSeenResponsePayload getPayload() {
return payload;
}
public String getStatus() {
return status;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final DirectItemSeenResponse that = (DirectItemSeenResponse) o;
return Objects.equals(action, that.action) &&
Objects.equals(payload, that.payload) &&
Objects.equals(status, that.status);
}
@Override
public int hashCode() {
return Objects.hash(action, payload, status);
}
@NonNull
@Override
public String toString() {
return "DirectItemSeenResponse{" +
"action='" + action + '\'' +
", payload=" + payload +
", status='" + status + '\'' +
'}';
}
public static class DirectItemSeenResponsePayload {
private final int count;
private final String timestamp;
public DirectItemSeenResponsePayload(final int count, final String timestamp) {
this.count = count;
this.timestamp = timestamp;
}
public int getCount() {
return count;
}
public String getTimestamp() {
return timestamp;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final DirectItemSeenResponsePayload that = (DirectItemSeenResponsePayload) o;
return count == that.count &&
Objects.equals(timestamp, that.timestamp);
}
@Override
public int hashCode() {
return Objects.hash(count, timestamp);
}
@NonNull
@Override
public String toString() {
return "DirectItemSeenResponsePayload{" +
"count=" + count +
", timestamp='" + timestamp + '\'' +
'}';
}
}
}

View File

@ -0,0 +1,3 @@
package awais.instagrabber.repositories.responses.directmessages
data class DirectItemSeenResponsePayload(val count: Int = 0, val timestamp: String? = null)

View File

@ -1,62 +1,11 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages
import java.io.Serializable; import java.io.Serializable
import java.util.List;
import java.util.Objects;
public final class DirectItemVideoCallEvent implements Serializable { data class DirectItemVideoCallEvent(
private final String action; val action: String? = null,
private final String encodedServerDataInfo; val encodedServerDataInfo: String? = null,
private final String description; val description: String? = null,
private final boolean threadHasAudioOnlyCall; val threadHasAudioOnlyCall: Boolean = false,
private final List<DirectItemActionLog.TextRange> textAttributes; val textAttributes: List<TextRange>? = null,
) : Serializable
public DirectItemVideoCallEvent(final String action,
final String encodedServerDataInfo,
final String description,
final boolean threadHasAudioOnlyCall,
final List<DirectItemActionLog.TextRange> textAttributes) {
this.action = action;
this.encodedServerDataInfo = encodedServerDataInfo;
this.description = description;
this.threadHasAudioOnlyCall = threadHasAudioOnlyCall;
this.textAttributes = textAttributes;
}
public String getAction() {
return action;
}
public String getEncodedServerDataInfo() {
return encodedServerDataInfo;
}
public String getDescription() {
return description;
}
public boolean isThreadHasAudioOnlyCall() {
return threadHasAudioOnlyCall;
}
public List<DirectItemActionLog.TextRange> getTextAttributes() {
return textAttributes;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final DirectItemVideoCallEvent that = (DirectItemVideoCallEvent) o;
return threadHasAudioOnlyCall == that.threadHasAudioOnlyCall &&
Objects.equals(action, that.action) &&
Objects.equals(encodedServerDataInfo, that.encodedServerDataInfo) &&
Objects.equals(description, that.description) &&
Objects.equals(textAttributes, that.textAttributes);
}
@Override
public int hashCode() {
return Objects.hash(action, encodedServerDataInfo, description, threadHasAudioOnlyCall, textAttributes);
}
}

View File

@ -1,45 +1,10 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages
import java.io.Serializable; import awais.instagrabber.repositories.responses.Media
import java.util.Objects; import java.io.Serializable
import awais.instagrabber.repositories.responses.Media; data class DirectItemVoiceMedia(
val media: Media? = null,
public class DirectItemVoiceMedia implements Serializable { val seenCount: Int = 0,
private final Media media; val viewMode: String? = null,
private final int seenCount; ) : Serializable
private final String viewMode;
public DirectItemVoiceMedia(final Media media, final int seenCount, final String viewMode) {
this.media = media;
this.seenCount = seenCount;
this.viewMode = viewMode;
}
public Media getMedia() {
return media;
}
public int getSeenCount() {
return seenCount;
}
public String getViewMode() {
return viewMode;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final DirectItemVoiceMedia that = (DirectItemVoiceMedia) o;
return seenCount == that.seenCount &&
Objects.equals(media, that.media) &&
Objects.equals(viewMode, that.viewMode);
}
@Override
public int hashCode() {
return Objects.hash(media, seenCount, viewMode);
}
}

View File

@ -1,104 +1,15 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages
import androidx.annotation.NonNull; import java.io.Serializable
import java.io.Serializable; data class DirectItemXma(
import java.util.Objects; val previewUrlInfo: XmaUrlInfo? = null,
val playableUrlInfo: XmaUrlInfo? = null,
) : Serializable
public class DirectItemXma { data class XmaUrlInfo(
private final XmaUrlInfo previewUrlInfo; val url: String? = null,
private final XmaUrlInfo playableUrlInfo; val urlExpirationTimestampUs: Long = 0,
val width: Int = 0,
public DirectItemXma(final XmaUrlInfo previewUrlInfo, final XmaUrlInfo playableUrlInfo) { val height: Int = 0,
this.previewUrlInfo = previewUrlInfo; ) : Serializable
this.playableUrlInfo = playableUrlInfo;
}
public XmaUrlInfo getPreviewUrlInfo() {
return previewUrlInfo;
}
public XmaUrlInfo getPlayableUrlInfo() {
return playableUrlInfo;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final DirectItemXma that = (DirectItemXma) o;
return Objects.equals(previewUrlInfo, that.previewUrlInfo) &&
Objects.equals(playableUrlInfo, that.playableUrlInfo);
}
@Override
public int hashCode() {
return Objects.hash(previewUrlInfo, playableUrlInfo);
}
@NonNull
@Override
public String toString() {
return "DirectItemXma{" +
"previewUrlInfo=" + previewUrlInfo +
", playableUrlInfo=" + playableUrlInfo +
'}';
}
public static class XmaUrlInfo implements Serializable {
private final String url;
private final long urlExpirationTimestampUs;
private final int width;
private final int height;
public XmaUrlInfo(final String url, final long urlExpirationTimestampUs, final int width, final int height) {
this.url = url;
this.urlExpirationTimestampUs = urlExpirationTimestampUs;
this.width = width;
this.height = height;
}
public String getUrl() {
return url;
}
public long getUrlExpirationTimestampUs() {
return urlExpirationTimestampUs;
}
public int getWidth() {
return width;
}
public int getHeight() {
return height;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final XmaUrlInfo that = (XmaUrlInfo) o;
return urlExpirationTimestampUs == that.urlExpirationTimestampUs &&
width == that.width &&
height == that.height &&
Objects.equals(url, that.url);
}
@Override
public int hashCode() {
return Objects.hash(url, urlExpirationTimestampUs, width, height);
}
@NonNull
@Override
public String toString() {
return "XmaUrlInfo{" +
"url='" + url + '\'' +
", urlExpirationTimestampUs=" + urlExpirationTimestampUs +
", width=" + width +
", height=" + height +
'}';
}
}
}

View File

@ -1,57 +1,9 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages
import androidx.annotation.NonNull; data class DirectThreadBroadcastResponse(
val action: String? = null,
import java.util.List; val statusCode: String? = null,
val payload: DirectThreadBroadcastResponsePayload? = null,
public class DirectThreadBroadcastResponse { val messageMetadata: List<DirectThreadBroadcastResponseMessageMetadata>? = null,
private final String action; val status: String? = null
private final String statusCode; )
private final DirectThreadBroadcastResponsePayload payload;
private final List<DirectThreadBroadcastResponseMessageMetadata> messageMetadata;
private final String status;
public DirectThreadBroadcastResponse(final String action,
final String statusCode,
final DirectThreadBroadcastResponsePayload payload,
final List<DirectThreadBroadcastResponseMessageMetadata> messageMetadata,
final String status) {
this.action = action;
this.statusCode = statusCode;
this.payload = payload;
this.messageMetadata = messageMetadata;
this.status = status;
}
public String getAction() {
return action;
}
public String getStatusCode() {
return statusCode;
}
public DirectThreadBroadcastResponsePayload getPayload() {
return payload;
}
public List<DirectThreadBroadcastResponseMessageMetadata> getMessageMetadata() {
return messageMetadata;
}
public String getStatus() {
return status;
}
@NonNull
@Override
public String toString() {
return "DirectThreadBroadcastResponse{" +
"action='" + action + '\'' +
", statusCode='" + statusCode + '\'' +
", payload=" + payload +
", messageMetadata=" + messageMetadata +
", status='" + status + '\'' +
'}';
}
}

View File

@ -1,55 +1,9 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages
import java.util.List; data class DirectThreadBroadcastResponseMessageMetadata(
val clientContext: String? = null,
public class DirectThreadBroadcastResponseMessageMetadata { val itemId: String? = null,
private final String clientContext; val timestamp: Long = 0,
private final String itemId; val threadId: String? = null,
private final long timestamp; val participantIds: List<String>? = null,
private final String threadId; )
private final List<String> participantIds;
public DirectThreadBroadcastResponseMessageMetadata(final String clientContext,
final String itemId,
final long timestamp,
final String threadId,
final List<String> participantIds) {
this.clientContext = clientContext;
this.itemId = itemId;
this.timestamp = timestamp;
this.threadId = threadId;
this.participantIds = participantIds;
}
public String getClientContext() {
return clientContext;
}
public String getItemId() {
return itemId;
}
public long getTimestamp() {
return timestamp;
}
public String getThreadId() {
return threadId;
}
public List<String> getParticipantIds() {
return participantIds;
}
@Override
public String toString() {
return "DirectThreadBroadcastResponseMessageMetadata{" +
"clientContext='" + clientContext + '\'' +
", itemId='" + itemId + '\'' +
", timestamp=" + timestamp +
", threadId='" + threadId + '\'' +
", participantIds=" + participantIds +
'}';
}
}

View File

@ -1,44 +1,8 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages
public class DirectThreadBroadcastResponsePayload { data class DirectThreadBroadcastResponsePayload(
private final String clientContext; val clientContext: String? = null,
private final String itemId; val itemId: String? = null,
private final long timestamp; val timestamp: Long = 0,
private final String threadId; val threadId: String? = null,
)
public DirectThreadBroadcastResponsePayload(final String clientContext,
final String itemId,
final long timestamp,
final String threadId) {
this.clientContext = clientContext;
this.itemId = itemId;
this.timestamp = timestamp;
this.threadId = threadId;
}
public String getClientContext() {
return clientContext;
}
public String getItemId() {
return itemId;
}
public long getTimestamp() {
return timestamp;
}
public String getThreadId() {
return threadId;
}
@Override
public String toString() {
return "DirectThreadBroadcastResponsePayload{" +
"clientContext='" + clientContext + '\'' +
", itemId='" + itemId + '\'' +
", timestamp=" + timestamp +
", threadId='" + threadId + '\'' +
'}';
}
}

View File

@ -1,19 +1,6 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages
public class DirectThreadFeedResponse { data class DirectThreadFeedResponse(
private final DirectThread thread; val thread: DirectThread? = null,
private final String status; val status: String? = null,
)
public DirectThreadFeedResponse(final DirectThread thread, final String status) {
this.thread = thread;
this.status = status;
}
public DirectThread getThread() {
return thread;
}
public String getStatus() {
return status;
}
}

View File

@ -1,36 +1,8 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages
import java.io.Serializable; import java.io.Serializable
import java.util.Objects;
public class DirectThreadLastSeenAt implements Serializable { data class DirectThreadLastSeenAt(
private final String timestamp; val timestamp: String? = null,
private final String itemId; val itemId: String? = null,
) : Serializable
public DirectThreadLastSeenAt(final String timestamp, final String itemId) {
this.timestamp = timestamp;
this.itemId = itemId;
}
public String getTimestamp() {
return timestamp;
}
public String getItemId() {
return itemId;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final DirectThreadLastSeenAt that = (DirectThreadLastSeenAt) o;
return Objects.equals(timestamp, that.timestamp) &&
Objects.equals(itemId, that.itemId);
}
@Override
public int hashCode() {
return Objects.hash(timestamp, itemId);
}
}

View File

@ -0,0 +1,10 @@
package awais.instagrabber.repositories.responses.directmessages
import java.io.Serializable
data class TextRange(
val start: Int = 0,
val end: Int = 0,
val color: String? = null,
val intent: String? = null,
) : Serializable

View File

@ -1,36 +1,8 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages
import java.io.Serializable; import java.io.Serializable
import java.util.Objects;
public class ThreadContext implements Serializable { data class ThreadContext(
private final int type; val type: Int = 0,
private final String text; val text: String? = null,
) : Serializable
public ThreadContext(final int type, final String text) {
this.type = type;
this.text = text;
}
public int getType() {
return type;
}
public String getText() {
return text;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final ThreadContext that = (ThreadContext) o;
return type == that.type &&
Objects.equals(text, that.text);
}
@Override
public int hashCode() {
return Objects.hash(type, text);
}
}