BarInsta/app/src/main/java/awais/instagrabber/repositories/responses/User.kt

297 lines
9.7 KiB
Kotlin
Raw Normal View History

package awais.instagrabber.repositories.responses;
import java.io.Serializable;
2021-03-05 15:50:10 +00:00
import java.util.List;
import java.util.Objects;
public class User implements Serializable {
private final long pk;
private final String username;
private final String fullName;
private final boolean isPrivate;
private final String profilePicUrl;
private final String profilePicId;
2021-01-23 19:17:56 +00:00
private FriendshipStatus friendshipStatus;
private final boolean isVerified;
private final boolean hasAnonymousProfilePicture;
private final boolean isUnpublished;
private final boolean isFavorite;
private final boolean isDirectappInstalled;
2021-05-15 16:53:00 +00:00
private final boolean hasChaining;
private final String reelAutoArchive;
private final String allowedCommenterType;
private final long mediaCount;
private final long followerCount;
private final long followingCount;
private final long followingTagCount;
private final String biography;
private final String externalUrl;
private final long usertagsCount;
private final String publicEmail;
2021-01-27 02:21:48 +00:00
private final HdProfilePicUrlInfo hdProfilePicUrlInfo;
2021-05-15 16:52:31 +00:00
private final String profileContext; // "also followed by" your friends
private final List<UserProfileContextLink> profileContextLinksWithUserIds; // ^
private final String socialContext; // AYML
private final String interopMessagingUserFbid; // in DMs only: Facebook user ID
public User(final long pk,
final String username,
final String fullName,
final boolean isPrivate,
final String profilePicUrl,
final String profilePicId,
final FriendshipStatus friendshipStatus,
final boolean isVerified,
final boolean hasAnonymousProfilePicture,
final boolean isUnpublished,
final boolean isFavorite,
final boolean isDirectappInstalled,
2021-05-15 16:53:00 +00:00
final boolean hasChaining,
final String reelAutoArchive,
final String allowedCommenterType,
final long mediaCount,
final long followerCount,
final long followingCount,
final long followingTagCount,
final String biography,
final String externalUrl,
final long usertagsCount,
2021-01-27 02:21:48 +00:00
final String publicEmail,
2021-03-05 15:50:10 +00:00
final HdProfilePicUrlInfo hdProfilePicUrlInfo,
final String profileContext,
2021-03-05 19:06:27 +00:00
final List<UserProfileContextLink> profileContextLinksWithUserIds,
2021-03-17 00:24:19 +00:00
final String socialContext,
final String interopMessagingUserFbid) {
this.pk = pk;
this.username = username;
this.fullName = fullName;
this.isPrivate = isPrivate;
this.profilePicUrl = profilePicUrl;
this.profilePicId = profilePicId;
this.friendshipStatus = friendshipStatus;
this.isVerified = isVerified;
this.hasAnonymousProfilePicture = hasAnonymousProfilePicture;
this.isUnpublished = isUnpublished;
this.isFavorite = isFavorite;
this.isDirectappInstalled = isDirectappInstalled;
2021-05-15 16:53:00 +00:00
this.hasChaining = hasChaining;
this.reelAutoArchive = reelAutoArchive;
this.allowedCommenterType = allowedCommenterType;
this.mediaCount = mediaCount;
this.followerCount = followerCount;
this.followingCount = followingCount;
this.followingTagCount = followingTagCount;
this.biography = biography;
this.externalUrl = externalUrl;
this.usertagsCount = usertagsCount;
this.publicEmail = publicEmail;
2021-01-27 02:21:48 +00:00
this.hdProfilePicUrlInfo = hdProfilePicUrlInfo;
2021-03-05 15:50:10 +00:00
this.profileContext = profileContext;
this.profileContextLinksWithUserIds = profileContextLinksWithUserIds;
2021-03-05 19:06:27 +00:00
this.socialContext = socialContext;
2021-03-17 00:24:19 +00:00
this.interopMessagingUserFbid = interopMessagingUserFbid;
}
2021-05-15 16:52:31 +00:00
public User(final long pk,
final String username,
final String fullName,
final boolean isPrivate,
final String profilePicUrl,
final boolean isVerified) {
this.pk = pk;
this.username = username;
this.fullName = fullName;
this.isPrivate = isPrivate;
this.profilePicUrl = profilePicUrl;
this.profilePicId = null;
this.friendshipStatus = new FriendshipStatus(
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
);
this.isVerified = isVerified;
this.hasAnonymousProfilePicture = false;
this.isUnpublished = false;
this.isFavorite = false;
this.isDirectappInstalled = false;
2021-05-15 16:53:00 +00:00
this.hasChaining = false;
2021-05-15 16:52:31 +00:00
this.reelAutoArchive = null;
this.allowedCommenterType = null;
this.mediaCount = 0;
this.followerCount = 0;
this.followingCount = 0;
this.followingTagCount = 0;
this.biography = null;
this.externalUrl = null;
this.usertagsCount = 0;
this.publicEmail = null;
this.hdProfilePicUrlInfo = null;
this.profileContext = null;
this.profileContextLinksWithUserIds = null;
this.socialContext = null;
this.interopMessagingUserFbid = null;
}
public long getPk() {
return pk;
}
public String getUsername() {
return username;
}
public String getFullName() {
return fullName;
}
public boolean isPrivate() {
return isPrivate;
}
public String getProfilePicUrl() {
return profilePicUrl;
}
2021-01-27 02:21:48 +00:00
public String getHDProfilePicUrl() {
if (hdProfilePicUrlInfo == null) {
return getProfilePicUrl();
}
2021-01-27 02:21:48 +00:00
return hdProfilePicUrlInfo.getUrl();
}
public String getProfilePicId() {
return profilePicId;
}
public FriendshipStatus getFriendshipStatus() {
return friendshipStatus;
}
2021-01-23 19:17:56 +00:00
public void setFriendshipStatus(final FriendshipStatus friendshipStatus) {
this.friendshipStatus = friendshipStatus;
}
public boolean isVerified() {
return isVerified;
}
public boolean hasAnonymousProfilePicture() {
return hasAnonymousProfilePicture;
}
public boolean isUnpublished() {
return isUnpublished;
}
public boolean isFavorite() {
return isFavorite;
}
public boolean isDirectappInstalled() {
return isDirectappInstalled;
}
2021-05-15 16:53:00 +00:00
public boolean hasChaining() {
return hasChaining;
}
public String getReelAutoArchive() {
return reelAutoArchive;
}
public String getAllowedCommenterType() {
return allowedCommenterType;
}
public long getMediaCount() {
return mediaCount;
}
public long getFollowerCount() {
return followerCount;
}
public long getFollowingCount() {
return followingCount;
}
public long getFollowingTagCount() {
return followingTagCount;
}
public String getBiography() {
return biography;
}
public String getExternalUrl() {
return externalUrl;
}
public long getUsertagsCount() {
return usertagsCount;
}
public String getPublicEmail() {
return publicEmail;
}
2021-03-05 15:50:10 +00:00
public String getProfileContext() {
return profileContext;
}
2021-03-05 19:06:27 +00:00
public String getSocialContext() {
return socialContext;
}
2021-03-05 15:50:10 +00:00
public List<UserProfileContextLink> getProfileContextLinks() {
return profileContextLinksWithUserIds;
}
2021-03-17 00:24:19 +00:00
public String getFbId() {
return interopMessagingUserFbid;
}
2021-02-27 15:59:55 +00:00
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
2021-02-27 15:59:55 +00:00
final User user = (User) o;
return pk == user.pk &&
isPrivate == user.isPrivate &&
isVerified == user.isVerified &&
hasAnonymousProfilePicture == user.hasAnonymousProfilePicture &&
isUnpublished == user.isUnpublished &&
isFavorite == user.isFavorite &&
isDirectappInstalled == user.isDirectappInstalled &&
mediaCount == user.mediaCount &&
followerCount == user.followerCount &&
followingCount == user.followingCount &&
followingTagCount == user.followingTagCount &&
usertagsCount == user.usertagsCount &&
Objects.equals(username, user.username) &&
Objects.equals(fullName, user.fullName) &&
Objects.equals(profilePicUrl, user.profilePicUrl) &&
Objects.equals(profilePicId, user.profilePicId) &&
Objects.equals(friendshipStatus, user.friendshipStatus) &&
Objects.equals(reelAutoArchive, user.reelAutoArchive) &&
Objects.equals(allowedCommenterType, user.allowedCommenterType) &&
Objects.equals(biography, user.biography) &&
Objects.equals(externalUrl, user.externalUrl) &&
Objects.equals(publicEmail, user.publicEmail);
}
@Override
public int hashCode() {
2021-02-27 15:59:55 +00:00
return Objects.hash(pk, username, fullName, isPrivate, profilePicUrl, profilePicId, friendshipStatus, isVerified, hasAnonymousProfilePicture,
2021-05-15 16:53:00 +00:00
isUnpublished, isFavorite, isDirectappInstalled, hasChaining, reelAutoArchive, allowedCommenterType, mediaCount,
followerCount, followingCount, followingTagCount, biography, externalUrl, usertagsCount, publicEmail);
}
}