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

Convert to kotlin

This commit is contained in:
Ammar Githam 2021-05-25 01:58:37 +09:00
parent ebe6a176f1
commit 841c3bdbda
18 changed files with 193 additions and 991 deletions

View File

@ -195,7 +195,7 @@ public final class ThreadManager {
.orElse(null);
if (thread != null) {
cursor = thread.getOldestCursor();
hasOlder = thread.hasOlder();
hasOlder = thread.getHasOlder();
}
return thread;
}));
@ -229,7 +229,7 @@ public final class ThreadManager {
}));
pending = distinctUntilChanged(map(thread, t -> {
if (t == null) return true;
return t.isPending();
return t.getPending();
}));
adminUserIds = distinctUntilChanged(map(thread, t -> {
if (t == null) return Collections.emptyList();
@ -249,15 +249,15 @@ public final class ThreadManager {
}));
isMuted = distinctUntilChanged(map(thread, t -> {
if (t == null) return false;
return t.isMuted();
return t.getMuted();
}));
isApprovalRequiredToJoin = distinctUntilChanged(map(thread, t -> {
if (t == null) return false;
return t.isApprovalRequiredForNewMembers();
return t.getApprovalRequiredForNewMembers();
}));
isMentionsMuted = distinctUntilChanged(map(thread, t -> {
if (t == null) return false;
return t.isMentionsMuted();
return t.getMentionsMuted();
}));
pendingRequestsCount = distinctUntilChanged(map(pendingRequests, p -> {
if (p == null) return 0;

View File

@ -1,31 +1,6 @@
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 DirectItemClip implements Serializable {
private final Media clip;
public DirectItemClip(final Media clip) {
this.clip = clip;
}
public Media getClip() {
return clip;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final DirectItemClip that = (DirectItemClip) o;
return Objects.equals(clip, that.clip);
}
@Override
public int hashCode() {
return Objects.hash(clip);
}
}
data class DirectItemClip(val clip: Media? = null) : Serializable

View File

@ -1,31 +1,6 @@
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 DirectItemFelixShare implements Serializable {
private final Media video;
public DirectItemFelixShare(final Media video) {
this.video = video;
}
public Media getVideo() {
return video;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final DirectItemFelixShare that = (DirectItemFelixShare) o;
return Objects.equals(video, that.video);
}
@Override
public int hashCode() {
return Objects.hash(video);
}
}
data class DirectItemFelixShare(val video: Media? = null) : Serializable

View File

@ -1,87 +1,15 @@
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 DirectItemReelShare implements Serializable {
private final String text;
private final String type;
private final long reelOwnerId;
private final long mentionedUserId;
private final boolean isReelPersisted;
private final String reelType;
private final Media media;
private final DirectItemReelShareReactionInfo reactionInfo;
public DirectItemReelShare(final String text,
final String type,
final long reelOwnerId,
final long mentionedUserId,
final boolean isReelPersisted,
final String reelType,
final Media media,
final DirectItemReelShareReactionInfo reactionInfo) {
this.text = text;
this.type = type;
this.reelOwnerId = reelOwnerId;
this.mentionedUserId = mentionedUserId;
this.isReelPersisted = isReelPersisted;
this.reelType = reelType;
this.media = media;
this.reactionInfo = reactionInfo;
}
public String getText() {
return text;
}
public String getType() {
return type;
}
public long getReelOwnerId() {
return reelOwnerId;
}
public boolean isReelPersisted() {
return isReelPersisted;
}
public String getReelType() {
return reelType;
}
public Media getMedia() {
return media;
}
public DirectItemReelShareReactionInfo getReactionInfo() {
return reactionInfo;
}
public long getMentionedUserId() {
return mentionedUserId;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final DirectItemReelShare that = (DirectItemReelShare) o;
return reelOwnerId == that.reelOwnerId &&
mentionedUserId == that.mentionedUserId &&
isReelPersisted == that.isReelPersisted &&
Objects.equals(text, that.text) &&
Objects.equals(type, that.type) &&
Objects.equals(reelType, that.reelType) &&
Objects.equals(media, that.media) &&
Objects.equals(reactionInfo, that.reactionInfo);
}
@Override
public int hashCode() {
return Objects.hash(text, type, reelOwnerId, mentionedUserId, isReelPersisted, reelType, media, reactionInfo);
}
}
data class DirectItemReelShare(
val text: String? = null,
val type: String? = null,
val reelOwnerId: Long = 0,
val mentionedUserId: Long = 0,
val isReelPersisted: Boolean = false,
val reelType: String? = null,
val media: Media? = null,
val reactionInfo: DirectItemReelShareReactionInfo? = 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 DirectItemReelShareReactionInfo implements Serializable {
private final String emoji;
private final String intensity;
public DirectItemReelShareReactionInfo(final String emoji, final String intensity) {
this.emoji = emoji;
this.intensity = intensity;
}
public String getEmoji() {
return emoji;
}
public String getIntensity() {
return intensity;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final DirectItemReelShareReactionInfo that = (DirectItemReelShareReactionInfo) o;
return Objects.equals(emoji, that.emoji) &&
Objects.equals(intensity, that.intensity);
}
@Override
public int hashCode() {
return Objects.hash(emoji, intensity);
}
}
data class DirectItemReelShareReactionInfo(
val emoji: String? = null,
val intensity: String? = null,
) : Serializable

View File

@ -1,79 +1,14 @@
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 DirectItemStoryShare implements Serializable {
private final String reelId;
private final String reelType;
private final String text;
private final boolean isReelPersisted;
private final Media media;
private final String title;
private final String message;
public DirectItemStoryShare(final String reelId,
final String reelType,
final String text,
final boolean isReelPersisted,
final Media media,
final String title,
final String message) {
this.reelId = reelId;
this.reelType = reelType;
this.text = text;
this.isReelPersisted = isReelPersisted;
this.media = media;
this.title = title;
this.message = message;
}
public String getReelId() {
return reelId;
}
public String getReelType() {
return reelType;
}
public String getText() {
return text;
}
public boolean isReelPersisted() {
return isReelPersisted;
}
public Media getMedia() {
return media;
}
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 DirectItemStoryShare that = (DirectItemStoryShare) o;
return isReelPersisted == that.isReelPersisted &&
Objects.equals(reelId, that.reelId) &&
Objects.equals(reelType, that.reelType) &&
Objects.equals(text, that.text) &&
Objects.equals(media, that.media) &&
Objects.equals(title, that.title) &&
Objects.equals(message, that.message);
}
@Override
public int hashCode() {
return Objects.hash(reelId, reelType, text, isReelPersisted, media, title, message);
}
}
data class DirectItemStoryShare(
val reelId: String? = null,
val reelType: String? = null,
val text: String? = null,
val isReelPersisted: Boolean = false,
val media: Media? = null,
val title: String? = null,
val message: String? = null,
) : Serializable

View File

@ -1,90 +1,16 @@
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 awais.instagrabber.models.enums.RavenMediaViewMode
import awais.instagrabber.repositories.responses.Media
import java.io.Serializable
import awais.instagrabber.models.enums.RavenMediaViewMode;
import awais.instagrabber.repositories.responses.Media;
public class DirectItemVisualMedia implements Serializable {
private final long urlExpireAtSecs;
private final int playbackDurationSecs;
private final List<Long> seenUserIds;
private final RavenMediaViewMode viewMode;
private final int seenCount;
private final long replayExpiringAtUs;
private final RavenExpiringMediaActionSummary expiringMediaActionSummary;
private final Media media;
public DirectItemVisualMedia(final long urlExpireAtSecs,
final int playbackDurationSecs,
final List<Long> seenUserIds,
final RavenMediaViewMode viewMode,
final int seenCount,
final long replayExpiringAtUs,
final RavenExpiringMediaActionSummary expiringMediaActionSummary,
final Media media) {
this.urlExpireAtSecs = urlExpireAtSecs;
this.playbackDurationSecs = playbackDurationSecs;
this.seenUserIds = seenUserIds;
this.viewMode = viewMode;
this.seenCount = seenCount;
this.replayExpiringAtUs = replayExpiringAtUs;
this.expiringMediaActionSummary = expiringMediaActionSummary;
this.media = media;
}
public long getUrlExpireAtSecs() {
return urlExpireAtSecs;
}
public int getPlaybackDurationSecs() {
return playbackDurationSecs;
}
public List<Long> getSeenUserIds() {
return seenUserIds;
}
public RavenMediaViewMode getViewMode() {
return viewMode;
}
public int getSeenCount() {
return seenCount;
}
public long getReplayExpiringAtUs() {
return replayExpiringAtUs;
}
public RavenExpiringMediaActionSummary getExpiringMediaActionSummary() {
return expiringMediaActionSummary;
}
public Media getMedia() {
return media;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final DirectItemVisualMedia media1 = (DirectItemVisualMedia) o;
return urlExpireAtSecs == media1.urlExpireAtSecs &&
playbackDurationSecs == media1.playbackDurationSecs &&
seenCount == media1.seenCount &&
replayExpiringAtUs == media1.replayExpiringAtUs &&
Objects.equals(seenUserIds, media1.seenUserIds) &&
viewMode == media1.viewMode &&
Objects.equals(expiringMediaActionSummary, media1.expiringMediaActionSummary) &&
Objects.equals(media, media1.media);
}
@Override
public int hashCode() {
return Objects
.hash(urlExpireAtSecs, playbackDurationSecs, seenUserIds, viewMode, seenCount, replayExpiringAtUs, expiringMediaActionSummary, media);
}
}
data class DirectItemVisualMedia(
val urlExpireAtSecs: Long = 0,
val playbackDurationSecs: Int = 0,
val seenUserIds: List<Long>? = null,
val viewMode: RavenMediaViewMode? = null,
val seenCount: Int = 0,
val replayExpiringAtUs: Long = 0,
val expiringMediaActionSummary: RavenExpiringMediaActionSummary? = null,
val media: Media? = null,
) : Serializable

View File

@ -1,372 +1,49 @@
package awais.instagrabber.repositories.responses.directmessages;
package awais.instagrabber.repositories.responses.directmessages
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import awais.instagrabber.repositories.responses.User
import java.io.Serializable
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.Objects;
data class DirectThread(
val threadId: String? = null,
val threadV2Id: String? = null,
var users: List<User>? = null,
var leftUsers: List<User>? = null,
var adminUserIds: List<Long>? = null,
var items: List<DirectItem>? = null,
val lastActivityAt: Long = 0,
var muted: Boolean = false,
val isPin: Boolean = false,
val named: Boolean = false,
val canonical: Boolean = false,
var pending: Boolean = false,
val archived: Boolean = false,
val valuedRequest: Boolean = false,
val threadType: String? = null,
val viewerId: Long = 0,
val threadTitle: String? = null,
val pendingScore: String? = null,
val folder: Long = 0,
val vcMuted: Boolean = false,
val isGroup: Boolean = false,
var mentionsMuted: Boolean = false,
val inviter: User? = null,
val hasOlder: Boolean = false,
val hasNewer: Boolean = false,
var lastSeenAt: Map<Long, DirectThreadLastSeenAt>? = null,
val newestCursor: String? = null,
val oldestCursor: String? = null,
val isSpam: Boolean = false,
val lastPermanentItem: DirectItem? = null,
val directStory: DirectThreadDirectStory? = null,
var approvalRequiredForNewMembers: Boolean = false,
var inputMode: Int = 0,
val threadContextItems: List<ThreadContext>? = null
) : Serializable, Cloneable {
var isTemp = false
import awais.instagrabber.repositories.responses.User;
val firstDirectItem: DirectItem?
get() = items?.firstNotNullOfOrNull { it }
public class DirectThread implements Serializable, Cloneable {
private final String threadId;
private final String threadV2Id;
private List<User> users;
private List<User> leftUsers;
private List<Long> adminUserIds;
private List<DirectItem> items;
private final long lastActivityAt;
private boolean muted;
private final boolean isPin;
private final boolean named;
private final boolean canonical;
private boolean pending;
private final boolean archived;
private final boolean valuedRequest;
private final String threadType;
private final long viewerId;
private final String threadTitle;
private final String pendingScore;
private final long folder;
private final boolean vcMuted;
private final boolean isGroup;
private boolean mentionsMuted;
private final User inviter;
private final boolean hasOlder;
private final boolean hasNewer;
private Map<Long, DirectThreadLastSeenAt> lastSeenAt;
private final String newestCursor;
private final String oldestCursor;
private final boolean isSpam;
private final DirectItem lastPermanentItem;
private final DirectThreadDirectStory directStory;
private boolean approvalRequiredForNewMembers;
private int inputMode;
private final List<ThreadContext> threadContextItems;
private boolean isTemp;
public DirectThread(final String threadId,
final String threadV2Id,
final List<User> users,
final List<User> leftUsers,
final List<Long> adminUserIds,
final List<DirectItem> items,
final long lastActivityAt,
final boolean muted,
final boolean isPin,
final boolean named,
final boolean canonical,
final boolean pending,
final boolean archived,
final boolean valuedRequest,
final String threadType,
final long viewerId,
final String threadTitle,
final String pendingScore,
final long folder,
final boolean vcMuted,
final boolean isGroup,
final boolean mentionsMuted,
final User inviter,
final boolean hasOlder,
final boolean hasNewer,
final Map<Long, DirectThreadLastSeenAt> lastSeenAt,
final String newestCursor,
final String oldestCursor,
final boolean isSpam,
final DirectItem lastPermanentItem,
final DirectThreadDirectStory directStory,
final boolean approvalRequiredForNewMembers,
final int inputMode,
final List<ThreadContext> threadContextItems) {
this.threadId = threadId;
this.threadV2Id = threadV2Id;
this.users = users;
this.leftUsers = leftUsers;
this.adminUserIds = adminUserIds;
this.items = items;
this.lastActivityAt = lastActivityAt;
this.muted = muted;
this.isPin = isPin;
this.named = named;
this.canonical = canonical;
this.pending = pending;
this.archived = archived;
this.valuedRequest = valuedRequest;
this.threadType = threadType;
this.viewerId = viewerId;
this.threadTitle = threadTitle;
this.pendingScore = pendingScore;
this.folder = folder;
this.vcMuted = vcMuted;
this.isGroup = isGroup;
this.mentionsMuted = mentionsMuted;
this.inviter = inviter;
this.hasOlder = hasOlder;
this.hasNewer = hasNewer;
this.lastSeenAt = lastSeenAt;
this.newestCursor = newestCursor;
this.oldestCursor = oldestCursor;
this.isSpam = isSpam;
this.lastPermanentItem = lastPermanentItem;
this.directStory = directStory;
this.approvalRequiredForNewMembers = approvalRequiredForNewMembers;
this.inputMode = inputMode;
this.threadContextItems = threadContextItems;
}
public String getThreadId() {
return threadId;
}
public String getThreadV2Id() {
return threadV2Id;
}
public List<User> getUsers() {
return users;
}
public void setUsers(final List<User> users) {
this.users = users;
}
public List<User> getLeftUsers() {
return leftUsers;
}
public void setLeftUsers(final List<User> leftUsers) {
this.leftUsers = leftUsers;
}
public List<Long> getAdminUserIds() {
return adminUserIds;
}
public void setAdminUserIds(final List<Long> adminUserIds) {
this.adminUserIds = adminUserIds;
}
public List<DirectItem> getItems() {
return items;
}
public void setItems(final List<DirectItem> items) {
this.items = items;
}
public long getLastActivityAt() {
return lastActivityAt;
}
public boolean isMuted() {
return muted;
}
public void setMuted(final boolean muted) {
this.muted = muted;
}
public boolean isPin() {
return isPin;
}
public boolean isNamed() {
return named;
}
public boolean isCanonical() {
return canonical;
}
public boolean isPending() {
return pending;
}
public void setPending(final boolean pending) {
this.pending = pending;
}
public boolean isArchived() {
return archived;
}
public boolean isValuedRequest() {
return valuedRequest;
}
public String getThreadType() {
return threadType;
}
public long getViewerId() {
return viewerId;
}
public String getThreadTitle() {
return threadTitle;
}
public String getPendingScore() {
return pendingScore;
}
public long getFolder() {
return folder;
}
public boolean isVcMuted() {
return vcMuted;
}
public boolean isGroup() {
return isGroup;
}
public boolean isMentionsMuted() {
return mentionsMuted;
}
public void setMentionsMuted(final boolean mentionsMuted) {
this.mentionsMuted = mentionsMuted;
}
public User getInviter() {
return inviter;
}
public boolean hasOlder() {
return hasOlder;
}
public boolean hasNewer() {
return hasNewer;
}
public Map<Long, DirectThreadLastSeenAt> getLastSeenAt() {
return lastSeenAt;
}
public void setLastSeenAt(final Map<Long, DirectThreadLastSeenAt> lastSeenAt) {
this.lastSeenAt = lastSeenAt;
}
public String getNewestCursor() {
return newestCursor;
}
public String getOldestCursor() {
return oldestCursor;
}
public boolean isSpam() {
return isSpam;
}
public DirectItem getLastPermanentItem() {
return lastPermanentItem;
}
public DirectThreadDirectStory getDirectStory() {
return directStory;
}
public boolean isApprovalRequiredForNewMembers() {
return approvalRequiredForNewMembers;
}
public void setApprovalRequiredForNewMembers(final boolean approvalRequiredForNewMembers) {
this.approvalRequiredForNewMembers = approvalRequiredForNewMembers;
}
public int getInputMode() {
return inputMode;
}
public void setInputMode(final int inputMode) {
this.inputMode = inputMode;
}
public List<ThreadContext> getThreadContextItems() {
return threadContextItems;
}
public boolean isTemp() {
return isTemp;
}
public void setTemp(final boolean isTemp) {
this.isTemp = isTemp;
}
@Nullable
public DirectItem getFirstDirectItem() {
DirectItem firstItem = null;
if (!items.isEmpty()) {
int position = 0;
while (firstItem == null && position < items.size()) {
firstItem = items.get(position);
position++;
}
}
return firstItem;
}
@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 DirectThread that = (DirectThread) o;
return lastActivityAt == that.lastActivityAt &&
muted == that.muted &&
isPin == that.isPin &&
named == that.named &&
canonical == that.canonical &&
pending == that.pending &&
archived == that.archived &&
valuedRequest == that.valuedRequest &&
viewerId == that.viewerId &&
folder == that.folder &&
vcMuted == that.vcMuted &&
isGroup == that.isGroup &&
mentionsMuted == that.mentionsMuted &&
hasOlder == that.hasOlder &&
hasNewer == that.hasNewer &&
isSpam == that.isSpam &&
approvalRequiredForNewMembers == that.approvalRequiredForNewMembers &&
inputMode == that.inputMode &&
Objects.equals(threadId, that.threadId) &&
Objects.equals(threadV2Id, that.threadV2Id) &&
Objects.equals(users, that.users) &&
Objects.equals(leftUsers, that.leftUsers) &&
Objects.equals(adminUserIds, that.adminUserIds) &&
Objects.equals(items, that.items) &&
Objects.equals(threadType, that.threadType) &&
Objects.equals(threadTitle, that.threadTitle) &&
Objects.equals(pendingScore, that.pendingScore) &&
Objects.equals(inviter, that.inviter) &&
Objects.equals(lastSeenAt, that.lastSeenAt) &&
Objects.equals(newestCursor, that.newestCursor) &&
Objects.equals(oldestCursor, that.oldestCursor) &&
Objects.equals(lastPermanentItem, that.lastPermanentItem) &&
Objects.equals(directStory, that.directStory) &&
Objects.equals(threadContextItems, that.threadContextItems);
}
@Override
public int hashCode() {
return Objects
.hash(threadId, threadV2Id, users, leftUsers, adminUserIds, items, lastActivityAt, muted, isPin, named, canonical, pending, archived,
valuedRequest, threadType, viewerId, threadTitle, pendingScore, folder, vcMuted, isGroup, mentionsMuted, inviter, hasOlder,
hasNewer, lastSeenAt, newestCursor, oldestCursor, isSpam, lastPermanentItem, directStory, approvalRequiredForNewMembers,
inputMode, threadContextItems);
}
}
@Throws(CloneNotSupportedException::class)
public override fun clone(): Any = super.clone()
}

View File

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

View File

@ -1,37 +1,8 @@
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 DirectThreadDirectStory implements Serializable {
private final List<DirectItem> items;
private final int unseenCount;
public DirectThreadDirectStory(final List<DirectItem> items, final int unseenCount) {
this.items = items;
this.unseenCount = unseenCount;
}
public List<DirectItem> getItems() {
return items;
}
public int getUnseenCount() {
return unseenCount;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final DirectThreadDirectStory that = (DirectThreadDirectStory) o;
return unseenCount == that.unseenCount &&
Objects.equals(items, that.items);
}
@Override
public int hashCode() {
return Objects.hash(items, unseenCount);
}
}
data class DirectThreadDirectStory(
val items: List<DirectItem>? = null,
val unseenCount: Int = 0,
) : Serializable

View File

@ -1,70 +1,16 @@
package awais.instagrabber.repositories.responses.directmessages;
package awais.instagrabber.repositories.responses.directmessages
import androidx.annotation.NonNull;
import awais.instagrabber.repositories.responses.User
import java.io.Serializable
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import awais.instagrabber.repositories.responses.User;
public class DirectThreadParticipantRequestsResponse implements Serializable, Cloneable {
private List<User> users;
private final Map<Long, String> requesterUsernames;
private final String cursor;
private final int totalThreadParticipants;
private int totalParticipantRequests;
private final String status;
public DirectThreadParticipantRequestsResponse(final List<User> users,
final Map<Long, String> requesterUsernames,
final String cursor,
final int totalThreadParticipants,
final int totalParticipantRequests,
final String status) {
this.users = users;
this.requesterUsernames = requesterUsernames;
this.cursor = cursor;
this.totalThreadParticipants = totalThreadParticipants;
this.totalParticipantRequests = totalParticipantRequests;
this.status = status;
}
public List<User> getUsers() {
return users;
}
public void setUsers(final List<User> users) {
this.users = users;
}
public Map<Long, String> getRequesterUsernames() {
return requesterUsernames;
}
public String getCursor() {
return cursor;
}
public int getTotalThreadParticipants() {
return totalThreadParticipants;
}
public int getTotalParticipantRequests() {
return totalParticipantRequests;
}
public void setTotalParticipantRequests(final int totalParticipantRequests) {
this.totalParticipantRequests = totalParticipantRequests;
}
public String getStatus() {
return status;
}
@NonNull
@Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
}
data class DirectThreadParticipantRequestsResponse(
var users: List<User>? = null,
val requesterUsernames: Map<Long, String>? = null,
val cursor: String? = null,
val totalThreadParticipants: Int = 0,
var totalParticipantRequests: Int = 0,
val status: String? = null,
) : Serializable, Cloneable {
@Throws(CloneNotSupportedException::class)
public override fun clone(): Any = super.clone()
}

View File

@ -1,46 +1,21 @@
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.User
import java.io.Serializable
import awais.instagrabber.repositories.responses.User;
data class RankedRecipient(
val user: User? = null,
val thread: DirectThread? = null,
) : Serializable {
companion object {
@JvmStatic
fun of(user: User): RankedRecipient {
return RankedRecipient(user = user)
}
public class RankedRecipient implements Serializable {
private final User user;
private final DirectThread thread;
public RankedRecipient(final User user, final DirectThread thread) {
this.user = user;
this.thread = thread;
@JvmStatic
fun of(thread: DirectThread): RankedRecipient {
return RankedRecipient(thread = thread)
}
}
public User getUser() {
return user;
}
public DirectThread getThread() {
return thread;
}
public static RankedRecipient of(final User user) {
return new RankedRecipient(user, null);
}
public static RankedRecipient of(final DirectThread thread) {
return new RankedRecipient(null, thread);
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final RankedRecipient that = (RankedRecipient) o;
return Objects.equals(user, that.user) &&
Objects.equals(thread, that.thread);
}
@Override
public int hashCode() {
return Objects.hash(user, thread);
}
}
}

View File

@ -1,50 +1,10 @@
package awais.instagrabber.repositories.responses.directmessages;
package awais.instagrabber.repositories.responses.directmessages
import java.util.List;
public class RankedRecipientsResponse {
private final List<RankedRecipient> rankedRecipients;
private final long expires;
private final boolean filtered;
private final String requestId;
private final String rankToken;
private final String status;
public RankedRecipientsResponse(final List<RankedRecipient> rankedRecipients,
final long expires,
final boolean filtered,
final String requestId,
final String rankToken,
final String status) {
this.rankedRecipients = rankedRecipients;
this.expires = expires;
this.filtered = filtered;
this.requestId = requestId;
this.rankToken = rankToken;
this.status = status;
}
public List<RankedRecipient> getRankedRecipients() {
return rankedRecipients;
}
public long getExpires() {
return expires;
}
public boolean isFiltered() {
return filtered;
}
public String getRequestId() {
return requestId;
}
public String getRankToken() {
return rankToken;
}
public String getStatus() {
return status;
}
}
data class RankedRecipientsResponse(
val rankedRecipients: List<RankedRecipient>? = null,
val expires: Long = 0,
val filtered: Boolean = false,
val requestId: String? = null,
val rankToken: String? = null,
val status: String? = null,
)

View File

@ -1,69 +1,43 @@
package awais.instagrabber.repositories.responses.directmessages;
package awais.instagrabber.repositories.responses.directmessages
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.SerializedName
import java.io.Serializable
import java.io.Serializable;
import java.util.Objects;
data class RavenExpiringMediaActionSummary(
val timestamp: Long = 0,
val count: Int = 0,
val type: ActionType? = null,
) : Serializable
public final class RavenExpiringMediaActionSummary implements Serializable {
private final ActionType type;
private final long timestamp;
private final int count;
// thanks to http://github.com/warifp/InstagramAutoPostImageUrl/blob/master/vendor/mgp25/instagram-php/src/Response/Model/ActionBadge.php
enum class ActionType {
@SerializedName("raven_delivered")
DELIVERED,
public RavenExpiringMediaActionSummary(final long timestamp, final int count, final ActionType type) {
this.timestamp = timestamp;
this.count = count;
this.type = type;
}
@SerializedName("raven_sent")
SENT,
public long getTimestamp() {
return timestamp;
}
@SerializedName("raven_opened")
OPENED,
public int getCount() {
return count;
}
@SerializedName("raven_screenshot")
SCREENSHOT,
public ActionType getType() {
return type;
}
@SerializedName("raven_replayed")
REPLAYED,
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final RavenExpiringMediaActionSummary that = (RavenExpiringMediaActionSummary) o;
return timestamp == that.timestamp &&
count == that.count &&
type == that.type;
}
@SerializedName("raven_cannot_deliver")
CANNOT_DELIVER,
@Override
public int hashCode() {
return Objects.hash(type, timestamp, count);
}
@SerializedName("raven_sending")
SENDING,
// thanks to http://github.com/warifp/InstagramAutoPostImageUrl/blob/master/vendor/mgp25/instagram-php/src/Response/Model/ActionBadge.php
public enum ActionType {
@SerializedName("raven_delivered")
DELIVERED,
@SerializedName("raven_sent")
SENT,
@SerializedName("raven_opened")
OPENED,
@SerializedName("raven_screenshot")
SCREENSHOT,
@SerializedName("raven_replayed")
REPLAYED,
@SerializedName("raven_cannot_deliver")
CANNOT_DELIVER,
@SerializedName("raven_sending")
SENDING,
@SerializedName("raven_blocked")
BLOCKED,
@SerializedName("raven_unknown")
UNKNOWN,
@SerializedName("raven_suggested")
SUGGESTED,
}
}
@SerializedName("raven_blocked")
BLOCKED,
@SerializedName("raven_unknown")
UNKNOWN,
@SerializedName("raven_suggested")
SUGGESTED,
}

View File

@ -91,7 +91,7 @@ public class DMSyncService extends LifecycleService {
return;
}
for (final DirectThread thread : threads) {
if (thread.isMuted()) continue;
if (thread.getMuted()) continue;
final boolean read = DMUtils.isRead(thread);
if (read) continue;
final List<DirectItem> unreadMessages = getUnreadMessages(thread);

View File

@ -15,6 +15,7 @@ import awais.instagrabber.models.enums.DirectItemType;
import awais.instagrabber.models.enums.MediaItemType;
import awais.instagrabber.repositories.responses.Media;
import awais.instagrabber.repositories.responses.User;
import awais.instagrabber.repositories.responses.directmessages.ActionType;
import awais.instagrabber.repositories.responses.directmessages.DirectItem;
import awais.instagrabber.repositories.responses.directmessages.DirectItemAnimatedMedia;
import awais.instagrabber.repositories.responses.directmessages.DirectItemReelShare;
@ -267,7 +268,7 @@ public final class DMUtils {
final DirectItemVisualMedia visualMedia = item.getVisualMedia();
final RavenExpiringMediaActionSummary summary = visualMedia.getExpiringMediaActionSummary();
if (summary != null) {
final RavenExpiringMediaActionSummary.ActionType expiringMediaType = summary.getType();
final ActionType expiringMediaType = summary.getType();
int textRes = 0;
switch (expiringMediaType) {
case DELIVERED:

View File

@ -80,7 +80,7 @@ public class DirectSettingsViewModel extends AndroidViewModel {
// final List<Long> adminUserIds = thread.getAdminUserIds();
// this.adminUserIds.postValue(adminUserIds);
// viewerIsAdmin = adminUserIds.contains(viewerId);
// muted.postValue(thread.isMuted());
// muted.postValue(thread.getMuted());
// mentionsMuted.postValue(thread.isMentionsMuted());
// approvalRequiredToJoin.postValue(thread.isApprovalRequiredForNewMembers());
// isPending.postValue(thread.isPending());

View File

@ -107,7 +107,7 @@ public class DiscoverService extends BaseService {
// }
// final String type = clusterJson.optString("type");
// final boolean canMute = clusterJson.optBoolean("can_mute");
// final boolean isMuted = clusterJson.optBoolean("is_muted");
// final boolean getMuted = clusterJson.optBoolean("is_muted");
// final JSONObject coverMediaJson = clusterJson.optJSONObject("cover_media");
// final int rankedPosition = clusterJson.optInt("ranked_position");
// final FeedModel feedModel = parseClusterCover(coverMediaJson);
@ -116,7 +116,7 @@ public class DiscoverService extends BaseService {
// title,
// type,
// canMute,
// isMuted,
// getMuted,
// rankedPosition,
// feedModel
// );