mirror of
https://github.com/KokaKiwi/BarInsta
synced 2026-03-04 11:31:35 +00:00
Merge branch 'master' into task/update-feed-view
This commit is contained in:
commit
ac8481f247
26 changed files with 425 additions and 107 deletions
|
|
@ -119,21 +119,25 @@ public final class CommentsViewer extends BaseLanguageActivity implements SwipeR
|
|||
} else if (which == 3) {
|
||||
Utils.copyText(this, commentModel.getText().toString());
|
||||
} else if (which == 4) {
|
||||
focus = commentsBinding.rvComments.findViewWithTag(commentModel);
|
||||
focus.setBackgroundColor(0x80888888);
|
||||
commentsBinding.commentCancelParent.setVisibility(View.VISIBLE);
|
||||
String mention = "@"+profileModel.getUsername()+" ";
|
||||
commentsBinding.commentText.setText(mention);
|
||||
commentsBinding.commentText.requestFocus();
|
||||
commentsBinding.commentText.setSelection(mention.length());
|
||||
commentsBinding.commentText.postDelayed(new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
imm = (InputMethodManager) getSystemService(getApplicationContext().INPUT_METHOD_SERVICE);
|
||||
imm.showSoftInput(commentsBinding.commentText, 0);
|
||||
}
|
||||
if (commentModel == null) {
|
||||
Toast.makeText(getApplicationContext(), R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
else {
|
||||
focus = commentsBinding.rvComments.findViewWithTag(commentModel);
|
||||
focus.setBackgroundColor(0x80888888);
|
||||
commentsBinding.commentCancelParent.setVisibility(View.VISIBLE);
|
||||
String mention = "@" + profileModel.getUsername() + " ";
|
||||
commentsBinding.commentText.setText(mention);
|
||||
commentsBinding.commentText.requestFocus();
|
||||
commentsBinding.commentText.setSelection(mention.length());
|
||||
commentsBinding.commentText.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
imm = (InputMethodManager) getSystemService(getApplicationContext().INPUT_METHOD_SERVICE);
|
||||
imm.showSoftInput(commentsBinding.commentText, 0);
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
,200);
|
||||
} else if (which == 5) {
|
||||
new CommentAction().execute((commentModel.getLiked() ? "unlike/" : "like/")+commentModel.getId());
|
||||
} else if (which == 6) {
|
||||
|
|
|
|||
|
|
@ -222,11 +222,9 @@ public final class PostViewer extends BaseLanguageActivity {
|
|||
viewerBinding.bottomPanel.commentsCount.setText(String.valueOf(commentsCount));
|
||||
viewerBinding.bottomPanel.btnComments.setVisibility(View.VISIBLE);
|
||||
|
||||
postShortCode = result[0].getShortCode();
|
||||
|
||||
viewerBinding.bottomPanel.btnComments.setOnClickListener(v ->
|
||||
startActivityForResult(new Intent(this, CommentsViewer.class)
|
||||
.putExtra(Constants.EXTRAS_SHORTCODE, postShortCode)
|
||||
.putExtra(Constants.EXTRAS_SHORTCODE, postModel.getShortCode())
|
||||
.putExtra(Constants.EXTRAS_POST, viewerPostModel.getPostId())
|
||||
.putExtra(Constants.EXTRAS_USER, postUserId), 6969));
|
||||
viewerBinding.bottomPanel.btnComments.setClickable(true);
|
||||
|
|
@ -243,7 +241,8 @@ public final class PostViewer extends BaseLanguageActivity {
|
|||
}
|
||||
}
|
||||
|
||||
setupPostInfoBar("@" + viewerPostModel.getUsername(), viewerPostModel.getItemType(), viewerPostModel.getLocation());
|
||||
setupPostInfoBar("@" + viewerPostModel.getUsername(), viewerPostModel.getItemType(),
|
||||
viewerPostModel.getLocationName(), viewerPostModel.getLocation());
|
||||
|
||||
postCaption = postModel.getPostCaption();
|
||||
viewerCaptionParent.setVisibility(View.VISIBLE);
|
||||
|
|
@ -302,7 +301,7 @@ public final class PostViewer extends BaseLanguageActivity {
|
|||
|
||||
final boolean postIdNull = postModel.getPostId() == null;
|
||||
if (!postIdNull)
|
||||
setupPostInfoBar(intent.getStringExtra(Constants.EXTRAS_USER), postModel.getItemType(), null);
|
||||
setupPostInfoBar(intent.getStringExtra(Constants.EXTRAS_USER), postModel.getItemType(), null, null);
|
||||
|
||||
isFromShare = postModel.getPosition() == -1 || postIdNull;
|
||||
|
||||
|
|
@ -583,9 +582,9 @@ public final class PostViewer extends BaseLanguageActivity {
|
|||
viewerBinding.bottomPanel.viewerCaption.setMentionClickListener(null);
|
||||
viewerBinding.bottomPanel.viewerCaption.setText(postCaption);
|
||||
}
|
||||
|
||||
|
||||
setupPostInfoBar("@" + viewerPostModel.getUsername(), viewerPostModel.getItemType(),
|
||||
viewerPostModel.getLocation());
|
||||
viewerPostModel.getLocationName(), viewerPostModel.getLocation());
|
||||
|
||||
if (postModel instanceof PostModel) {
|
||||
final PostModel postModel = (PostModel) this.postModel;
|
||||
|
|
@ -633,7 +632,7 @@ public final class PostViewer extends BaseLanguageActivity {
|
|||
}
|
||||
}
|
||||
|
||||
private void setupPostInfoBar(final String from, final MediaItemType mediaItemType, final JSONObject location) {
|
||||
private void setupPostInfoBar(final String from, final MediaItemType mediaItemType, final String locationName, final String location) {
|
||||
if (prevUsername == null || !prevUsername.equals(from)) {
|
||||
// viewerBinding.topPanel.ivProfilePic.setImageBitmap(null);
|
||||
// viewerBinding.topPanel.ivProfilePic.setImageDrawable(null);
|
||||
|
|
@ -708,8 +707,8 @@ public final class PostViewer extends BaseLanguageActivity {
|
|||
));
|
||||
} else {
|
||||
viewerBinding.topPanel.location.setVisibility(View.VISIBLE);
|
||||
viewerBinding.topPanel.location.setText(location.optString("name"));
|
||||
viewerBinding.topPanel.location.setOnClickListener(v -> searchUsername(location.optString("id") + "/" + location.optString("slug")));
|
||||
viewerBinding.topPanel.location.setText(locationName);
|
||||
viewerBinding.topPanel.location.setOnClickListener(v -> searchUsername(location));
|
||||
viewerBinding.topPanel.title.setLayoutParams(new RelativeLayout.LayoutParams(
|
||||
RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT
|
||||
));
|
||||
|
|
|
|||
|
|
@ -106,7 +106,8 @@ public final class DirectMessageItemsAdapter extends ListAdapter<DirectItemModel
|
|||
final LayoutDmRavenMediaBinding binding = LayoutDmRavenMediaBinding.inflate(layoutInflater, itemViewParent, false);
|
||||
return new DirectMessageReelShareViewHolder(baseBinding, binding, onClickListener, mentionClickListener);
|
||||
}
|
||||
case MEDIA_SHARE: {
|
||||
case MEDIA_SHARE:
|
||||
case CLIP: {
|
||||
final LayoutDmMediaShareBinding binding = LayoutDmMediaShareBinding.inflate(layoutInflater, itemViewParent, false);
|
||||
return new DirectMessageMediaShareViewHolder(baseBinding, binding, onClickListener);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ public final class DirectMessageInboxItemViewHolder extends RecyclerView.ViewHol
|
|||
case MEDIA:
|
||||
case MEDIA_SHARE:
|
||||
case RAVEN_MEDIA:
|
||||
case CLIP:
|
||||
messageText = context.getString(R.string.direct_messages_sent_media);
|
||||
break;
|
||||
case ACTION_LOG:
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ public final class CommentsFetcher extends AsyncTask<Void, Void, CommentModel[]>
|
|||
|
||||
String endCursor = "";
|
||||
while (endCursor != null) {
|
||||
final String url = "https://www.instagram.com/graphql/query/?query_hash=97b41c52301f77ce508f55e66d17620e&variables=" +
|
||||
final String url = "https://www.instagram.com/graphql/query/?query_hash=bc3296d1ce80a24b1b6e40b1e72903f5&variables=" +
|
||||
"{\"shortcode\":\"" + shortCode + "\",\"first\":50,\"after\":\"" + endCursor + "\"}";
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -164,7 +164,10 @@ public final class FeedFetcher extends AsyncTask<Void, Void, FeedModel[]> {
|
|||
null, null, null,
|
||||
node.optLong("video_view_count", -1), -1, false, false,
|
||||
feedItem.getJSONObject("edge_media_preview_like").getLong("count"),
|
||||
feedItem.optJSONObject("location"));
|
||||
feedItem.isNull("location") ? null : feedItem.getJSONObject("location").optString("name"),
|
||||
feedItem.isNull("location") ? null :
|
||||
(feedItem.getJSONObject("location").optString("id") + "/" +
|
||||
feedItem.getJSONObject("location").optString("slug")));
|
||||
|
||||
sliderItems[j].setSliderDisplayUrl(node.getString("display_url"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,7 +95,10 @@ public final class PostFetcher extends AsyncTask<Void, Void, ViewerPostModel[]>
|
|||
isVideo && media.has("video_view_count") ? media.getLong("video_view_count") : -1,
|
||||
timestamp, media.getBoolean("viewer_has_liked"), media.getBoolean("viewer_has_saved"),
|
||||
media.getJSONObject("edge_media_preview_like").getLong("count"),
|
||||
media.optJSONObject("location"));
|
||||
media.isNull("location") ? null : media.getJSONObject("location").optString("name"),
|
||||
media.isNull("location") ? null :
|
||||
(media.getJSONObject("location").optString("id") + "/" +
|
||||
media.getJSONObject("location").optString("slug")));
|
||||
|
||||
postModel.setCommentsCount(commentsCount);
|
||||
|
||||
|
|
@ -120,7 +123,10 @@ public final class PostFetcher extends AsyncTask<Void, Void, ViewerPostModel[]>
|
|||
isChildVideo && node.has("video_view_count") ? node.getLong("video_view_count") : -1,
|
||||
timestamp, media.getBoolean("viewer_has_liked"), media.getBoolean("viewer_has_saved"),
|
||||
media.getJSONObject("edge_media_preview_like").getLong("count"),
|
||||
media.optJSONObject("location"));
|
||||
media.isNull("location") ? null : media.getJSONObject("location").optString("name"),
|
||||
media.isNull("location") ? null :
|
||||
(media.getJSONObject("location").optString("id") + "/" +
|
||||
media.getJSONObject("location").optString("slug")));
|
||||
postModels[i].setSliderDisplayUrl(node.getString("display_url"));
|
||||
|
||||
Utils.checkExistence(downloadDir, customDir, true, postModels[i]);
|
||||
|
|
|
|||
|
|
@ -87,7 +87,10 @@ public final class iPostFetcher extends AsyncTask<Void, Void, ViewerPostModel[]>
|
|||
isVideo && media.has("view_count") ? media.getLong("view_count") : -1,
|
||||
timestamp, media.optBoolean("has_liked"), media.optBoolean("has_viewer_saved"),
|
||||
media.getLong("like_count"),
|
||||
media.optJSONObject("location"));
|
||||
media.isNull("location") ? null : media.getJSONObject("location").optString("name"),
|
||||
media.isNull("location") ? null :
|
||||
(media.getJSONObject("location").optString("id") + "/" +
|
||||
media.getJSONObject("location").optString("slug")));
|
||||
|
||||
postModel.setCommentsCount(commentsCount);
|
||||
|
||||
|
|
@ -114,7 +117,10 @@ public final class iPostFetcher extends AsyncTask<Void, Void, ViewerPostModel[]>
|
|||
-1,
|
||||
timestamp, media.optBoolean("has_liked"), media.optBoolean("has_viewer_saved"),
|
||||
media.getLong("like_count"),
|
||||
media.optJSONObject("location"));
|
||||
media.isNull("location") ? null : media.getJSONObject("location").optString("name"),
|
||||
media.isNull("location") ? null :
|
||||
(media.getJSONObject("location").optString("id") + "/" +
|
||||
media.getJSONObject("location").optString("slug")));
|
||||
postModels[i].setSliderDisplayUrl(Utils.getHighQualityImage(node));
|
||||
|
||||
Utils.checkExistence(downloadDir, customDir, true, postModels[i]);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@ import awais.instagrabber.models.enums.MediaItemType;
|
|||
import awais.instagrabber.models.stickers.PollModel;
|
||||
import awais.instagrabber.models.stickers.QuestionModel;
|
||||
import awais.instagrabber.models.stickers.QuizModel;
|
||||
import awais.instagrabber.models.stickers.SwipeUpModel;
|
||||
import awais.instagrabber.utils.Constants;
|
||||
import awais.instagrabber.utils.LocaleUtils;
|
||||
import awais.instagrabber.utils.Utils;
|
||||
import awaisomereport.LogCollector;
|
||||
|
||||
|
|
@ -84,6 +86,7 @@ public final class iStoryStatusFetcher extends AsyncTask<Void, Void, StoryModel[
|
|||
conn.setInstanceFollowRedirects(true);
|
||||
conn.setUseCaches(false);
|
||||
conn.setRequestProperty("User-Agent", storiesig ? Constants.A_USER_AGENT : Constants.I_USER_AGENT);
|
||||
conn.setRequestProperty("Accept-Language", LocaleUtils.getCurrentLocale().getLanguage() + ",en-US;q=0.8");
|
||||
conn.connect();
|
||||
|
||||
if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
|
||||
|
|
@ -121,6 +124,7 @@ public final class iStoryStatusFetcher extends AsyncTask<Void, Void, StoryModel[
|
|||
models[i].setTappableShortCode(data.getJSONArray("story_feed_media").getJSONObject(0).optString("media_id"));
|
||||
}
|
||||
|
||||
// assuming everything is spotify
|
||||
if (!data.isNull("story_app_attribution"))
|
||||
models[i].setSpotify(data.getJSONObject("story_app_attribution").optString("content_url").split("\\?")[0]);
|
||||
|
||||
|
|
@ -136,6 +140,7 @@ public final class iStoryStatusFetcher extends AsyncTask<Void, Void, StoryModel[
|
|||
tappableObject.optInt("viewer_vote", -1)
|
||||
));
|
||||
}
|
||||
|
||||
if (data.has("story_questions")) {
|
||||
JSONObject tappableObject = data.getJSONArray("story_questions").getJSONObject(0).optJSONObject("question_sticker");
|
||||
if (tappableObject != null && !tappableObject.getString("question_type").equals("music"))
|
||||
|
|
@ -144,6 +149,7 @@ public final class iStoryStatusFetcher extends AsyncTask<Void, Void, StoryModel[
|
|||
tappableObject.getString("question")
|
||||
));
|
||||
}
|
||||
|
||||
if (data.has("story_quizs")) {
|
||||
JSONObject tappableObject = data.getJSONArray("story_quizs").getJSONObject(0).optJSONObject("quiz_sticker");
|
||||
if (tappableObject != null) {
|
||||
|
|
@ -164,6 +170,18 @@ public final class iStoryStatusFetcher extends AsyncTask<Void, Void, StoryModel[
|
|||
));
|
||||
}
|
||||
}
|
||||
|
||||
if (data.has("story_cta") && data.has("link_text")) {
|
||||
JSONObject tappableObject = data.getJSONArray("story_cta").getJSONObject(0).getJSONArray("links").getJSONObject(0);
|
||||
String swipeUpUrl = tappableObject.getString("webUri");
|
||||
if (swipeUpUrl.startsWith("http")) {
|
||||
models[i].setSwipeUp(new SwipeUpModel(
|
||||
swipeUpUrl,
|
||||
data.getString("link_text")
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
JSONArray hashtags = data.optJSONArray("story_hashtags");
|
||||
JSONArray locations = data.optJSONArray("story_locations");
|
||||
JSONArray atmarks = data.optJSONArray("reel_mentions");
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class DirectMessageInboxFragment extends Fragment implements SwipeRefresh
|
|||
private String endCursor;
|
||||
private AsyncTask<Void, Void, InboxModel> currentlyRunning;
|
||||
private InboxThreadModelListViewModel listViewModel;
|
||||
public static boolean afterLeave = false;
|
||||
public static boolean refreshPlease = false;
|
||||
|
||||
private final FetchListener<InboxModel> fetchListener = new FetchListener<InboxModel>() {
|
||||
@Override
|
||||
|
|
@ -121,9 +121,9 @@ public class DirectMessageInboxFragment extends Fragment implements SwipeRefresh
|
|||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (afterLeave) {
|
||||
if (refreshPlease) {
|
||||
onRefresh();
|
||||
afterLeave = false;
|
||||
refreshPlease = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ public class DirectMessageSettingsFragment extends Fragment implements SwipeRefr
|
|||
titleText.clearFocus();
|
||||
}
|
||||
else if (action.equals("leave")) {
|
||||
DirectMessageInboxFragment.afterLeave = true;
|
||||
DirectMessageInboxFragment.refreshPlease = true;
|
||||
NavHostFragment.findNavController(DirectMessageSettingsFragment.this).popBackStack(R.id.directMessagesInboxFragment, false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ import awais.instagrabber.models.direct_messages.DirectItemModel;
|
|||
import awais.instagrabber.models.direct_messages.InboxThreadModel;
|
||||
import awais.instagrabber.models.enums.DirectItemType;
|
||||
import awais.instagrabber.models.enums.DownloadMethod;
|
||||
import awais.instagrabber.models.enums.MediaItemType;
|
||||
import awais.instagrabber.models.enums.UserInboxDirection;
|
||||
import awais.instagrabber.utils.Constants;
|
||||
import awais.instagrabber.utils.Utils;
|
||||
|
|
@ -208,6 +209,7 @@ public class DirectMessageThreadFragment extends Fragment {
|
|||
final DirectItemType itemType = directItemModel.getItemType();
|
||||
switch (itemType) {
|
||||
case MEDIA_SHARE:
|
||||
case CLIP:
|
||||
startActivity(new Intent(requireContext(), PostViewer.class)
|
||||
.putExtra(Constants.EXTRAS_POST, new PostModel(directItemModel.getMediaModel().getCode(), false)));
|
||||
break;
|
||||
|
|
@ -224,8 +226,16 @@ public class DirectMessageThreadFragment extends Fragment {
|
|||
case RAVEN_MEDIA:
|
||||
case MEDIA:
|
||||
final ProfileModel user = getUser(directItemModel.getUserId());
|
||||
Utils.dmDownload(requireContext(), user.getUsername(), DownloadMethod.DOWNLOAD_DIRECT, Collections.singletonList(itemType == DirectItemType.MEDIA ? directItemModel.getMediaModel() : directItemModel.getRavenMediaModel().getMedia()));
|
||||
Toast.makeText(requireContext(), R.string.downloader_downloading_media, Toast.LENGTH_SHORT).show();
|
||||
final DirectItemModel.DirectItemMediaModel selectedItem =
|
||||
itemType == DirectItemType.MEDIA ? directItemModel.getMediaModel() : directItemModel.getRavenMediaModel().getMedia();
|
||||
final String url = selectedItem.getMediaType() == MediaItemType.MEDIA_TYPE_VIDEO ? selectedItem.getVideoUrl() : selectedItem.getThumbUrl();
|
||||
if (url == null) {
|
||||
Toast.makeText(requireContext(), R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
else {
|
||||
Utils.dmDownload(requireContext(), user.getUsername(), DownloadMethod.DOWNLOAD_DIRECT, selectedItem);
|
||||
Toast.makeText(requireContext(), R.string.downloader_downloading_media, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
case STORY_SHARE:
|
||||
if (directItemModel.getReelShare() != null) {
|
||||
|
|
@ -275,6 +285,7 @@ public class DirectMessageThreadFragment extends Fragment {
|
|||
|
||||
switch (itemType) {
|
||||
case MEDIA_SHARE:
|
||||
case CLIP:
|
||||
firstOption = R.string.view_post;
|
||||
break;
|
||||
case LINK:
|
||||
|
|
@ -376,6 +387,7 @@ public class DirectMessageThreadFragment extends Fragment {
|
|||
}
|
||||
directItemModel.setLiked();
|
||||
}
|
||||
DirectMessageInboxFragment.refreshPlease = true;
|
||||
hasSentSomething = true;
|
||||
new DirectMessageInboxThreadFetcher(threadId, UserInboxDirection.OLDER, null, fetchListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import awais.instagrabber.models.enums.MediaItemType;
|
|||
import awais.instagrabber.models.stickers.PollModel;
|
||||
import awais.instagrabber.models.stickers.QuestionModel;
|
||||
import awais.instagrabber.models.stickers.QuizModel;
|
||||
import awais.instagrabber.models.stickers.SwipeUpModel;
|
||||
|
||||
public final class StoryModel implements Serializable {
|
||||
private final String storyMediaId, storyUrl, username, userId;
|
||||
|
|
@ -15,6 +16,7 @@ public final class StoryModel implements Serializable {
|
|||
private PollModel poll;
|
||||
private QuestionModel question;
|
||||
private QuizModel quiz;
|
||||
private SwipeUpModel swipeUp;
|
||||
private String[] mentions;
|
||||
private int position;
|
||||
private boolean isCurrentSlide = false, canReply = false;
|
||||
|
|
@ -66,6 +68,8 @@ public final class StoryModel implements Serializable {
|
|||
return quiz;
|
||||
}
|
||||
|
||||
public SwipeUpModel getSwipeUp() { return swipeUp;}
|
||||
|
||||
public String[] getMentions() {
|
||||
return mentions;
|
||||
}
|
||||
|
|
@ -106,6 +110,10 @@ public final class StoryModel implements Serializable {
|
|||
this.mentions = mentions;
|
||||
}
|
||||
|
||||
public void setSwipeUp(final SwipeUpModel swipeUp) {
|
||||
this.swipeUp = swipeUp;
|
||||
}
|
||||
|
||||
public void setPosition(final int position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@ import org.json.JSONObject;
|
|||
import awais.instagrabber.models.enums.MediaItemType;
|
||||
|
||||
public final class ViewerPostModel extends BasePostModel {
|
||||
protected final String username;
|
||||
protected final JSONObject location;
|
||||
protected final String username, locationName, location;
|
||||
protected final long videoViews;
|
||||
protected String sliderDisplayUrl;
|
||||
protected long commentsCount, likes;
|
||||
|
|
@ -14,7 +13,7 @@ public final class ViewerPostModel extends BasePostModel {
|
|||
|
||||
public ViewerPostModel(final MediaItemType itemType, final String postId, final String displayUrl, final String shortCode,
|
||||
final String postCaption, final String username, final long videoViews, final long timestamp,
|
||||
boolean liked, boolean bookmarked, long likes, final JSONObject location) {
|
||||
boolean liked, boolean bookmarked, long likes, final String locationName, final String location) {
|
||||
this.itemType = itemType;
|
||||
this.postId = postId;
|
||||
this.displayUrl = displayUrl;
|
||||
|
|
@ -26,6 +25,7 @@ public final class ViewerPostModel extends BasePostModel {
|
|||
this.liked = liked;
|
||||
this.likes = likes;
|
||||
this.bookmarked = bookmarked;
|
||||
this.locationName = locationName;
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
|
|
@ -41,7 +41,11 @@ public final class ViewerPostModel extends BasePostModel {
|
|||
return username;
|
||||
}
|
||||
|
||||
public JSONObject getLocation() {
|
||||
public String getLocationName() {
|
||||
return locationName;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@ public enum DirectItemType implements Serializable {
|
|||
REEL_SHARE(11),
|
||||
ACTION_LOG(12),
|
||||
PLACEHOLDER(13),
|
||||
STORY_SHARE(14);
|
||||
STORY_SHARE(14),
|
||||
CLIP(15); // clip is just media_share but reel
|
||||
|
||||
private final int id;
|
||||
private static Map<Integer, DirectItemType> map = new HashMap<>();
|
||||
|
|
|
|||
20
app/src/main/java/awais/instagrabber/models/stickers/SwipeUpModel.java
Executable file
20
app/src/main/java/awais/instagrabber/models/stickers/SwipeUpModel.java
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
package awais.instagrabber.models.stickers;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public final class SwipeUpModel implements Serializable {
|
||||
private final String url, text;
|
||||
|
||||
public SwipeUpModel(final String url, final String text) {
|
||||
this.url = url;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
|
@ -144,10 +144,10 @@ public final class Utils {
|
|||
final URI uri1 = new URI("https://instagram.com");
|
||||
final URI uri2 = new URI("https://instagram.com/");
|
||||
final URI uri3 = new URI("https://i.instagram.com/");
|
||||
for (final String cookie : cookieRaw.split(";")) {
|
||||
for (final String cookie : cookieRaw.split("; ")) {
|
||||
final String[] strings = cookie.split("=", 2);
|
||||
final HttpCookie httpCookie = new HttpCookie(strings[0].trim(), strings[1].trim());
|
||||
httpCookie.setDomain("instagram.com");
|
||||
httpCookie.setDomain(".instagram.com");
|
||||
httpCookie.setPath("/");
|
||||
httpCookie.setVersion(0);
|
||||
cookieStore.add(uri1, httpCookie);
|
||||
|
|
@ -427,7 +427,7 @@ public final class Utils {
|
|||
if (userObj != null) {
|
||||
user = new ProfileModel(
|
||||
userObj.getBoolean("is_private"),
|
||||
false, // temporary
|
||||
false,
|
||||
userObj.optBoolean("is_verified"),
|
||||
String.valueOf(userObj.get("pk")),
|
||||
userObj.getString("username"),
|
||||
|
|
@ -468,6 +468,7 @@ public final class Utils {
|
|||
if ("animated_media".equals(itemType)) return DirectItemType.ANIMATED_MEDIA;
|
||||
if ("voice_media".equals(itemType)) return DirectItemType.VOICE_MEDIA;
|
||||
if ("story_share".equals(itemType)) return DirectItemType.STORY_SHARE;
|
||||
if ("clip".equals(itemType)) return DirectItemType.CLIP;
|
||||
return DirectItemType.TEXT;
|
||||
}
|
||||
|
||||
|
|
@ -708,6 +709,11 @@ public final class Utils {
|
|||
directMedia = getDirectMediaModel(itemObject.getJSONObject("media_share"));
|
||||
break;
|
||||
|
||||
case CLIP:
|
||||
Log.d("austin_debug", "clip: "+itemObject.getJSONObject("clip").getJSONObject("clip"));
|
||||
directMedia = getDirectMediaModel(itemObject.getJSONObject("clip").getJSONObject("clip"));
|
||||
break;
|
||||
|
||||
case MEDIA:
|
||||
directMedia = getDirectMediaModel(itemObject.optJSONObject("media"));
|
||||
break;
|
||||
|
|
@ -999,10 +1005,10 @@ public final class Utils {
|
|||
}
|
||||
|
||||
public static void dmDownload(@NonNull final Context context, @Nullable final String username, final DownloadMethod method,
|
||||
final List<? extends DirectItemMediaModel> itemsToDownload) {
|
||||
final DirectItemMediaModel itemsToDownload) {
|
||||
if (settingsHelper == null) settingsHelper = new SettingsHelper(context);
|
||||
|
||||
if (itemsToDownload == null || itemsToDownload.size() < 1) return;
|
||||
if (itemsToDownload == null) return;
|
||||
|
||||
if (ContextCompat.checkSelfPermission(context, Utils.PERMS[0]) == PackageManager.PERMISSION_GRANTED)
|
||||
dmDownloadImpl(context, username, method, itemsToDownload);
|
||||
|
|
@ -1011,7 +1017,7 @@ public final class Utils {
|
|||
}
|
||||
|
||||
private static void dmDownloadImpl(@NonNull final Context context, @Nullable final String username,
|
||||
final DownloadMethod method, final List<? extends DirectItemMediaModel> itemsToDownload) {
|
||||
final DownloadMethod method, final DirectItemMediaModel selectedItem) {
|
||||
File dir = new File(Environment.getExternalStorageDirectory(), "Download");
|
||||
|
||||
if (settingsHelper.getBoolean(FOLDER_SAVE_TO)) {
|
||||
|
|
@ -1023,22 +1029,11 @@ public final class Utils {
|
|||
dir = new File(dir, username);
|
||||
|
||||
if (dir.exists() || dir.mkdirs()) {
|
||||
final MainActivity mainActivity = method != DownloadMethod.DOWNLOAD_FEED && context instanceof MainActivity ? (MainActivity) context : null;
|
||||
|
||||
final int itemsToDownloadSize = itemsToDownload.size();
|
||||
|
||||
final File finalDir = dir;
|
||||
for (int i = itemsToDownloadSize - 1; i >= 0; i--) {
|
||||
final DirectItemMediaModel selectedItem = itemsToDownload.get(i);
|
||||
|
||||
if (mainActivity == null) {
|
||||
new DownloadAsync(context,
|
||||
selectedItem.getMediaType() == MediaItemType.MEDIA_TYPE_VIDEO ? selectedItem.getVideoUrl() : selectedItem.getThumbUrl(),
|
||||
getDownloadSaveFileDm(finalDir, selectedItem, ""),
|
||||
null).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
|
||||
}
|
||||
}
|
||||
new DownloadAsync(context,
|
||||
selectedItem.getMediaType() == MediaItemType.MEDIA_TYPE_VIDEO ? selectedItem.getVideoUrl() : selectedItem.getThumbUrl(),
|
||||
getDownloadSaveFileDm(finalDir, selectedItem, ""),
|
||||
null).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
} else
|
||||
Toast.makeText(context, R.string.error_creating_folders, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
|
@ -1256,7 +1251,7 @@ public final class Utils {
|
|||
|
||||
final int endIndex = (spaceIndex != -1 ? spaceIndex : length);
|
||||
|
||||
final String extractUrl = url.substring(startIndex, Math.min(length, endIndex) - 1);
|
||||
final String extractUrl = url.substring(startIndex, Math.min(length, endIndex));
|
||||
|
||||
final SpannableString spannableString = new SpannableString(url);
|
||||
spannableString.setSpan(new URLSpan(extractUrl), startIndex, endIndex, 0);
|
||||
|
|
|
|||
|
|
@ -85,6 +85,15 @@
|
|||
android:visibility="gone"
|
||||
app:backgroundTint="@color/btn_blue_background" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/swipeUp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="SAMPLE TEXT"
|
||||
android:textColor="@color/btn_blue_text_color"
|
||||
android:visibility="gone"
|
||||
app:backgroundTint="@color/btn_blue_background" />
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/mention"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@
|
|||
android:gravity="center_vertical"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
|
||||
android:textColor="@color/feed_text_primary_color"
|
||||
android:textSize="15sp" />
|
||||
tools:text="location" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue