1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-22 06:37:30 +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.DirectItemActionLog;
import awais.instagrabber.repositories.responses.directmessages.DirectThread;
import awais.instagrabber.repositories.responses.directmessages.TextRange;
import awais.instagrabber.utils.TextUtils;
public class DirectItemActionLogViewHolder extends DirectItemViewHolder {
@ -45,16 +46,16 @@ public class DirectItemActionLogViewHolder extends DirectItemViewHolder {
final DirectItemActionLog actionLog = directItemModel.getActionLog();
final String text = actionLog.getDescription();
final SpannableStringBuilder sb = new SpannableStringBuilder(text);
final List<DirectItemActionLog.TextRange> bold = actionLog.getBold();
final List<TextRange> bold = actionLog.getBold();
if (bold != null && !bold.isEmpty()) {
for (final DirectItemActionLog.TextRange textRange : bold) {
for (final TextRange textRange : bold) {
final StyleSpan boldStyleSpan = new StyleSpan(Typeface.BOLD);
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()) {
for (final DirectItemActionLog.TextRange textAttribute : textAttributes) {
for (final TextRange textAttribute : textAttributes) {
if (!TextUtils.isEmpty(textAttribute.getColor())) {
final ForegroundColorSpan colorSpan = new ForegroundColorSpan(itemView.getResources().getColor(R.color.deep_orange_400));
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.repositories.responses.User;
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.DirectThread;
import awais.instagrabber.repositories.responses.directmessages.TextRange;
import awais.instagrabber.utils.TextUtils;
public class DirectItemVideoCallEventViewHolder extends DirectItemViewHolder {
@ -41,9 +41,9 @@ public class DirectItemVideoCallEventViewHolder extends DirectItemViewHolder {
final DirectItemVideoCallEvent videoCallEvent = directItemModel.getVideoCallEvent();
final String text = videoCallEvent.getDescription();
final SpannableStringBuilder sb = new SpannableStringBuilder(text);
final List<DirectItemActionLog.TextRange> textAttributes = videoCallEvent.getTextAttributes();
final List<TextRange> textAttributes = videoCallEvent.getTextAttributes();
if (textAttributes != null && !textAttributes.isEmpty()) {
for (final DirectItemActionLog.TextRange textAttribute : textAttributes) {
for (final TextRange textAttribute : textAttributes) {
if (!TextUtils.isEmpty(textAttribute.getColor())) {
final ForegroundColorSpan colorSpan = new ForegroundColorSpan(itemView.getResources().getColor(R.color.deep_orange_400));
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.DirectItemXma;
import awais.instagrabber.repositories.responses.directmessages.DirectThread;
import awais.instagrabber.repositories.responses.directmessages.XmaUrlInfo;
import awais.instagrabber.utils.NullSafePair;
import awais.instagrabber.utils.NumberUtils;
@ -35,13 +36,13 @@ public class DirectItemXmaViewHolder extends DirectItemViewHolder {
@Override
public void bindItem(final DirectItem item, final MessageDirection messageDirection) {
final DirectItemXma xma = item.getXma();
final DirectItemXma.XmaUrlInfo playableUrlInfo = xma.getPlayableUrlInfo();
final DirectItemXma.XmaUrlInfo previewUrlInfo = xma.getPreviewUrlInfo();
final XmaUrlInfo playableUrlInfo = xma.getPlayableUrlInfo();
final XmaUrlInfo previewUrlInfo = xma.getPreviewUrlInfo();
if (playableUrlInfo == null && previewUrlInfo == null) {
binding.ivAnimatedMessage.setController(null);
return;
}
final DirectItemXma.XmaUrlInfo urlInfo = playableUrlInfo != null ? playableUrlInfo : previewUrlInfo;
final XmaUrlInfo urlInfo = playableUrlInfo != null ? playableUrlInfo : previewUrlInfo;
final String url = urlInfo.getUrl();
final NullSafePair<Integer, Integer> widthHeight = NumberUtils.calculateWidthHeight(
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.DirectItemReactions;
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.DirectThreadBroadcastResponse;
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.util.List;
import java.util.Objects;
import java.io.Serializable
public class DirectItemActionLog implements Serializable {
private final String description;
private final List<TextRange> bold;
private final List<TextRange> textAttributes;
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);
}
}
}
data class DirectItemActionLog(
val description: String? = null,
val bold: List<TextRange>? = null,
val textAttributes: List<TextRange>? = null
) : Serializable

View File

@ -1,53 +1,11 @@
package awais.instagrabber.repositories.responses.directmessages;
package awais.instagrabber.repositories.responses.directmessages
import java.io.Serializable;
import java.util.Objects;
import awais.instagrabber.repositories.responses.AnimatedMediaImages
import java.io.Serializable
import awais.instagrabber.repositories.responses.AnimatedMediaImages;
public final class DirectItemAnimatedMedia implements Serializable {
private final String id;
private final AnimatedMediaImages images;
private final boolean isRandom;
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);
}
}
data class DirectItemAnimatedMedia(
val id: String? = null,
val images: AnimatedMediaImages? = null,
val isRandom: Boolean = false,
val isSticker: Boolean = false,
) : Serializable

View File

@ -1,60 +1,10 @@
package awais.instagrabber.repositories.responses.directmessages;
package awais.instagrabber.repositories.responses.directmessages
import java.io.Serializable;
import java.util.Objects;
import java.io.Serializable
public class DirectItemEmojiReaction implements Serializable {
private final long senderId;
private final long timestamp;
private final String emoji;
private final String superReactType;
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 + '\'' +
'}';
}
}
data class DirectItemEmojiReaction(
val senderId: Long = 0,
val timestamp: Long = 0,
val emoji: String? = null,
val superReactType: String? = null
) : Serializable

View File

@ -1,53 +1,10 @@
package awais.instagrabber.repositories.responses.directmessages;
package awais.instagrabber.repositories.responses.directmessages
import java.io.Serializable;
import java.util.Objects;
import java.io.Serializable
public class DirectItemLink implements Serializable {
private final String text;
private final DirectItemLinkContext linkContext;
private final String clientContext;
private final String mutationToken;
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);
}
}
data class DirectItemLink(
val text: String? = null,
val linkContext: DirectItemLinkContext? = null,
val clientContext: String? = null,
val mutationToken: String? = null,
) : Serializable

View File

@ -1,53 +1,10 @@
package awais.instagrabber.repositories.responses.directmessages;
package awais.instagrabber.repositories.responses.directmessages
import java.io.Serializable;
import java.util.Objects;
import java.io.Serializable
public class DirectItemLinkContext implements Serializable {
private final String linkUrl;
private final String linkTitle;
private final String linkSummary;
private final String linkImageUrl;
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);
}
}
data class DirectItemLinkContext(
val linkUrl: String? = null,
val linkTitle: String? = null,
val linkSummary: String? = null,
val linkImageUrl: String? = null
) : Serializable

View File

@ -1,45 +1,9 @@
package awais.instagrabber.repositories.responses.directmessages;
package awais.instagrabber.repositories.responses.directmessages
import java.io.Serializable;
import java.util.Objects;
import java.io.Serializable
public class DirectItemPlaceholder implements Serializable {
private final boolean isLinked;
private final String title;
private final String message;
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);
}
}
data class DirectItemPlaceholder(
val isLinked: Boolean = false,
val title: String? = null,
val message: String? = null,
) : Serializable

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;
import java.util.List;
import java.util.Objects;
public class DirectItemReactions implements Cloneable, Serializable {
private List<DirectItemEmojiReaction> emojis;
private List<DirectItemEmojiReaction> likes;
public DirectItemReactions(final List<DirectItemEmojiReaction> emojis,
final List<DirectItemEmojiReaction> likes) {
this.emojis = emojis;
this.likes = likes;
data class DirectItemReactions(
var emojis: List<DirectItemEmojiReaction>? = null,
var likes: List<DirectItemEmojiReaction>? = null,
) : Cloneable, Serializable {
@Throws(CloneNotSupportedException::class)
public override fun clone(): Any {
return super.clone()
}
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;
import java.util.Objects;
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 + '\'' +
'}';
}
}
}
data class DirectItemSeenResponse(
val action: String? = null,
val payload: DirectItemSeenResponsePayload? = null,
val status: String? = null,
)

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.util.List;
import java.util.Objects;
import java.io.Serializable
public final class DirectItemVideoCallEvent implements Serializable {
private final String action;
private final String encodedServerDataInfo;
private final String description;
private final boolean threadHasAudioOnlyCall;
private final List<DirectItemActionLog.TextRange> textAttributes;
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);
}
}
data class DirectItemVideoCallEvent(
val action: String? = null,
val encodedServerDataInfo: String? = null,
val description: String? = null,
val threadHasAudioOnlyCall: Boolean = false,
val textAttributes: List<TextRange>? = null,
) : Serializable

View File

@ -1,45 +1,10 @@
package awais.instagrabber.repositories.responses.directmessages;
package awais.instagrabber.repositories.responses.directmessages
import java.io.Serializable;
import java.util.Objects;
import awais.instagrabber.repositories.responses.Media
import java.io.Serializable
import awais.instagrabber.repositories.responses.Media;
public class DirectItemVoiceMedia implements Serializable {
private final Media media;
private final int seenCount;
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);
}
}
data class DirectItemVoiceMedia(
val media: Media? = null,
val seenCount: Int = 0,
val viewMode: String? = null,
) : Serializable

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;
import java.util.Objects;
data class DirectItemXma(
val previewUrlInfo: XmaUrlInfo? = null,
val playableUrlInfo: XmaUrlInfo? = null,
) : Serializable
public class DirectItemXma {
private final XmaUrlInfo previewUrlInfo;
private final XmaUrlInfo playableUrlInfo;
public DirectItemXma(final XmaUrlInfo previewUrlInfo, final XmaUrlInfo playableUrlInfo) {
this.previewUrlInfo = previewUrlInfo;
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 +
'}';
}
}
}
data class XmaUrlInfo(
val url: String? = null,
val urlExpirationTimestampUs: Long = 0,
val width: Int = 0,
val height: Int = 0,
) : Serializable

