1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-26 00:27:30 +00:00

Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Ammar Githam 2021-05-31 20:56:06 +09:00
commit 538a1406a6
25 changed files with 181 additions and 398 deletions

1
.gitignore vendored
View File

@ -21,3 +21,4 @@ app/release
/app/fdroid/ /app/fdroid/
/app/github/ /app/github/
/repo /repo
/.fdroid.yml

View File

@ -139,7 +139,7 @@ public final class DirectItemsAdapter extends RecyclerView.Adapter<RecyclerView.
return new HeaderViewHolder(LayoutDmHeaderBinding.inflate(layoutInflater, parent, false)); return new HeaderViewHolder(LayoutDmHeaderBinding.inflate(layoutInflater, parent, false));
} }
final LayoutDmBaseBinding baseBinding = LayoutDmBaseBinding.inflate(layoutInflater, parent, false); final LayoutDmBaseBinding baseBinding = LayoutDmBaseBinding.inflate(layoutInflater, parent, false);
final DirectItemType directItemType = DirectItemType.valueOf(type); final DirectItemType directItemType = DirectItemType.Companion.getId(type);
final DirectItemViewHolder itemViewHolder = getItemViewHolder(layoutInflater, baseBinding, directItemType); final DirectItemViewHolder itemViewHolder = getItemViewHolder(layoutInflater, baseBinding, directItemType);
itemViewHolder.setLongClickListener(longClickListener); itemViewHolder.setLongClickListener(longClickListener);
return itemViewHolder; return itemViewHolder;

View File

@ -11,20 +11,19 @@ import androidx.recyclerview.widget.ListAdapter;
import awais.instagrabber.adapters.viewholder.TopicClusterViewHolder; import awais.instagrabber.adapters.viewholder.TopicClusterViewHolder;
import awais.instagrabber.databinding.ItemDiscoverTopicBinding; import awais.instagrabber.databinding.ItemDiscoverTopicBinding;
import awais.instagrabber.repositories.responses.saved.SavedCollection; import awais.instagrabber.repositories.responses.saved.SavedCollection;
import awais.instagrabber.utils.ResponseBodyUtils;
public class SavedCollectionsAdapter extends ListAdapter<SavedCollection, TopicClusterViewHolder> { public class SavedCollectionsAdapter extends ListAdapter<SavedCollection, TopicClusterViewHolder> {
private static final DiffUtil.ItemCallback<SavedCollection> DIFF_CALLBACK = new DiffUtil.ItemCallback<SavedCollection>() { private static final DiffUtil.ItemCallback<SavedCollection> DIFF_CALLBACK = new DiffUtil.ItemCallback<SavedCollection>() {
@Override @Override
public boolean areItemsTheSame(@NonNull final SavedCollection oldItem, @NonNull final SavedCollection newItem) { public boolean areItemsTheSame(@NonNull final SavedCollection oldItem, @NonNull final SavedCollection newItem) {
return oldItem.getId().equals(newItem.getId()); return oldItem.getCollectionId().equals(newItem.getCollectionId());
} }
@Override @Override
public boolean areContentsTheSame(@NonNull final SavedCollection oldItem, @NonNull final SavedCollection newItem) { public boolean areContentsTheSame(@NonNull final SavedCollection oldItem, @NonNull final SavedCollection newItem) {
if (oldItem.getCoverMedias() != null && newItem.getCoverMedias() != null if (oldItem.getCoverMediaList() != null && newItem.getCoverMediaList() != null
&& oldItem.getCoverMedias().size() == newItem.getCoverMedias().size()) { && oldItem.getCoverMediaList().size() == newItem.getCoverMediaList().size()) {
return oldItem.getCoverMedias().get(0).getId().equals(newItem.getCoverMedias().get(0).getId()); return oldItem.getCoverMediaList().get(0).getId().equals(newItem.getCoverMediaList().get(0).getId());
} }
else if (oldItem.getCoverMedia() != null && newItem.getCoverMedia() != null) { else if (oldItem.getCoverMedia() != null && newItem.getCoverMedia() != null) {
return oldItem.getCoverMedia().getId().equals(newItem.getCoverMedia().getId()); return oldItem.getCoverMedia().getId().equals(newItem.getCoverMedia().getId());

View File

@ -128,11 +128,11 @@ public class TopicClusterViewHolder extends RecyclerView.ViewHolder {
backgroundColor.get() backgroundColor.get()
)); ));
} }
// binding.title.setTransitionName("title-" + topicCluster.getId()); // binding.title.setTransitionName("title-" + topicCluster.getCollectionId());
binding.cover.setTransitionName("cover-" + topicCluster.getId()); binding.cover.setTransitionName("cover-" + topicCluster.getCollectionId());
final String thumbUrl = ResponseBodyUtils.getThumbUrl(topicCluster.getCoverMedias() == null final String thumbUrl = ResponseBodyUtils.getThumbUrl(topicCluster.getCoverMediaList() == null
? topicCluster.getCoverMedia() ? topicCluster.getCoverMedia()
: topicCluster.getCoverMedias().get(0)); : topicCluster.getCoverMediaList().get(0));
if (thumbUrl == null) { if (thumbUrl == null) {
binding.cover.setImageURI((String) null); binding.cover.setImageURI((String) null);
} else { } else {
@ -174,6 +174,6 @@ public class TopicClusterViewHolder extends RecyclerView.ViewHolder {
}, CallerThreadExecutor.getInstance()); }, CallerThreadExecutor.getInstance());
binding.cover.setImageRequest(imageRequest); binding.cover.setImageRequest(imageRequest);
} }
binding.title.setText(topicCluster.getTitle()); binding.title.setText(topicCluster.getCollectionName());
} }
} }

