mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-26 08:37:29 +00:00
v17.2
This commit is contained in:
parent
8421b498bb
commit
5baf2701b0
@ -12,8 +12,8 @@ android {
|
|||||||
// REMEMBER TO CHANGE versionCode AS WELL
|
// REMEMBER TO CHANGE versionCode AS WELL
|
||||||
// 16.7 is 32, 16.9 is 35 (34 is public beta)
|
// 16.7 is 32, 16.9 is 35 (34 is public beta)
|
||||||
|
|
||||||
versionCode 37
|
versionCode 38
|
||||||
versionName '17.1'
|
versionName '17.2'
|
||||||
|
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
|
|
||||||
|
@ -238,15 +238,19 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
|
|||||||
final Object tag = v.getTag();
|
final Object tag = v.getTag();
|
||||||
if (tag instanceof FeedStoryModel) {
|
if (tag instanceof FeedStoryModel) {
|
||||||
final FeedStoryModel feedStoryModel = (FeedStoryModel) tag;
|
final FeedStoryModel feedStoryModel = (FeedStoryModel) tag;
|
||||||
StoryModel[] storyModels = feedStoryModel.getStoryModels();
|
|
||||||
final int index = indexOfIntArray(stories, feedStoryModel);
|
final int index = indexOfIntArray(stories, feedStoryModel);
|
||||||
|
new iStoryStatusFetcher(feedStoryModel.getStoryMediaId(), null, false, false, result -> {
|
||||||
|
if (result != null && result.length > 0)
|
||||||
main.startActivity(new Intent(main, StoryViewer.class)
|
main.startActivity(new Intent(main, StoryViewer.class)
|
||||||
.putExtra(Constants.EXTRAS_STORIES, storyModels)
|
.putExtra(Constants.EXTRAS_STORIES, result)
|
||||||
.putExtra(Constants.EXTRAS_USERNAME, feedStoryModel.getProfileModel().getUsername())
|
.putExtra(Constants.EXTRAS_USERNAME, feedStoryModel.getProfileModel().getUsername())
|
||||||
.putExtra(Constants.FEED, stories)
|
.putExtra(Constants.FEED, stories)
|
||||||
.putExtra(Constants.FEED_ORDER, index)
|
.putExtra(Constants.FEED_ORDER, index)
|
||||||
);
|
);
|
||||||
|
else Toast.makeText(main, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
|
||||||
|
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -48,7 +48,7 @@ public final class DirectMessages extends BaseLanguageActivity implements SwipeR
|
|||||||
// todo get request / unseen count from inboxModel
|
// todo get request / unseen count from inboxModel
|
||||||
|
|
||||||
final InboxThreadModel[] threads = inboxModel.getThreads();
|
final InboxThreadModel[] threads = inboxModel.getThreads();
|
||||||
if (threads != null) {
|
if (threads != null && threads.length > 0) {
|
||||||
final int oldSize = inboxThreadModelList.size();
|
final int oldSize = inboxThreadModelList.size();
|
||||||
inboxThreadModelList.addAll(Arrays.asList(threads));
|
inboxThreadModelList.addAll(Arrays.asList(threads));
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ import awais.instagrabber.BuildConfig;
|
|||||||
import awais.instagrabber.R;
|
import awais.instagrabber.R;
|
||||||
import awais.instagrabber.adapters.StoriesAdapter;
|
import awais.instagrabber.adapters.StoriesAdapter;
|
||||||
import awais.instagrabber.asyncs.DownloadAsync;
|
import awais.instagrabber.asyncs.DownloadAsync;
|
||||||
|
import awais.instagrabber.asyncs.i.iStoryStatusFetcher;
|
||||||
import awais.instagrabber.customviews.helpers.SwipeGestureListener;
|
import awais.instagrabber.customviews.helpers.SwipeGestureListener;
|
||||||
import awais.instagrabber.databinding.ActivityStoryViewerBinding;
|
import awais.instagrabber.databinding.ActivityStoryViewerBinding;
|
||||||
import awais.instagrabber.interfaces.SwipeEvent;
|
import awais.instagrabber.interfaces.SwipeEvent;
|
||||||
@ -150,15 +151,19 @@ public final class StoryViewer extends BaseLanguageActivity {
|
|||||||
(index == 0 ? null : storyFeed[index - 1]) :
|
(index == 0 ? null : storyFeed[index - 1]) :
|
||||||
(storyFeed.length == index + 1 ? null : storyFeed[index + 1]);
|
(storyFeed.length == index + 1 ? null : storyFeed[index + 1]);
|
||||||
if (feedStoryModel != null) {
|
if (feedStoryModel != null) {
|
||||||
final StoryModel[] nextStoryModels = feedStoryModel.getStoryModels();
|
new iStoryStatusFetcher(feedStoryModel.getStoryMediaId(), null, false, false, result -> {
|
||||||
|
if (result != null && result.length > 0) {
|
||||||
final Intent newIntent = new Intent(getApplicationContext(), StoryViewer.class)
|
final Intent newIntent = new Intent(getApplicationContext(), StoryViewer.class)
|
||||||
.putExtra(Constants.EXTRAS_STORIES, nextStoryModels)
|
.putExtra(Constants.EXTRAS_STORIES, result)
|
||||||
.putExtra(Constants.EXTRAS_USERNAME, feedStoryModel.getProfileModel().getUsername())
|
.putExtra(Constants.EXTRAS_USERNAME, feedStoryModel.getProfileModel().getUsername())
|
||||||
.putExtra(Constants.FEED, storyFeed)
|
.putExtra(Constants.FEED, storyFeed)
|
||||||
.putExtra(Constants.FEED_ORDER, isRightSwipe ? (index - 1) : (index + 1));
|
.putExtra(Constants.FEED_ORDER, isRightSwipe ? (index - 1) : (index + 1));
|
||||||
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
startActivity(newIntent);
|
startActivity(newIntent);
|
||||||
}
|
}
|
||||||
|
else Toast.makeText(getApplicationContext(), R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
|
||||||
|
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -67,24 +67,6 @@ public final class FeedStoriesFetcher extends AsyncTask<Void, Void, FeedStoryMod
|
|||||||
feedStoryIDs[i] = id;
|
feedStoryIDs[i] = id;
|
||||||
feedStoryModels[i] = new FeedStoryModel(id, profileModel);
|
feedStoryModels[i] = new FeedStoryModel(id, profileModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int s = 0; s <= Math.ceil(feedStoryIDs.length / 20); ++s) {
|
|
||||||
String[] shard = new String[Math.min(20, (feedStoryIDs.length - s*20))];
|
|
||||||
FeedStoryModel[] feedStoryShard = new FeedStoryModel[Math.min(20, (feedStoryIDs.length - s*20))];
|
|
||||||
System.arraycopy(feedStoryIDs, s*20, shard, 0, shard.length);
|
|
||||||
System.arraycopy(feedStoryModels, s*20, feedStoryShard, 0, shard.length);
|
|
||||||
url = "https://i.instagram.com/api/v1/feed/reels_media/?reel_ids=" + Utils.iHighlightIdsMerger(shard);
|
|
||||||
conn = (HttpURLConnection) new URL(url).openConnection();
|
|
||||||
conn.setRequestProperty("User-Agent", Constants.USER_AGENT);
|
|
||||||
conn.setInstanceFollowRedirects(false);
|
|
||||||
conn.setUseCaches(false);
|
|
||||||
conn.setReadTimeout(2000);
|
|
||||||
conn.connect();
|
|
||||||
if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
|
|
||||||
Utils.iPutFeedStoryModels(conn, feedStoryShard, shard);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
result = feedStoryModels;
|
result = feedStoryModels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ import awais.instagrabber.BuildConfig;
|
|||||||
import awais.instagrabber.interfaces.FetchListener;
|
import awais.instagrabber.interfaces.FetchListener;
|
||||||
import awais.instagrabber.models.NotificationModel;
|
import awais.instagrabber.models.NotificationModel;
|
||||||
import awais.instagrabber.utils.Constants;
|
import awais.instagrabber.utils.Constants;
|
||||||
|
import awais.instagrabber.utils.LocaleUtils;
|
||||||
import awais.instagrabber.utils.Utils;
|
import awais.instagrabber.utils.Utils;
|
||||||
import awaisomereport.LogCollector;
|
import awaisomereport.LogCollector;
|
||||||
|
|
||||||
@ -34,6 +35,7 @@ public final class NotificationsFetcher extends AsyncTask<Void, Void, Notificati
|
|||||||
final HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
|
final HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
|
||||||
conn.setInstanceFollowRedirects(false);
|
conn.setInstanceFollowRedirects(false);
|
||||||
conn.setUseCaches(false);
|
conn.setUseCaches(false);
|
||||||
|
conn.setRequestProperty("Accept-Language", LocaleUtils.getCurrentLocale().getLanguage() + ",en-US;q=0.8");
|
||||||
conn.connect();
|
conn.connect();
|
||||||
|
|
||||||
if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
|
if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
|
||||||
|
@ -1160,23 +1160,6 @@ public final class Utils {
|
|||||||
return "[]";
|
return "[]";
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
|
||||||
public static String iHighlightIdsMerger(final String... strings) {
|
|
||||||
if (strings != null) {
|
|
||||||
int iMax = strings.length - 1;
|
|
||||||
if (iMax != -1) {
|
|
||||||
final StringBuilder builder = new StringBuilder();
|
|
||||||
for (int i = 0; ; i++) {
|
|
||||||
builder.append(strings[i]);
|
|
||||||
if (i == iMax) return builder.toString();
|
|
||||||
builder.append("&reel_ids=");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void putHighlightModels(final HttpURLConnection conn, final Object[] model) throws Exception {
|
public static void putHighlightModels(final HttpURLConnection conn, final Object[] model) throws Exception {
|
||||||
final boolean isHighlightModel = model instanceof HighlightModel[];
|
final boolean isHighlightModel = model instanceof HighlightModel[];
|
||||||
final boolean isFeedStoryModel = model instanceof FeedStoryModel[];
|
final boolean isFeedStoryModel = model instanceof FeedStoryModel[];
|
||||||
@ -1246,75 +1229,6 @@ public final class Utils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void iPutFeedStoryModels(final HttpURLConnection conn, final FeedStoryModel[] model, final String[] ids) throws Exception {
|
|
||||||
final JSONObject highlightsMediaReel = new JSONObject(Utils.readFromConnection(conn)).getJSONObject("reels");
|
|
||||||
final int mediaLength = highlightsMediaReel.length();
|
|
||||||
|
|
||||||
for (int i = 0; i < mediaLength; ++i) {
|
|
||||||
final JSONArray items = highlightsMediaReel.getJSONObject(ids[i]).getJSONArray("items");
|
|
||||||
final int itemsLen = items.length();
|
|
||||||
|
|
||||||
final StoryModel[] storyModels = new StoryModel[itemsLen];
|
|
||||||
for (int j = 0; j < itemsLen; ++j) {
|
|
||||||
final JSONObject data = items.getJSONObject(j);
|
|
||||||
final boolean isVideo = data.has("video_duration");
|
|
||||||
|
|
||||||
storyModels[j] = new StoryModel(data.getString("pk"),
|
|
||||||
data.getJSONObject("image_versions2").getJSONArray("candidates").getJSONObject(0).getString("url"),
|
|
||||||
isVideo ? MediaItemType.MEDIA_TYPE_VIDEO : MediaItemType.MEDIA_TYPE_IMAGE,
|
|
||||||
data.optLong("taken_at", 0),
|
|
||||||
model[i].getProfileModel().getUsername());
|
|
||||||
|
|
||||||
final JSONArray videoResources = data.optJSONArray("video_versions");
|
|
||||||
if (isVideo && videoResources != null)
|
|
||||||
storyModels[j].setVideoUrl(Utils.getHighQualityPost(videoResources, true, true));
|
|
||||||
|
|
||||||
if (data.has("story_feed_media")) {
|
|
||||||
storyModels[j].setTappableShortCode(data.getJSONArray("story_feed_media").getJSONObject(0).optString("media_id"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!data.isNull("story_app_attribution"))
|
|
||||||
storyModels[j].setSpotify(data.getJSONObject("story_app_attribution").optString("content_url").split("\\?")[0]);
|
|
||||||
|
|
||||||
if (data.has("story_polls")) {
|
|
||||||
JSONObject tappableObject = data.optJSONArray("story_polls").getJSONObject(0).optJSONObject("poll_sticker");
|
|
||||||
if (tappableObject != null) storyModels[j].setPoll(new PollModel(
|
|
||||||
String.valueOf(tappableObject.getLong("poll_id")),
|
|
||||||
tappableObject.getString("question"),
|
|
||||||
tappableObject.getJSONArray("tallies").getJSONObject(0).getString("text"),
|
|
||||||
tappableObject.getJSONArray("tallies").getJSONObject(0).getInt("count"),
|
|
||||||
tappableObject.getJSONArray("tallies").getJSONObject(1).getString("text"),
|
|
||||||
tappableObject.getJSONArray("tallies").getJSONObject(1).getInt("count"),
|
|
||||||
tappableObject.optInt("viewer_vote", -1)
|
|
||||||
));
|
|
||||||
}
|
|
||||||
if (data.has("story_questions")) {
|
|
||||||
JSONObject tappableObject = data.getJSONArray("story_questions").getJSONObject(0).optJSONObject("question_sticker");
|
|
||||||
if (tappableObject != null) storyModels[j].setQuestion(new QuestionModel(
|
|
||||||
String.valueOf(tappableObject.getLong("question_id")),
|
|
||||||
tappableObject.getString("question")
|
|
||||||
));
|
|
||||||
}
|
|
||||||
JSONArray hashtags = data.optJSONArray("story_hashtags");
|
|
||||||
JSONArray atmarks = data.optJSONArray("reel_mentions");
|
|
||||||
String[] mentions = new String[(hashtags == null ? 0 : hashtags.length()) + (atmarks == null ? 0 : atmarks.length())];
|
|
||||||
if (hashtags != null) {
|
|
||||||
for (int h = 0; h < hashtags.length(); ++h) {
|
|
||||||
mentions[h] = "#"+hashtags.getJSONObject(h).getJSONObject("hashtag").getString("name");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (atmarks != null) {
|
|
||||||
for (int h = 0; h < atmarks.length(); ++h) {
|
|
||||||
mentions[h + (hashtags == null ? 0 : hashtags.length())] =
|
|
||||||
"@"+atmarks.getJSONObject(h).getJSONObject("user").getString("username");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
storyModels[j].setMentions(mentions);
|
|
||||||
}
|
|
||||||
model[i].setStoryModels(storyModels);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String sign(final String message) {
|
public static String sign(final String message) {
|
||||||
try {
|
try {
|
||||||
Mac hasher = Mac.getInstance("HmacSHA256");
|
Mac hasher = Mac.getInstance("HmacSHA256");
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
<string name="post_viewer_download_album">整个图集</string>
|
<string name="post_viewer_download_album">整个图集</string>
|
||||||
<string name="show_stories">显示快拍</string>
|
<string name="show_stories">显示快拍</string>
|
||||||
<string name="no_more_stories">到底啦!</string>
|
<string name="no_more_stories">到底啦!</string>
|
||||||
<string name="view_story_post">浏览快拍</string>
|
<string name="view_story_post">浏览帖子</string>
|
||||||
<string name="view_post">查看帖子</string>
|
<string name="view_post">查看帖子</string>
|
||||||
<string name="spotify">Spotify</string>
|
<string name="spotify">Spotify</string>
|
||||||
<string name="vote_story_poll">投票</string>
|
<string name="vote_story_poll">投票</string>
|
||||||
@ -185,4 +185,8 @@
|
|||||||
<string name="updated">感谢阁下更新InstaGrabber!</string>
|
<string name="updated">感谢阁下更新InstaGrabber!</string>
|
||||||
<string name="crash_title">应用崩溃了</string>
|
<string name="crash_title">应用崩溃了</string>
|
||||||
<string name="crash_descr">糟糕.. 应用崩溃了,不过别担心,你可以向开发者发送错误报告来帮助他修复问题。(:</string>
|
<string name="crash_descr">糟糕.. 应用崩溃了,不过别担心,你可以向开发者发送错误报告来帮助他修复问题。(:</string>
|
||||||
|
<string name="answer_story">回答</string>
|
||||||
|
<string name="answer_hint">在此回答...</string>
|
||||||
|
<string name="answered_story">回答完成!</string>
|
||||||
|
<string name="story_mentions">提及</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
<string name="post_viewer_download_album">Whole Album</string>
|
<string name="post_viewer_download_album">Whole Album</string>
|
||||||
<string name="show_stories">Show stories</string>
|
<string name="show_stories">Show stories</string>
|
||||||
<string name="no_more_stories">No more stories!</string>
|
<string name="no_more_stories">No more stories!</string>
|
||||||
<string name="view_story_post">View Story Post</string>
|
<string name="view_story_post">View Post</string>
|
||||||
<string name="view_post">View Post</string>
|
<string name="view_post">View Post</string>
|
||||||
<string name="spotify">Spotify</string>
|
<string name="spotify">Spotify</string>
|
||||||
<string name="vote_story_poll">Vote</string>
|
<string name="vote_story_poll">Vote</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user