View File

@ -1,57 +1,9 @@
package awais.instagrabber.repositories.responses.directmessages;
package awais.instagrabber.repositories.responses.directmessages
import androidx.annotation.NonNull;
import java.util.List;
public class DirectThreadBroadcastResponse {
private final String action;
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 + '\'' +
'}';
}
}
data class DirectThreadBroadcastResponse(
val action: String? = null,
val statusCode: String? = null,
val payload: DirectThreadBroadcastResponsePayload? = null,
val messageMetadata: List<DirectThreadBroadcastResponseMessageMetadata>? = null,
val status: String? = null
)

View File

@ -1,55 +1,9 @@
package awais.instagrabber.repositories.responses.directmessages;
package awais.instagrabber.repositories.responses.directmessages
import java.util.List;
public class DirectThreadBroadcastResponseMessageMetadata {
private final String clientContext;
private final String itemId;
private final long timestamp;
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 +
'}';
}
}
data class DirectThreadBroadcastResponseMessageMetadata(
val clientContext: String? = null,
val itemId: String? = null,
val timestamp: Long = 0,
val threadId: String? = null,
val participantIds: List<String>? = null,
)

View File

@ -1,44 +1,8 @@
package awais.instagrabber.repositories.responses.directmessages;
package awais.instagrabber.repositories.responses.directmessages
public class DirectThreadBroadcastResponsePayload {
private final String clientContext;
private final String itemId;
private final long timestamp;
private final String threadId;
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 + '\'' +
'}';
}
}
data class DirectThreadBroadcastResponsePayload(
val clientContext: String? = null,
val itemId: String? = null,
val timestamp: Long = 0,
val threadId: String? = null,
)

View File

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

View File

@ -1,36 +1,8 @@
package awais.instagrabber.repositories.responses.directmessages;
package awais.instagrabber.repositories.responses.directmessages
import java.io.Serializable;
import java.util.Objects;
import java.io.Serializable
public class DirectThreadLastSeenAt implements Serializable {
private final String timestamp;
private final String itemId;
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);
}
}
data class DirectThreadLastSeenAt(
val timestamp: String? = null,
val itemId: String? = null,
) : Serializable

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.util.Objects;
import java.io.Serializable
public class ThreadContext implements Serializable {
private final int type;
private final String text;
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);
}
}
data class ThreadContext(
val type: Int = 0,
val text: String? = null,
) : Serializable