View File

@ -84,6 +84,7 @@ public class CollectionPostsFragment extends Fragment implements SwipeRefreshLay
private int downloadChildPosition = -1; private int downloadChildPosition = -1;
private CollectionService collectionService; private CollectionService collectionService;
private PostsLayoutPreferences layoutPreferences = Utils.getPostsLayoutPreferences(Constants.PREF_SAVED_POSTS_LAYOUT); private PostsLayoutPreferences layoutPreferences = Utils.getPostsLayoutPreferences(Constants.PREF_SAVED_POSTS_LAYOUT);
private MenuItem deleteMenu, editMenu;
private final OnBackPressedCallback onBackPressedCallback = new OnBackPressedCallback(false) { private final OnBackPressedCallback onBackPressedCallback = new OnBackPressedCallback(false) {
@Override @Override
@ -281,8 +282,13 @@ public class CollectionPostsFragment extends Fragment implements SwipeRefreshLay
@Override @Override
public void onCreateOptionsMenu(@NonNull final Menu menu, @NonNull final MenuInflater inflater) { public void onCreateOptionsMenu(@NonNull final Menu menu, @NonNull final MenuInflater inflater) {
// delaying to make toolbar resume animation smooth, otherwise lags inflater.inflate(R.menu.collection_posts_menu, menu);
binding.getRoot().postDelayed(() -> inflater.inflate(R.menu.collection_posts_menu, menu), 500); deleteMenu = menu.findItem(R.id.delete);
if (deleteMenu != null)
deleteMenu.setVisible(savedCollection.getCollectionType().equals("MEDIA"));
editMenu = menu.findItem(R.id.edit);
if (editMenu != null)
editMenu.setVisible(savedCollection.getCollectionType().equals("MEDIA"));
} }
@Override @Override
@ -297,7 +303,7 @@ public class CollectionPostsFragment extends Fragment implements SwipeRefreshLay
.setTitle(R.string.delete_collection) .setTitle(R.string.delete_collection)
.setMessage(R.string.delete_collection_note) .setMessage(R.string.delete_collection_note)
.setPositiveButton(R.string.confirm, (d, w) -> collectionService.deleteCollection( .setPositiveButton(R.string.confirm, (d, w) -> collectionService.deleteCollection(
savedCollection.getId(), savedCollection.getCollectionId(),
new ServiceCallback<String>() { new ServiceCallback<String>() {
@Override @Override
public void onSuccess(final String result) { public void onSuccess(final String result) {
@ -325,7 +331,7 @@ public class CollectionPostsFragment extends Fragment implements SwipeRefreshLay
.setTitle(R.string.edit_collection) .setTitle(R.string.edit_collection)
.setView(input) .setView(input)
.setPositiveButton(R.string.confirm, (d, w) -> collectionService.editCollectionName( .setPositiveButton(R.string.confirm, (d, w) -> collectionService.editCollectionName(
savedCollection.getId(), savedCollection.getCollectionId(),
input.getText().toString(), input.getText().toString(),
new ServiceCallback<String>() { new ServiceCallback<String>() {
@Override @Override
@ -408,9 +414,9 @@ public class CollectionPostsFragment extends Fragment implements SwipeRefreshLay
if (savedCollection == null) { if (savedCollection == null) {
return; return;
} }
binding.cover.setTransitionName("collection-" + savedCollection.getId()); binding.cover.setTransitionName("collection-" + savedCollection.getCollectionId());
fragmentActivity.setToolbar(binding.toolbar); fragmentActivity.setToolbar(binding.toolbar);
binding.collapsingToolbarLayout.setTitle(savedCollection.getTitle()); binding.collapsingToolbarLayout.setTitle(savedCollection.getCollectionName());
final int collapsedTitleTextColor = ColorUtils.setAlphaComponent(titleColor, 0xFF); final int collapsedTitleTextColor = ColorUtils.setAlphaComponent(titleColor, 0xFF);
final int expandedTitleTextColor = ColorUtils.setAlphaComponent(titleColor, 0x99); final int expandedTitleTextColor = ColorUtils.setAlphaComponent(titleColor, 0x99);
binding.collapsingToolbarLayout.setExpandedTitleColor(expandedTitleTextColor); binding.collapsingToolbarLayout.setExpandedTitleColor(expandedTitleTextColor);
@ -442,9 +448,9 @@ public class CollectionPostsFragment extends Fragment implements SwipeRefreshLay
} }
private void setupCover() { private void setupCover() {
final String coverUrl = ResponseBodyUtils.getImageUrl(savedCollection.getCoverMedias() == null final String coverUrl = ResponseBodyUtils.getImageUrl(savedCollection.getCoverMediaList() == null
? savedCollection.getCoverMedia() ? savedCollection.getCoverMedia()
: savedCollection.getCoverMedias().get(0)); : savedCollection.getCoverMediaList().get(0));
final DraweeController controller = Fresco final DraweeController controller = Fresco
.newDraweeControllerBuilder() .newDraweeControllerBuilder()
.setOldController(binding.cover.getController()) .setOldController(binding.cover.getController())
@ -471,7 +477,7 @@ public class CollectionPostsFragment extends Fragment implements SwipeRefreshLay
private void setupPosts() { private void setupPosts() {
binding.posts.setViewModelStoreOwner(this) binding.posts.setViewModelStoreOwner(this)
.setLifeCycleOwner(this) .setLifeCycleOwner(this)
.setPostFetchService(new SavedPostFetchService(0, PostItemType.COLLECTION, true, savedCollection.getId())) .setPostFetchService(new SavedPostFetchService(0, PostItemType.COLLECTION, true, savedCollection.getCollectionId()))
.setLayoutPreferences(layoutPreferences) .setLayoutPreferences(layoutPreferences)
.addFetchStatusChangeListener(fetching -> updateSwipeRefreshState()) .addFetchStatusChangeListener(fetching -> updateSwipeRefreshState())
.setFeedItemCallback(feedItemCallback) .setFeedItemCallback(feedItemCallback)
@ -493,7 +499,7 @@ public class CollectionPostsFragment extends Fragment implements SwipeRefreshLay
private void showPostsLayoutPreferences() { private void showPostsLayoutPreferences() {
final PostsLayoutPreferencesDialogFragment fragment = new PostsLayoutPreferencesDialogFragment( final PostsLayoutPreferencesDialogFragment fragment = new PostsLayoutPreferencesDialogFragment(
Constants.PREF_TOPIC_POSTS_LAYOUT, Constants.PREF_SAVED_POSTS_LAYOUT,
preferences -> { preferences -> {
layoutPreferences = preferences; layoutPreferences = preferences;
new Handler().postDelayed(() -> binding.posts.setLayoutPreferences(preferences), 200); new Handler().postDelayed(() -> binding.posts.setLayoutPreferences(preferences), 200);

View File

@ -762,8 +762,7 @@ public class PostViewV2Fragment extends Fragment implements EditTextDialogFragme
if (isPrivate) { if (isPrivate) {
final Context context = getContext(); final Context context = getContext();
if (context == null) return; if (context == null) return;
// is this necessary? // Toast.makeText(context, R.string.share_private_post, Toast.LENGTH_LONG).show();
Toast.makeText(context, R.string.share_private_post, Toast.LENGTH_LONG).show();
} }
if (viewModel.isLoggedIn()) { if (viewModel.isLoggedIn()) {
final Context context = getContext(); final Context context = getContext();
@ -806,6 +805,8 @@ public class PostViewV2Fragment extends Fragment implements EditTextDialogFragme
private void shareLink(@NonNull final Media media, final boolean isPrivate) { private void shareLink(@NonNull final Media media, final boolean isPrivate) {
final Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); final Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain"); sharingIntent.setType("text/plain");
sharingIntent.putExtra(android.content.Intent.EXTRA_TITLE,
getString(isPrivate ? R.string.share_private_post : R.string.share_public_post));
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, "https://instagram.com/p/" + media.getCode()); sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, "https://instagram.com/p/" + media.getCode());
startActivity(Intent.createChooser( startActivity(Intent.createChooser(
sharingIntent, sharingIntent,

View File

@ -145,12 +145,12 @@ public class SavedCollectionsFragment extends Fragment implements SwipeRefreshLa
final SavedCollectionsAdapter adapter = new SavedCollectionsAdapter((topicCluster, root, cover, title, titleColor, backgroundColor) -> { final SavedCollectionsAdapter adapter = new SavedCollectionsAdapter((topicCluster, root, cover, title, titleColor, backgroundColor) -> {
final NavController navController = NavHostFragment.findNavController(this); final NavController navController = NavHostFragment.findNavController(this);
if (isSaving) { if (isSaving) {
setNavControllerResult(navController, topicCluster.getId()); setNavControllerResult(navController, topicCluster.getCollectionId());
navController.navigateUp(); navController.navigateUp();
} else { } else {
try { try {
final FragmentNavigator.Extras.Builder builder = new FragmentNavigator.Extras.Builder() final FragmentNavigator.Extras.Builder builder = new FragmentNavigator.Extras.Builder()
.addSharedElement(cover, "collection-" + topicCluster.getId()); .addSharedElement(cover, "collection-" + topicCluster.getCollectionId());
final SavedCollectionsFragmentDirections.ActionSavedCollectionsFragmentToCollectionPostsFragment action = SavedCollectionsFragmentDirections final SavedCollectionsFragmentDirections.ActionSavedCollectionsFragmentToCollectionPostsFragment action = SavedCollectionsFragmentDirections
.actionSavedCollectionsFragmentToCollectionPostsFragment(topicCluster, titleColor, backgroundColor); .actionSavedCollectionsFragmentToCollectionPostsFragment(topicCluster, titleColor, backgroundColor);
navController.navigate(action, builder.build()); navController.navigate(action, builder.build());

View File

@ -10,6 +10,7 @@ import androidx.lifecycle.Transformations.distinctUntilChanged
import androidx.lifecycle.Transformations.map import androidx.lifecycle.Transformations.map
import awais.instagrabber.R import awais.instagrabber.R
import awais.instagrabber.customviews.emoji.Emoji import awais.instagrabber.customviews.emoji.Emoji
import awais.instagrabber.models.enums.DirectItemType.Companion.getName
import awais.instagrabber.models.Resource import awais.instagrabber.models.Resource
import awais.instagrabber.models.Resource.Companion.error import awais.instagrabber.models.Resource.Companion.error
import awais.instagrabber.models.Resource.Companion.loading import awais.instagrabber.models.Resource.Companion.loading
@ -659,7 +660,7 @@ class ThreadManager private constructor(
data.postValue(error("item type is null", null)) data.postValue(error("item type is null", null))
return data return data
} }
val itemTypeName = itemType.getName() val itemTypeName = getName(itemType)
if (itemTypeName == null) { if (itemTypeName == null) {
Log.e(TAG, "forward: itemTypeName was null!") Log.e(TAG, "forward: itemTypeName was null!")
data.postValue(error("itemTypeName is null", null)) data.postValue(error("itemTypeName is null", null))

View File

@ -21,7 +21,7 @@ class Comment(
return hasLikedComment return hasLikedComment
} }
fun setLiked(liked: Boolean) { fun setLiked(hasLikedComment: Boolean) {
commentLikeCount = if (hasLikedComment) commentLikeCount + 1 else commentLikeCount - 1 commentLikeCount = if (hasLikedComment) commentLikeCount + 1 else commentLikeCount - 1
this.hasLikedComment = hasLikedComment this.hasLikedComment = hasLikedComment
} }

View File

@ -1,109 +0,0 @@
package awais.instagrabber.models.enums;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
public enum DirectItemType implements Serializable {
UNKNOWN(0),
@SerializedName("text")
TEXT(1),
@SerializedName("like")
LIKE(2),
@SerializedName("link")
LINK(3),
@SerializedName("media")
MEDIA(4),
@SerializedName("raven_media")
RAVEN_MEDIA(5),
@SerializedName("profile")
PROFILE(6),
@SerializedName("video_call_event")
VIDEO_CALL_EVENT(7),
@SerializedName("animated_media")
ANIMATED_MEDIA(8),
@SerializedName("voice_media")
VOICE_MEDIA(9),
@SerializedName("media_share")
MEDIA_SHARE(10),
@SerializedName("reel_share")
REEL_SHARE(11),
@SerializedName("action_log")
ACTION_LOG(12),
@SerializedName("placeholder")
PLACEHOLDER(13),
@SerializedName("story_share")
STORY_SHARE(14),
@SerializedName("clip")
CLIP(15), // media_share but reel
@SerializedName("felix_share")
FELIX_SHARE(16), // media_share but igtv
@SerializedName("location")
LOCATION(17),
@SerializedName("xma")
XMA(18); // self avatar stickers
private final int id;
private static final Map<Integer, DirectItemType> map = new HashMap<>();
static {
for (DirectItemType type : DirectItemType.values()) {
map.put(type.id, type);
}
}
DirectItemType(final int id) {
this.id = id;
}
public int getId() {
return id;
}
public static DirectItemType valueOf(final int id) {
if (!map.containsKey(id)) return DirectItemType.UNKNOWN;
return map.get(id);
}
public String getName() {
switch (this) {
case TEXT:
return "text";
case LIKE:
return "like";
case LINK:
return "link";
case MEDIA:
return "media";
case RAVEN_MEDIA:
return "raven_media";
case PROFILE:
return "profile";
case VIDEO_CALL_EVENT:
return "video_call_event";
case ANIMATED_MEDIA:
return "animated_media";
case VOICE_MEDIA:
return "voice_media";
case MEDIA_SHARE:
return "media_share";
case REEL_SHARE:
return "reel_share";
case ACTION_LOG:
return "action_log";
case PLACEHOLDER:
return "placeholder";
case STORY_SHARE:
return "story_share";
case CLIP:
return "clip";
case FELIX_SHARE:
return "felix_share";
case LOCATION:
return "location";
}
return null;
}
}

View File

@ -0,0 +1,85 @@
package awais.instagrabber.models.enums
import com.google.gson.annotations.SerializedName
import java.io.Serializable
import java.util.*
enum class DirectItemType(val id: Int) : Serializable {
UNKNOWN(0),
@SerializedName("text")
TEXT(1),
@SerializedName("like")
LIKE(2),
@SerializedName("link")
LINK(3),
@SerializedName("media")
MEDIA(4),
@SerializedName("raven_media")
RAVEN_MEDIA(5),
@SerializedName("profile")
PROFILE(6),
@SerializedName("video_call_event")
VIDEO_CALL_EVENT(7),
@SerializedName("animated_media")
ANIMATED_MEDIA(8),
@SerializedName("voice_media")
VOICE_MEDIA(9),
@SerializedName("media_share")
MEDIA_SHARE(10),
@SerializedName("reel_share")
REEL_SHARE(11),
@SerializedName("action_log")
ACTION_LOG(12),
@SerializedName("placeholder")
PLACEHOLDER(13),
@SerializedName("story_share")
STORY_SHARE(14),
@SerializedName("clip")
CLIP(15), // media_share but reel
@SerializedName("felix_share")
FELIX_SHARE(16), // media_share but igtv
@SerializedName("location")
LOCATION(17),
@SerializedName("xma")
XMA(18); // self avatar stickers
companion object {
private val map: MutableMap<Int, DirectItemType> = mutableMapOf()
@JvmStatic
fun getId(id: Int): DirectItemType? {
return map[id]
}
@JvmStatic
fun getName(directItemType: DirectItemType): String? {
when (directItemType) {
TEXT -> return "text"
LIKE -> return "like"
LINK -> return "link"
MEDIA -> return "media"
RAVEN_MEDIA -> return "raven_media"
PROFILE -> return "profile"
VIDEO_CALL_EVENT -> return "video_call_event"
ANIMATED_MEDIA -> return "animated_media"
VOICE_MEDIA -> return "voice_media"
MEDIA_SHARE -> return "media_share"
REEL_SHARE -> return "reel_share"
ACTION_LOG -> return "action_log"
PLACEHOLDER -> return "placeholder"
STORY_SHARE -> return "story_share"
CLIP -> return "clip"
FELIX_SHARE -> return "felix_share"
LOCATION -> return "location"
}
return null
}
init {
for (type in DirectItemType.values()) {
map[type.id] = type
}
}
}
}

View File

@ -1,8 +1,8 @@
package awais.instagrabber.models.enums; package awais.instagrabber.models.enums
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName
public enum RavenMediaViewMode { enum class RavenMediaViewMode {
@SerializedName("permanent") @SerializedName("permanent")
PERMANENT, PERMANENT,
@SerializedName("replayable") @SerializedName("replayable")

View File

@ -1,5 +0,0 @@
package awais.instagrabber.models.enums
enum class SuggestionType {
TYPE_USER, TYPE_HASHTAG, TYPE_LOCATION
}

View File

@ -1,29 +0,0 @@
package awais.instagrabber.repositories.responses.notification;
import awais.instagrabber.models.enums.NotificationType;
public class Notification {
private final NotificationArgs args;
private final int storyType;
private final String pk;
public Notification(final NotificationArgs args,
final int storyType,
final String pk) {
this.args = args;
this.storyType = storyType;
this.pk = pk;
}
public NotificationArgs getArgs() {
return args;
}
public NotificationType getType() {
return NotificationType.valueOfType(storyType);
}
public String getPk() {
return pk;
}
}

View File

@ -0,0 +1,11 @@
package awais.instagrabber.repositories.responses.notification
import awais.instagrabber.models.enums.NotificationType
import awais.instagrabber.models.enums.NotificationType.Companion.valueOfType
class Notification(val args: NotificationArgs,
private val storyType: Int,
val pk: String) {
val type: NotificationType?
get() = valueOfType(storyType)
}

View File

@ -1,55 +0,0 @@
package awais.instagrabber.repositories.responses.notification;
public class NotificationCounts {
private final int commentLikes;
private final int usertags;
private final int likes;
private final int comments;
private final int relationships;
private final int photosOfYou;
private final int requests;
public NotificationCounts(final int commentLikes,
final int usertags,
final int likes,
final int comments,
final int relationships,
final int photosOfYou,
final int requests) {
this.commentLikes = commentLikes;
this.usertags = usertags;
this.likes = likes;
this.comments = comments;
this.relationships = relationships;
this.photosOfYou = photosOfYou;
this.requests = requests;
}
public int getRelationshipsCount() {
return relationships;
}
public int getUserTagsCount() {
return usertags;
}
public int getCommentsCount() {
return comments;
}
public int getCommentLikesCount() {
return commentLikes;
}
public int getLikesCount() {
return likes;
}
public int getPOYCount() {
return photosOfYou;
}
public int getRequestsCount() {
return requests;
}
}

View File

@ -0,0 +1,9 @@
package awais.instagrabber.repositories.responses.notification
class NotificationCounts(val commentLikesCount: Int,
val userTagsCount: Int,
val likesCount: Int,
val commentsCount: Int,
val relationshipsCount: Int,
val pOYCount: Int,
val requestsCount: Int)

View File

@ -1,19 +0,0 @@
package awais.instagrabber.repositories.responses.notification;
public class NotificationImage {
private final String id;
private final String image;
public NotificationImage(final String id, final String image) {
this.id = id;
this.image = image;
}
public String getId() {
return id;
}
public String getImage() {
return image;
}
}

View File

@ -0,0 +1,3 @@
package awais.instagrabber.repositories.responses.notification
class NotificationImage(val id: String, val image: String)

View File

@ -1,50 +0,0 @@
package awais.instagrabber.repositories.responses.saved;
import java.util.List;
public class CollectionsListResponse {
private final boolean moreAvailable;
private final String nextMaxId;
private final String maxId;
private final String status;
// private final int numResults;
private final List<SavedCollection> items;
public CollectionsListResponse(final boolean moreAvailable,
final String nextMaxId,
final String maxId,
final String status,
// final int numResults,
final List<SavedCollection> items) {
this.moreAvailable = moreAvailable;
this.nextMaxId = nextMaxId;
this.maxId = maxId;
this.status = status;
// this.numResults = numResults;
this.items = items;
}
public boolean isMoreAvailable() {
return moreAvailable;
}
public String getNextMaxId() {
return nextMaxId;
}
public String getMaxId() {
return maxId;
}
public String getStatus() {
return status;
}
// public int getNumResults() {
// return numResults;
// }
public List<SavedCollection> getItems() {
return items;
}
}

View File

@ -0,0 +1,12 @@
package awais.instagrabber.repositories.responses.saved
class CollectionsListResponse // this.numResults = numResults;
(val isMoreAvailable: Boolean,
val nextMaxId: String,
val maxId: String,
val status: String, // final int numResults,
// public int getNumResults() {
// return numResults;
// }
// private final int numResults;
val items: List<SavedCollection>)

View File

@ -1,54 +0,0 @@
package awais.instagrabber.repositories.responses.saved;
import java.io.Serializable;
import java.util.List;
import awais.instagrabber.repositories.responses.Media;
public class SavedCollection implements Serializable {
private final String collectionId;
private final String collectionName;
private final String collectionType;
private final int collectionMediacount;
private final Media coverMedia;
private final List<Media> coverMediaList;
public SavedCollection(final String collectionId,
final String collectionName,
final String collectionType,
final int collectionMediacount,
final Media coverMedia,
final List<Media> coverMediaList) {
this.collectionId = collectionId;
this.collectionName = collectionName;
this.collectionType = collectionType;
this.collectionMediacount = collectionMediacount;
this.coverMedia = coverMedia;
this.coverMediaList = coverMediaList;
}
public String getId() {
return collectionId;
}
public String getTitle() {
return collectionName;
}
public String getType() {
return collectionType;
}
public int getMediaCount() {
return collectionMediacount;
}
// check the list first, then the single
// i have no idea what condition is required
public Media getCoverMedia() { return coverMedia; }
public List<Media> getCoverMedias() {
return coverMediaList;
}
}

View File

@ -0,0 +1,12 @@
package awais.instagrabber.repositories.responses.saved
import awais.instagrabber.repositories.responses.Media
import java.io.Serializable
class SavedCollection(val collectionId: String,
val collectionName: String,
val collectionType: String,
val collectionMediaCount: Int,
// coverMedia or coverMediaList: only one is defined
val coverMedia: Media,
val coverMediaList: List<Media>) : Serializable

View File

@ -1,46 +0,0 @@
package awais.instagrabber.repositories.responses.search;
import java.util.List;
public class SearchResponse {
// app
private final List<SearchItem> list;
// browser
private final List<SearchItem> users;
private final List<SearchItem> places;
private final List<SearchItem> hashtags;
// universal
private final String status;
public SearchResponse(final List<SearchItem> list,
final List<SearchItem> users,
final List<SearchItem> places,
final List<SearchItem> hashtags,
final String status) {
this.list = list;
this.users = users;
this.places = places;
this.hashtags = hashtags;
this.status = status;
}
public List<SearchItem> getList() {
return list;
}
public List<SearchItem> getUsers() {
return users;
}
public List<SearchItem> getPlaces() {
return places;
}
public List<SearchItem> getHashtags() {
return hashtags;
}
public String getStatus() {
return status;
}
}

View File

@ -0,0 +1,10 @@
package awais.instagrabber.repositories.responses.search
class SearchResponse(// app
val list: List<SearchItem>,
// browser
val users: List<SearchItem>,
val places: List<SearchItem>,
val hashtags: List<SearchItem>,
// universal
val status: String)