mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-18 04:37:30 +00:00
v16.6-a6 this time the proper version
This commit is contained in:
parent
fb2ba29b4a
commit
f7e5914df8
@ -11,7 +11,7 @@ This app is originally made by [@AwaisKing](https://github.com/AwaisKing) who po
|
||||
Download [here](https://github.com/austinhuang0131/instagrabber/releases). Under each release is an `app-release.apk`. Just install that. Unfortunately,
|
||||
|
||||
* I have to sign it with my own key, which means you have to uninstall the old app and log in again. Sorry.
|
||||
* I don't plan on getting a Google Play Dev account yet, so that means Google Play will shout at you for installing "malware". Just ignore it. If you're skeptical (which is not necessarily a bad thing), just inspect the source code and build the app yourself.
|
||||
* ~~I don't plan on getting a Google Play Dev account yet, so that means Google Play will shout at you for installing "malware". Just ignore it.~~ (Does not seem to happen anymore after I sent the app to Google.) If you're skeptical (which is not necessarily a bad thing), just inspect the source code and build the app yourself.
|
||||
|
||||
### How to log in
|
||||
|
||||
|
@ -30,6 +30,7 @@ import awais.instagrabber.models.ProfileModel;
|
||||
import awais.instagrabber.models.StoryModel;
|
||||
import awais.instagrabber.models.direct_messages.DirectItemModel;
|
||||
import awais.instagrabber.models.direct_messages.DirectItemModel.DirectItemMediaModel;
|
||||
import awais.instagrabber.models.direct_messages.DirectItemModel.DirectItemRavenMediaModel;
|
||||
import awais.instagrabber.models.direct_messages.InboxThreadModel;
|
||||
import awais.instagrabber.models.enums.DirectItemType;
|
||||
import awais.instagrabber.models.enums.DownloadMethod;
|
||||
@ -104,46 +105,50 @@ public final class DirectMessagesUserInbox extends AppCompatActivity {
|
||||
Object tag = v.getTag();
|
||||
if (tag instanceof DirectItemModel) {
|
||||
directItemModel = (DirectItemModel) tag;
|
||||
final String username = getUser(directItemModel.getUserId()).getUsername();
|
||||
final DirectItemType itemType = directItemModel.getItemType();
|
||||
switch (itemType) {
|
||||
case MEDIA_SHARE:
|
||||
startActivity(new Intent(this, PostViewer.class)
|
||||
.putExtra(Constants.EXTRAS_POST, new PostModel(directItemModel.getMediaModel().getCode())));
|
||||
break;
|
||||
case LINK:
|
||||
Intent linkIntent = new Intent(Intent.ACTION_VIEW);
|
||||
linkIntent.setData(Uri.parse(directItemModel.getLinkModel().getLinkContext().getLinkUrl()));
|
||||
startActivity(linkIntent);
|
||||
break;
|
||||
case MEDIA_SHARE:
|
||||
startActivity(new Intent(this, PostViewer.class)
|
||||
.putExtra(Constants.EXTRAS_POST, new PostModel(directItemModel.getMediaModel().getCode())));
|
||||
break;
|
||||
case MEDIA:
|
||||
Utils.dmDownload(this, username, DownloadMethod.DOWNLOAD_DIRECT, Collections.singletonList(directItemModel.getMediaModel()));
|
||||
Toast.makeText(v.getContext(), R.string.downloader_downloading_media, Toast.LENGTH_SHORT).show();
|
||||
break;
|
||||
case REEL_SHARE:
|
||||
case STORY_SHARE:
|
||||
if (directItemModel.getReelShare() != null)
|
||||
startActivity(new Intent(this, StoryViewer.class)
|
||||
.putExtra(Constants.EXTRAS_USERNAME, directItemModel.getReelShare().getReelOwnerName())
|
||||
/*.putExtra(Constants.EXTRAS_STORIES, new StoryModel(
|
||||
directItemModel.getReelShare().getReelId(),
|
||||
directItemModel.getReelShare().getMedia()
|
||||
))*/
|
||||
);
|
||||
break;
|
||||
case TEXT:
|
||||
case REEL_SHARE:
|
||||
Utils.copyText(v.getContext(), directItemModel.getText());
|
||||
Toast.makeText(v.getContext(), R.string.clipboard_copied, Toast.LENGTH_SHORT).show();
|
||||
break;
|
||||
case RAVEN_MEDIA:
|
||||
case MEDIA:
|
||||
Utils.dmDownload(this, getUser(directItemModel.getUserId()).getUsername(), DownloadMethod.DOWNLOAD_DIRECT,
|
||||
Collections.singletonList(itemType == DirectItemType.MEDIA ? directItemModel.getMediaModel() : directItemModel.getRavenMediaModel().getMedia()));
|
||||
Toast.makeText(v.getContext(), R.string.downloader_downloading_media, Toast.LENGTH_SHORT).show();
|
||||
break;
|
||||
case STORY_SHARE:
|
||||
StoryModel sm = new StoryModel(
|
||||
directItemModel.getReelShare().getReelId(),
|
||||
directItemModel.getReelShare().getMedia().getVideoUrl(),
|
||||
directItemModel.getReelShare().getMedia().getMediaType(),
|
||||
directItemModel.getTimestamp()
|
||||
);
|
||||
sm.setVideoUrl(directItemModel.getReelShare().getMedia().getVideoUrl());
|
||||
StoryModel[] sms = {sm};
|
||||
if (directItemModel.getReelShare() != null)
|
||||
startActivity(new Intent(this, StoryViewer.class)
|
||||
.putExtra(Constants.EXTRAS_USERNAME, directItemModel.getReelShare().getReelOwnerName())
|
||||
.putExtra(Constants.EXTRAS_STORIES, sms)
|
||||
);
|
||||
break;
|
||||
default:
|
||||
Log.d("austin_debug", "unsupported type "+itemType);
|
||||
}
|
||||
|
||||
/*
|
||||
startActivity(new Intent(this, PostViewer.class)
|
||||
.putExtra(Constants.EXTRAS_POST, new PostModel(tag.toString())));
|
||||
*/
|
||||
}
|
||||
},
|
||||
(view, text, isHashtag) -> {
|
||||
searchUsername(text);
|
||||
});
|
||||
|
||||
dmsBinding.rvDirectMessages.setAdapter(
|
||||
|
@ -104,6 +104,9 @@ public final class StoryViewer extends BaseLanguageActivity {
|
||||
|
||||
if (hasUsername) {
|
||||
storyViewerBinding.toolbar.toolbar.setTitle(username);
|
||||
storyViewerBinding.toolbar.toolbar.setOnClickListener(v -> {
|
||||
searchUsername(username);
|
||||
});
|
||||
if (hasHighlight) storyViewerBinding.toolbar.toolbar.setSubtitle(getString(R.string.title_highlight, highlight));
|
||||
else storyViewerBinding.toolbar.toolbar.setSubtitle(R.string.title_user_story);
|
||||
}
|
||||
@ -344,6 +347,16 @@ public final class StoryViewer extends BaseLanguageActivity {
|
||||
else setupImage();
|
||||
}
|
||||
|
||||
private void searchUsername(final String text) {
|
||||
if (Main.scanHack != null) {
|
||||
Main.scanHack.onResult(text);
|
||||
setResult(6969);
|
||||
Intent intent = new Intent(getApplicationContext(), Main.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
private void releasePlayer() {
|
||||
if (player != null) {
|
||||
try { player.stop(true); } catch (Exception ignored) { }
|
||||
|
@ -6,6 +6,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.text.HtmlCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
@ -85,8 +86,8 @@ public final class DirectMessagesAdapter extends RecyclerView.Adapter<DirectMess
|
||||
else if (itemType == DirectItemType.ACTION_LOG) {
|
||||
final DirectItemActionLogModel logModel = lastItemModel.getActionLogModel();
|
||||
messageText = logModel != null ? logModel.getDescription() : "...";
|
||||
|
||||
} else if (itemType == DirectItemType.REEL_SHARE) {
|
||||
}
|
||||
else if (itemType == DirectItemType.REEL_SHARE) {
|
||||
final DirectItemReelShareModel reelShare = lastItemModel.getReelShare();
|
||||
if (reelShare == null)
|
||||
messageText = context.getString(R.string.direct_messages_sent_media);
|
||||
@ -94,16 +95,20 @@ public final class DirectMessagesAdapter extends RecyclerView.Adapter<DirectMess
|
||||
final String reelType = reelShare.getType();
|
||||
final int textRes;
|
||||
if ("reply".equals(reelType)) textRes = R.string.direct_messages_replied_story;
|
||||
else if ("mention".equals(reelType)) textRes = R.string.direct_messages_mention_story;
|
||||
else if ("reaction".equals(reelType)) textRes = R.string.direct_messages_reacted_story;
|
||||
else if ("mention".equals(reelType))
|
||||
textRes = R.string.direct_messages_mention_story;
|
||||
else if ("reaction".equals(reelType))
|
||||
textRes = R.string.direct_messages_reacted_story;
|
||||
else textRes = R.string.direct_messages_sent_media;
|
||||
|
||||
messageText = context.getString(textRes) + " : " + reelShare.getText();
|
||||
}
|
||||
|
||||
}
|
||||
else if (itemType == DirectItemType.RAVEN_MEDIA) {
|
||||
messageText = context.getString(R.string.direct_messages_sent_media);
|
||||
} else messageText = null;
|
||||
|
||||
holder.tvMessage.setText(messageText);
|
||||
holder.tvMessage.setText(HtmlCompat.fromHtml(messageText.toString(), 63));
|
||||
|
||||
holder.tvDate.setText(lastItemModel.getDateTime());
|
||||
}
|
||||
|
@ -188,10 +188,11 @@ public final class MessageItemsAdapter extends RecyclerView.Adapter<TextMessageV
|
||||
}
|
||||
break;
|
||||
|
||||
case MEDIA_SHARE: {
|
||||
case MEDIA_SHARE:
|
||||
{
|
||||
final ProfileModel modelUser = mediaModel.getUser();
|
||||
if (modelUser != null) {
|
||||
holder.tvMessage.setText(context.getString(R.string.dms_inbox_media_shared_from, modelUser.getUsername()));
|
||||
holder.tvMessage.setText(HtmlCompat.fromHtml("<small>"+context.getString(R.string.dms_inbox_media_shared_from, modelUser.getUsername())+"</small>", 63));
|
||||
holder.tvMessage.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
@ -220,7 +221,8 @@ public final class MessageItemsAdapter extends RecyclerView.Adapter<TextMessageV
|
||||
int textRes = R.string.dms_inbox_raven_media_unknown;
|
||||
if (isExpired) textRes = R.string.dms_inbox_raven_media_expired;
|
||||
|
||||
if (!isExpired && mediaActionSummary != null) {
|
||||
if (!isExpired) {
|
||||
if (mediaActionSummary != null) {
|
||||
final RavenExpiringMediaType expiringMediaType = mediaActionSummary.getType();
|
||||
|
||||
if (expiringMediaType == RavenExpiringMediaType.RAVEN_DELIVERED)
|
||||
@ -241,10 +243,12 @@ public final class MessageItemsAdapter extends RecyclerView.Adapter<TextMessageV
|
||||
textRes = R.string.dms_inbox_raven_media_screenshot;
|
||||
else if (expiringMediaType == RavenExpiringMediaType.RAVEN_CANNOT_DELIVER)
|
||||
textRes = R.string.dms_inbox_raven_media_cant_deliver;
|
||||
}
|
||||
|
||||
final RavenMediaViewType ravenMediaViewType = ravenMediaModel.getViewType();
|
||||
if (ravenMediaViewType == RavenMediaViewType.PERMANENT || ravenMediaViewType == RavenMediaViewType.REPLAYABLE) {
|
||||
final MediaItemType mediaType = mediaModel.getMediaType();
|
||||
textRes = -1;
|
||||
holder.mediaTypeIcon.setVisibility(mediaType == MediaItemType.MEDIA_TYPE_VIDEO ||
|
||||
mediaType == MediaItemType.MEDIA_TYPE_SLIDER ? View.VISIBLE : View.GONE);
|
||||
|
||||
@ -252,10 +256,11 @@ public final class MessageItemsAdapter extends RecyclerView.Adapter<TextMessageV
|
||||
holder.mediaMessageContainer.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
if (textRes != -1) {
|
||||
holder.tvMessage.setText(context.getText(textRes));
|
||||
holder.tvMessage.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case REEL_SHARE: {
|
||||
|
@ -351,16 +351,17 @@ public final class DirectItemModel implements Serializable, Comparable<DirectIte
|
||||
public final static class DirectItemMediaModel implements Serializable {
|
||||
private final MediaItemType mediaType;
|
||||
private final long expiringAt, pk;
|
||||
private final String id, thumbUrl, code;
|
||||
private final String id, thumbUrl, videoUrl, code;
|
||||
private final ProfileModel user;
|
||||
|
||||
public DirectItemMediaModel(final MediaItemType mediaType, final long expiringAt, final long pk, final String id,
|
||||
final String thumbUrl, final ProfileModel user, final String code) {
|
||||
final String thumbUrl, final String videoUrl, final ProfileModel user, final String code) {
|
||||
this.mediaType = mediaType;
|
||||
this.expiringAt = expiringAt;
|
||||
this.pk = pk;
|
||||
this.id = id;
|
||||
this.thumbUrl = thumbUrl;
|
||||
this.videoUrl = videoUrl;
|
||||
this.user = user;
|
||||
this.code = code;
|
||||
}
|
||||
@ -392,6 +393,13 @@ public final class DirectItemModel implements Serializable, Comparable<DirectIte
|
||||
public String getThumbUrl() {
|
||||
return thumbUrl;
|
||||
}
|
||||
|
||||
public String getVideoUrl() {
|
||||
|
||||
if (mediaType == MediaItemType.MEDIA_TYPE_VIDEO) return videoUrl;
|
||||
else return thumbUrl;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public final static class DirectItemRavenMediaModel implements Serializable {
|
||||
|
@ -22,7 +22,7 @@ public final class UpdateChecker extends AsyncTask<Void, Void, Boolean> {
|
||||
@NonNull
|
||||
@Override
|
||||
protected Boolean doInBackground(final Void... voids) {
|
||||
final String UPDATE_BASE_URL = "https://gitlab.com/AwaisKing/instagrabber/-/releases/v";
|
||||
final String UPDATE_BASE_URL = "https://github.com/austinhuang0131/instagrabber/releases/tag/v";
|
||||
final String versionName = BuildConfig.VERSION_NAME;
|
||||
final int index = versionName.indexOf('.');
|
||||
|
||||
|
@ -349,6 +349,16 @@ public final class Utils {
|
||||
return thumbnail;
|
||||
}
|
||||
|
||||
public static String getVideoUrl(@NonNull final JSONObject mediaObj) throws Exception {
|
||||
String thumbnail = null;
|
||||
|
||||
final JSONArray imageVersions = mediaObj.optJSONArray("video_versions");
|
||||
if (imageVersions != null)
|
||||
thumbnail = Utils.getItemThumbnail(imageVersions);
|
||||
|
||||
return thumbnail;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static MediaItemType getMediaItemType(final int mediaType) {
|
||||
if (mediaType == 1) return MediaItemType.MEDIA_TYPE_IMAGE;
|
||||
@ -387,6 +397,7 @@ public final class Utils {
|
||||
mediaObj.optLong("pk"),
|
||||
id,
|
||||
getThumbnailUrl(mediaObj, mediaType),
|
||||
mediaType == MediaItemType.MEDIA_TYPE_VIDEO ? getVideoUrl(mediaObj) : null,
|
||||
user,
|
||||
mediaObj.optString("code"));
|
||||
}
|
||||
@ -521,7 +532,7 @@ public final class Utils {
|
||||
|
||||
linkModel = new DirectItemLinkModel(linkObj.getString("text"),
|
||||
linkObj.getString("client_context"),
|
||||
linkObj.getString("mutation_token"),
|
||||
linkObj.optString("mutation_token"),
|
||||
itemLinkContext);
|
||||
}
|
||||
break;
|
||||
@ -570,7 +581,7 @@ public final class Utils {
|
||||
}
|
||||
|
||||
ravenMediaModel = new DirectItemRavenMediaModel(
|
||||
visualMedia.getLong(viewType == RavenMediaViewType.PERMANENT ? "url_expire_at_secs" : "replay_expiring_at_us"),
|
||||
visualMedia.optLong(viewType == RavenMediaViewType.PERMANENT ? "url_expire_at_secs" : "replay_expiring_at_us"),
|
||||
visualMedia.optInt("playback_duration_secs"),
|
||||
visualMedia.getInt("seen_count"),
|
||||
seenUserIds,
|
||||
@ -618,7 +629,6 @@ public final class Utils {
|
||||
|
||||
case ACTION_LOG:
|
||||
if (inThreadView && itemObject.optInt("hide_in_thread", 0) != 0)
|
||||
// prevents empty viewholders when in thread view mode
|
||||
continue;
|
||||
final JSONObject actionLog = itemObject.getJSONObject("action_log");
|
||||
String desc = actionLog.getString("description");
|
||||
@ -910,7 +920,7 @@ public final class Utils {
|
||||
|
||||
if (main == null) {
|
||||
new DownloadAsync(context,
|
||||
selectedItem.getThumbUrl(),
|
||||
selectedItem.getMediaType() == MediaItemType.MEDIA_TYPE_VIDEO ? selectedItem.getVideoUrl() : selectedItem.getThumbUrl(),
|
||||
getDownloadSaveFileDm(finalDir, selectedItem, ""),
|
||||
null).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
|
||||
@ -929,7 +939,7 @@ public final class Utils {
|
||||
|
||||
@NonNull
|
||||
private static File getDownloadSaveFileDm(final File finalDir, @NonNull final DirectItemMediaModel model, final String sliderPrefix) {
|
||||
final String displayUrl = model.getThumbUrl();
|
||||
final String displayUrl = model.getMediaType() == MediaItemType.MEDIA_TYPE_VIDEO ? model.getVideoUrl() : model.getThumbUrl();
|
||||
return new File(finalDir, model.getId() + sliderPrefix +
|
||||
getExtensionFromModel(displayUrl, model));
|
||||
}
|
||||
|
@ -114,6 +114,7 @@
|
||||
<string name="direct_messages_you">You</string>
|
||||
<string name="direct_messages_sent_link">Shared a link</string>
|
||||
<string name="direct_messages_sent_media">Shared a media</string>
|
||||
<string name="direct_messages_sent_raven">Shared a timed message</string>
|
||||
<string name="direct_messages_replied_story">Replied to a story</string>
|
||||
<string name="direct_messages_reacted_story">Reacted on a story</string>
|
||||
<string name="direct_messages_mention_story">Mentioned in a story</string>
|
||||
|
Loading…
Reference in New Issue
Block a user