Browse Source
Merge remote-tracking branch 'origin/dm-notifications-enhancements' into dm-notifications-enhancements
renovate/org.robolectric-robolectric-4.x
Merge remote-tracking branch 'origin/dm-notifications-enhancements' into dm-notifications-enhancements
renovate/org.robolectric-robolectric-4.x
Ammar Githam
4 years ago
55 changed files with 676 additions and 903 deletions
-
4.github/ISSUE_TEMPLATE/ban_report.md
-
12.github/ISSUE_TEMPLATE/bug_report.md
-
6.github/ISSUE_TEMPLATE/questions.md
-
10app/build.gradle
-
2app/src/main/java/awais/instagrabber/adapters/DiscoverTopicsAdapter.java
-
2app/src/main/java/awais/instagrabber/adapters/NotificationsAdapter.java
-
57app/src/main/java/awais/instagrabber/adapters/PostsMediaAdapter.java
-
4app/src/main/java/awais/instagrabber/adapters/viewholder/FeedStoryViewHolder.java
-
10app/src/main/java/awais/instagrabber/adapters/viewholder/NotificationViewHolder.java
-
29app/src/main/java/awais/instagrabber/adapters/viewholder/PostMediaViewHolder.java
-
2app/src/main/java/awais/instagrabber/adapters/viewholder/TopicClusterViewHolder.java
-
2app/src/main/java/awais/instagrabber/asyncs/CreateThreadAction.java
-
3app/src/main/java/awais/instagrabber/asyncs/LocationFetcher.java
-
252app/src/main/java/awais/instagrabber/asyncs/direct_messages/DirectThreadBroadcaster.java
-
7app/src/main/java/awais/instagrabber/customviews/CircularImageView.java
-
11app/src/main/java/awais/instagrabber/fragments/HashTagFragment.java
-
82app/src/main/java/awais/instagrabber/fragments/LocationFragment.java
-
12app/src/main/java/awais/instagrabber/fragments/NotificationsViewerFragment.java
-
8app/src/main/java/awais/instagrabber/fragments/StoryListViewerFragment.java
-
332app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java
-
2app/src/main/java/awais/instagrabber/fragments/TopicPostsFragment.java
-
2app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java
-
31app/src/main/java/awais/instagrabber/fragments/main/FeedFragment.java
-
2app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java
-
14app/src/main/java/awais/instagrabber/models/FeedStoryModel.java
-
13app/src/main/java/awais/instagrabber/models/LocationModel.java
-
9app/src/main/java/awais/instagrabber/models/NotificationModel.java
-
5app/src/main/java/awais/instagrabber/models/enums/MediaItemType.java
-
2app/src/main/java/awais/instagrabber/repositories/LocationRepository.java
-
2app/src/main/java/awais/instagrabber/repositories/MediaRepository.java
-
2app/src/main/java/awais/instagrabber/repositories/StoriesRepository.java
-
93app/src/main/java/awais/instagrabber/repositories/requests/StoryViewerOptions.java
-
2app/src/main/java/awais/instagrabber/repositories/responses/discover/TopicCluster.java
-
2app/src/main/java/awais/instagrabber/repositories/responses/discover/TopicalExploreFeedResponse.java
-
29app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java
-
55app/src/main/java/awais/instagrabber/utils/TextUtils.java
-
5app/src/main/java/awais/instagrabber/utils/Utils.java
-
2app/src/main/java/awais/instagrabber/viewmodels/TopicClusterViewModel.java
-
2app/src/main/java/awais/instagrabber/webservices/GraphQLService.java
-
2app/src/main/java/awais/instagrabber/webservices/LocationService.java
-
2app/src/main/java/awais/instagrabber/webservices/MediaService.java
-
17app/src/main/java/awais/instagrabber/webservices/NewsService.java
-
135app/src/main/java/awais/instagrabber/webservices/StoriesService.java
-
12app/src/main/res/layout/layout_location_details.xml
-
4app/src/main/res/navigation/direct_messages_nav_graph.xml
-
2app/src/main/res/navigation/discover_nav_graph.xml
-
31app/src/main/res/navigation/feed_nav_graph.xml
-
31app/src/main/res/navigation/hashtag_nav_graph.xml
-
31app/src/main/res/navigation/location_nav_graph.xml
-
31app/src/main/res/navigation/notification_viewer_nav_graph.xml
-
86app/src/main/res/navigation/profile_nav_graph.xml
-
31app/src/main/res/navigation/story_list_nav_graph.xml
-
38app/src/main/res/navigation/user_search_nav_graph.xml
-
2app/src/main/res/values/strings.xml
-
3fastlane/metadata/android/en-US/changelogs/57.txt
@ -1,57 +0,0 @@ |
|||
// package awais.instagrabber.adapters; |
|||
// |
|||
// import android.view.LayoutInflater; |
|||
// import android.view.View; |
|||
// import android.view.ViewGroup; |
|||
// |
|||
// import androidx.annotation.NonNull; |
|||
// import androidx.recyclerview.widget.RecyclerView; |
|||
// |
|||
// import awais.instagrabber.R; |
|||
// import awais.instagrabber.adapters.viewholder.PostMediaViewHolder; |
|||
// import awais.instagrabber.databinding.ItemChildPostBinding; |
|||
// import awais.instagrabber.models.BasePostModel; |
|||
// import awais.instagrabber.models.ViewerPostModel; |
|||
// |
|||
// public final class PostsMediaAdapter extends RecyclerView.Adapter<PostMediaViewHolder> { |
|||
// private final View.OnClickListener clickListener; |
|||
// private ViewerPostModel[] postModels; |
|||
// |
|||
// public PostsMediaAdapter(final ViewerPostModel[] postModels, final View.OnClickListener clickListener) { |
|||
// this.postModels = postModels; |
|||
// this.clickListener = clickListener; |
|||
// } |
|||
// |
|||
// @NonNull |
|||
// @Override |
|||
// public PostMediaViewHolder onCreateViewHolder(@NonNull final ViewGroup parent, final int viewType) { |
|||
// final LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext()); |
|||
// layoutInflater.inflate(R.layout.item_child_post, parent, false); |
|||
// final ItemChildPostBinding binding = ItemChildPostBinding.inflate(layoutInflater, parent, false); |
|||
// return new PostMediaViewHolder(binding); |
|||
// } |
|||
// |
|||
// @Override |
|||
// public void onBindViewHolder(@NonNull final PostMediaViewHolder holder, final int position) { |
|||
// final ViewerPostModel postModel = postModels[position]; |
|||
// holder.bind(postModel, position, clickListener); |
|||
// } |
|||
// |
|||
// public void setData(final ViewerPostModel[] postModels) { |
|||
// this.postModels = postModels; |
|||
// notifyDataSetChanged(); |
|||
// } |
|||
// |
|||
// public ViewerPostModel getItemAt(final int position) { |
|||
// return postModels == null ? null : postModels[position]; |
|||
// } |
|||
// |
|||
// @Override |
|||
// public int getItemCount() { |
|||
// return postModels == null ? 0 : postModels.length; |
|||
// } |
|||
// |
|||
// public BasePostModel[] getPostModels() { |
|||
// return postModels; |
|||
// } |
|||
// } |
@ -1,29 +0,0 @@ |
|||
// package awais.instagrabber.adapters.viewholder; |
|||
// |
|||
// import android.view.View; |
|||
// |
|||
// import androidx.annotation.NonNull; |
|||
// import androidx.recyclerview.widget.RecyclerView; |
|||
// |
|||
// import awais.instagrabber.databinding.ItemChildPostBinding; |
|||
// import awais.instagrabber.models.ViewerPostModel; |
|||
// |
|||
// public final class PostMediaViewHolder extends RecyclerView.ViewHolder { |
|||
// |
|||
// private final ItemChildPostBinding binding; |
|||
// |
|||
// public PostMediaViewHolder(@NonNull final ItemChildPostBinding binding) { |
|||
// super(binding.getRoot()); |
|||
// this.binding = binding; |
|||
// } |
|||
// |
|||
// public void bind(final ViewerPostModel model, final int position, final View.OnClickListener clickListener) { |
|||
// if (model == null) return; |
|||
// // model.setPosition(position); |
|||
// itemView.setTag(model); |
|||
// itemView.setOnClickListener(clickListener); |
|||
// binding.selectedView.setVisibility(model.isCurrentSlide() ? View.VISIBLE : View.GONE); |
|||
// binding.isDownloaded.setVisibility(model.isDownloaded() ? View.VISIBLE : View.GONE); |
|||
// binding.icon.setImageURI(model.getDisplayUrl()); |
|||
// } |
|||
// } |
@ -1,4 +1,4 @@ |
|||
package awais.instagrabber.asyncs.direct_messages; |
|||
package awais.instagrabber.asyncs; |
|||
|
|||
import android.os.AsyncTask; |
|||
import android.util.Log; |
@ -1,252 +0,0 @@ |
|||
// package awais.instagrabber.asyncs.direct_messages; |
|||
// |
|||
// import android.os.AsyncTask; |
|||
// import android.util.Log; |
|||
// |
|||
// import org.json.JSONObject; |
|||
// |
|||
// import java.io.BufferedReader; |
|||
// import java.io.DataOutputStream; |
|||
// import java.io.IOException; |
|||
// import java.io.InputStreamReader; |
|||
// import java.net.HttpURLConnection; |
|||
// import java.net.URL; |
|||
// import java.util.HashMap; |
|||
// import java.util.Map; |
|||
// import java.util.UUID; |
|||
// |
|||
// import awais.instagrabber.repositories.requests.directmessages.BroadcastOptions; |
|||
// import awais.instagrabber.repositories.responses.directmessages.DirectThreadBroadcastResponse; |
|||
// import awais.instagrabber.utils.Constants; |
|||
// import awais.instagrabber.utils.CookieUtils; |
|||
// import awais.instagrabber.utils.Utils; |
|||
// |
|||
// import static awais.instagrabber.utils.Utils.settingsHelper; |
|||
// |
|||
// public class DirectThreadBroadcaster extends AsyncTask<BroadcastOptions, Void, DirectThreadBroadcastResponse> { |
|||
// private static final String TAG = "DirectThreadBroadcaster"; |
|||
// |
|||
// private final String threadId; |
|||
// |
|||
// private OnBroadcastCompleteListener listener; |
|||
// |
|||
// public DirectThreadBroadcaster(String threadId) { |
|||
// this.threadId = threadId; |
|||
// } |
|||
// |
|||
// @Override |
|||
// protected DirectThreadBroadcastResponse doInBackground(final BroadcastOptions... broadcastOptionsArray) { |
|||
// if (broadcastOptionsArray == null || broadcastOptionsArray.length == 0 || broadcastOptionsArray[0] == null) { |
|||
// return null; |
|||
// } |
|||
// final BroadcastOptions broadcastOptions = broadcastOptionsArray[0]; |
|||
// final String cookie = settingsHelper.getString(Constants.COOKIE); |
|||
// final String cc = UUID.randomUUID().toString(); |
|||
// final Map<String, String> form = new HashMap<>(); |
|||
// form.put("_csrftoken", CookieUtils.getCsrfTokenFromCookie(cookie)); |
|||
// form.put("_uid", CookieUtils.getUserIdFromCookie(cookie)); |
|||
// form.put("__uuid", settingsHelper.getString(Constants.DEVICE_UUID)); |
|||
// form.put("client_context", cc); |
|||
// form.put("mutation_token", cc); |
|||
// form.putAll(broadcastOptions.getFormMap()); |
|||
// form.put("thread_id", threadId); |
|||
// form.put("action", "send_item"); |
|||
// final String message = new JSONObject(form).toString(); |
|||
// final String content = Utils.sign(message); |
|||
// final String url = "https://i.instagram.com/api/v1/direct_v2/threads/broadcast/" + broadcastOptions.getItemType().getValue() + "/"; |
|||
// HttpURLConnection connection = null; |
|||
// DataOutputStream outputStream = null; |
|||
// BufferedReader r = null; |
|||
// try { |
|||
// connection = (HttpURLConnection) new URL(url).openConnection(); |
|||
// connection.setRequestMethod("POST"); |
|||
// connection.setRequestProperty("User-Agent", Constants.I_USER_AGENT); |
|||
// connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); |
|||
// if (content != null) { |
|||
// connection.setRequestProperty("Content-Length", "" + content.getBytes().length); |
|||
// } |
|||
// connection.setUseCaches(false); |
|||
// connection.setDoOutput(true); |
|||
// outputStream = new DataOutputStream(connection.getOutputStream()); |
|||
// outputStream.writeBytes(content); |
|||
// outputStream.flush(); |
|||
// final int responseCode = connection.getResponseCode(); |
|||
// if (responseCode != HttpURLConnection.HTTP_OK) { |
|||
// Log.d(TAG, responseCode + ": " + content + ": " + cookie); |
|||
// return new DirectThreadBroadcastResponse(responseCode, null); |
|||
// } |
|||
// r = new BufferedReader(new InputStreamReader(connection.getInputStream())); |
|||
// final StringBuilder builder = new StringBuilder(); |
|||
// for (String line = r.readLine(); line != null; line = r.readLine()) { |
|||
// if (builder.length() != 0) { |
|||
// builder.append("\n"); |
|||
// } |
|||
// builder.append(line); |
|||
// } |
|||
// return new DirectThreadBroadcastResponse(responseCode, new JSONObject(builder.toString())); |
|||
// } catch (Exception e) { |
|||
// Log.e(TAG, "Error", e); |
|||
// } finally { |
|||
// if (r != null) { |
|||
// try { |
|||
// r.close(); |
|||
// } catch (IOException ignored) { |
|||
// } |
|||
// } |
|||
// if (outputStream != null) { |
|||
// try { |
|||
// outputStream.close(); |
|||
// } catch (IOException ignored) { |
|||
// } |
|||
// } |
|||
// if (connection != null) { |
|||
// connection.disconnect(); |
|||
// } |
|||
// } |
|||
// return null; |
|||
// } |
|||
// |
|||
// @Override |
|||
// protected void onPostExecute(final DirectThreadBroadcastResponse result) { |
|||
// if (listener != null) { |
|||
// listener.onTaskComplete(result); |
|||
// } |
|||
// } |
|||
// |
|||
// public void setOnTaskCompleteListener(final OnBroadcastCompleteListener listener) { |
|||
// if (listener != null) { |
|||
// this.listener = listener; |
|||
// } |
|||
// } |
|||
// |
|||
// public interface OnBroadcastCompleteListener { |
|||
// void onTaskComplete(DirectThreadBroadcastResponse response); |
|||
// } |
|||
// |
|||
// public enum ItemType { |
|||
// TEXT("text"), |
|||
// REACTION("reaction"), |
|||
// REELSHARE("reel_share"), |
|||
// IMAGE("configure_photo"); |
|||
// |
|||
// private final String value; |
|||
// |
|||
// ItemType(final String value) { |
|||
// this.value = value; |
|||
// } |
|||
// |
|||
// public String getValue() { |
|||
// return value; |
|||
// } |
|||
// } |
|||
// |
|||
// public static abstract class BroadcastOptions { |
|||
// private final ItemType itemType; |
|||
// |
|||
// public BroadcastOptions(final ItemType itemType) { |
|||
// this.itemType = itemType; |
|||
// } |
|||
// |
|||
// public ItemType getItemType() { |
|||
// return itemType; |
|||
// } |
|||
// |
|||
// abstract Map<String, String> getFormMap(); |
|||
// } |
|||
// |
|||
// public static class TextBroadcastOptions extends BroadcastOptions { |
|||
// private final String text; |
|||
// |
|||
// public TextBroadcastOptions(String text) throws UnsupportedEncodingException { |
|||
// super(ItemType.TEXT); |
|||
// this.text = URLEncoder.encode(text, "UTF-8") |
|||
// .replaceAll("\\+", "%20").replaceAll("%21", "!").replaceAll("%27", "'").replaceAll("%22", "\\\"") |
|||
// .replaceAll("%28", "(").replaceAll("%29", ")").replaceAll("%7E", "~").replaceAll("%0A", "\n"); |
|||
// } |
|||
// |
|||
// @Override |
|||
// Map<String, String> getFormMap() { |
|||
// return Collections.singletonMap("text", text); |
|||
// } |
|||
// } |
|||
// |
|||
// public static class ReactionBroadcastOptions extends BroadcastOptions { |
|||
// private final String itemId; |
|||
// private final boolean delete; |
|||
// |
|||
// public ReactionBroadcastOptions(String itemId, boolean delete) { |
|||
// super(ItemType.REACTION); |
|||
// this.itemId = itemId; |
|||
// this.delete = delete; |
|||
// } |
|||
// |
|||
// @Override |
|||
// Map<String, String> getFormMap() { |
|||
// final Map<String, String> form = new HashMap<>(); |
|||
// form.put("item_id", itemId); |
|||
// form.put("reaction_status", delete ? "deleted" : "created"); |
|||
// form.put("reaction_type", "like"); |
|||
// return form; |
|||
// } |
|||
// } |
|||
// |
|||
// public static class StoryReplyBroadcastOptions extends BroadcastOptions { |
|||
// private final String text, mediaId, reelId; |
|||
// |
|||
// public StoryReplyBroadcastOptions(String text, String mediaId, String reelId) throws UnsupportedEncodingException { |
|||
// super(ItemType.REELSHARE); |
|||
// this.text = URLEncoder.encode(text, "UTF-8") |
|||
// .replaceAll("\\+", "%20").replaceAll("%21", "!").replaceAll("%27", "'") |
|||
// .replaceAll("%28", "(").replaceAll("%29", ")").replaceAll("%7E", "~").replaceAll("%0A", "\n"); |
|||
// this.mediaId = mediaId; |
|||
// this.reelId = reelId; // or user id, usually same |
|||
// } |
|||
// |
|||
// @Override |
|||
// Map<String, String> getFormMap() { |
|||
// final Map<String, String> form = new HashMap<>(); |
|||
// form.put("text", text); |
|||
// form.put("media_id", mediaId); |
|||
// form.put("reel_id", reelId); |
|||
// form.put("entry", "reel"); |
|||
// return form; |
|||
// } |
|||
// } |
|||
// |
|||
// public static class ImageBroadcastOptions extends BroadcastOptions { |
|||
// final boolean allowFullAspectRatio; |
|||
// final String uploadId; |
|||
// |
|||
// public ImageBroadcastOptions(final boolean allowFullAspectRatio, final String uploadId) { |
|||
// super(ItemType.IMAGE); |
|||
// this.allowFullAspectRatio = allowFullAspectRatio; |
|||
// this.uploadId = uploadId; |
|||
// } |
|||
// |
|||
// @Override |
|||
// Map<String, String> getFormMap() { |
|||
// final Map<String, String> form = new HashMap<>(); |
|||
// form.put("allow_full_aspect_ratio", String.valueOf(allowFullAspectRatio)); |
|||
// form.put("upload_id", uploadId); |
|||
// return form; |
|||
// } |
|||
// } |
|||
// |
|||
// public static class DirectThreadBroadcastResponse { |
|||
// private final int responseCode; |
|||
// private final JSONObject response; |
|||
// |
|||
// public DirectThreadBroadcastResponse(int responseCode, JSONObject response) { |
|||
// this.responseCode = responseCode; |
|||
// this.response = response; |
|||
// } |
|||
// |
|||
// public int getResponseCode() { |
|||
// return responseCode; |
|||
// } |
|||
// |
|||
// public JSONObject getResponse() { |
|||
// return response; |
|||
// } |
|||
// } |
|||
// } |
@ -0,0 +1,93 @@ |
|||
package awais.instagrabber.repositories.requests; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
public class StoryViewerOptions implements Serializable { |
|||
private final long id; |
|||
private final String name; |
|||
private final Type type; |
|||
private int currentFeedStoryIndex; |
|||
|
|||
private StoryViewerOptions(final int position, final Type type) { |
|||
id = 0; |
|||
name = null; |
|||
this.currentFeedStoryIndex = position; |
|||
this.type = type; |
|||
} |
|||
|
|||
private StoryViewerOptions(final String name, final Type type) { |
|||
this.name = name; |
|||
this.id = 0; |
|||
this.type = type; |
|||
} |
|||
|
|||
private StoryViewerOptions(final long id, final Type type) { |
|||
this.name = null; |
|||
this.id = id; |
|||
this.type = type; |
|||
} |
|||
|
|||
private StoryViewerOptions(final long id, final String name, final Type type) { |
|||
this.id = id; |
|||
this.name = name; |
|||
this.type = type; |
|||
} |
|||
|
|||
public static StoryViewerOptions forHashtag(final String name) { |
|||
return new StoryViewerOptions(name, Type.HASHTAG); |
|||
} |
|||
|
|||
public static StoryViewerOptions forLocation(final long id, final String name) { |
|||
return new StoryViewerOptions(id, name, Type.LOCATION); |
|||
} |
|||
|
|||
public static StoryViewerOptions forUser(final long id, final String name) { |
|||
return new StoryViewerOptions(id, name,Type.USER); |
|||
} |
|||
|
|||
public static StoryViewerOptions forHighlight(final String highlight) { |
|||
return new StoryViewerOptions(highlight, Type.HIGHLIGHT); |
|||
} |
|||
|
|||
public static StoryViewerOptions forStory(final long mediaId, final String username) { |
|||
return new StoryViewerOptions(mediaId, username, Type.STORY); |
|||
} |
|||
|
|||
public static StoryViewerOptions forFeedStoryPosition(final int position) { |
|||
return new StoryViewerOptions(position, Type.FEED_STORY_POSITION); |
|||
} |
|||
|
|||
public static StoryViewerOptions forStoryArchive(final int position) { |
|||
return new StoryViewerOptions(position, Type.STORY_ARCHIVE); |
|||
} |
|||
|
|||
public long getId() { |
|||
return id; |
|||
} |
|||
|
|||
public String getName() { |
|||
return name; |
|||
} |
|||
|
|||
public Type getType() { |
|||
return type; |
|||
} |
|||
|
|||
public int getCurrentFeedStoryIndex() { |
|||
return currentFeedStoryIndex; |
|||
} |
|||
|
|||
public void setCurrentFeedStoryIndex(final int index) { |
|||
this.currentFeedStoryIndex = index; |
|||
} |
|||
|
|||
public enum Type { |
|||
HASHTAG, |
|||
LOCATION, |
|||
USER, |
|||
HIGHLIGHT, |
|||
STORY, |
|||
FEED_STORY_POSITION, |
|||
STORY_ARCHIVE |
|||
} |
|||
} |
@ -1,4 +1,4 @@ |
|||
package awais.instagrabber.models; |
|||
package awais.instagrabber.repositories.responses.discover; |
|||
|
|||
import java.io.Serializable; |
|||
|
@ -0,0 +1,3 @@ |
|||
Preliminary support for live videos, as well as bug fixes. |
|||
|
|||
For details see https://github.com/austinhuang0131/barinsta/releases/tag/v19.0.5 |
Write
Preview
Loading…
Cancel
Save
Reference in new issue