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,
|
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 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
|
### How to log in
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ import awais.instagrabber.models.ProfileModel;
|
|||||||
import awais.instagrabber.models.StoryModel;
|
import awais.instagrabber.models.StoryModel;
|
||||||
import awais.instagrabber.models.direct_messages.DirectItemModel;
|
import awais.instagrabber.models.direct_messages.DirectItemModel;
|
||||||
import awais.instagrabber.models.direct_messages.DirectItemModel.DirectItemMediaModel;
|
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.direct_messages.InboxThreadModel;
|
||||||
import awais.instagrabber.models.enums.DirectItemType;
|
import awais.instagrabber.models.enums.DirectItemType;
|
||||||
import awais.instagrabber.models.enums.DownloadMethod;
|
import awais.instagrabber.models.enums.DownloadMethod;
|
||||||
@ -104,46 +105,50 @@ public final class DirectMessagesUserInbox extends AppCompatActivity {
|
|||||||
Object tag = v.getTag();
|
Object tag = v.getTag();
|
||||||
if (tag instanceof DirectItemModel) {
|
if (tag instanceof DirectItemModel) {
|
||||||
directItemModel = (DirectItemModel) tag;
|
directItemModel = (DirectItemModel) tag;
|
||||||
final String username = getUser(directItemModel.getUserId()).getUsername();
|
|
||||||
final DirectItemType itemType = directItemModel.getItemType();
|
final DirectItemType itemType = directItemModel.getItemType();
|
||||||
switch (itemType) {
|
switch (itemType) {
|
||||||
|
case MEDIA_SHARE:
|
||||||
|
startActivity(new Intent(this, PostViewer.class)
|
||||||
|
.putExtra(Constants.EXTRAS_POST, new PostModel(directItemModel.getMediaModel().getCode())));
|
||||||
|
break;
|
||||||
case LINK:
|
case LINK:
|
||||||
Intent linkIntent = new Intent(Intent.ACTION_VIEW);
|
Intent linkIntent = new Intent(Intent.ACTION_VIEW);
|
||||||
linkIntent.setData(Uri.parse(directItemModel.getLinkModel().getLinkContext().getLinkUrl()));
|
linkIntent.setData(Uri.parse(directItemModel.getLinkModel().getLinkContext().getLinkUrl()));
|
||||||
startActivity(linkIntent);
|
startActivity(linkIntent);
|
||||||
break;
|
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 TEXT:
|
||||||
|
case REEL_SHARE:
|
||||||
Utils.copyText(v.getContext(), directItemModel.getText());
|
Utils.copyText(v.getContext(), directItemModel.getText());
|
||||||
Toast.makeText(v.getContext(), R.string.clipboard_copied, Toast.LENGTH_SHORT).show();
|
Toast.makeText(v.getContext(), R.string.clipboard_copied, Toast.LENGTH_SHORT).show();
|
||||||
break;
|
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) -> {
|
(view, text, isHashtag) -> {
|
||||||
|
searchUsername(text);
|
||||||
});
|
});
|
||||||
|
|
||||||
dmsBinding.rvDirectMessages.setAdapter(
|
dmsBinding.rvDirectMessages.setAdapter(
|
||||||
|
@ -104,6 +104,9 @@ public final class StoryViewer extends BaseLanguageActivity {
|
|||||||
|
|
||||||
if (hasUsername) {
|
if (hasUsername) {
|
||||||
storyViewerBinding.toolbar.toolbar.setTitle(username);
|
storyViewerBinding.toolbar.toolbar.setTitle(username);
|
||||||
|
storyViewerBinding.toolbar.toolbar.setOnClickListener(v -> {
|
||||||
|
searchUsername(username);
|
||||||
|
});
|
||||||
if (hasHighlight) storyViewerBinding.toolbar.toolbar.setSubtitle(getString(R.string.title_highlight, highlight));
|
if (hasHighlight) storyViewerBinding.toolbar.toolbar.setSubtitle(getString(R.string.title_highlight, highlight));
|
||||||
else storyViewerBinding.toolbar.toolbar.setSubtitle(R.string.title_user_story);
|
else storyViewerBinding.toolbar.toolbar.setSubtitle(R.string.title_user_story);
|
||||||
}
|
}
|
||||||
@ -344,6 +347,16 @@ public final class StoryViewer extends BaseLanguageActivity {
|
|||||||
else setupImage();
|
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() {
|
private void releasePlayer() {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
try { player.stop(true); } catch (Exception ignored) { }
|
try { player.stop(true); } catch (Exception ignored) { }
|
||||||
|
@ -6,6 +6,7 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.text.HtmlCompat;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
@ -85,8 +86,8 @@ public final class DirectMessagesAdapter extends RecyclerView.Adapter<DirectMess
|
|||||||
else if (itemType == DirectItemType.ACTION_LOG) {
|
else if (itemType == DirectItemType.ACTION_LOG) {
|
||||||
final DirectItemActionLogModel logModel = lastItemModel.getActionLogModel();
|
final DirectItemActionLogModel logModel = lastItemModel.getActionLogModel();
|
||||||
messageText = logModel != null ? logModel.getDescription() : "...";
|
messageText = logModel != null ? logModel.getDescription() : "...";
|
||||||
|
}
|
||||||
} else if (itemType == DirectItemType.REEL_SHARE) {
|
else if (itemType == DirectItemType.REEL_SHARE) {
|
||||||
final DirectItemReelShareModel reelShare = lastItemModel.getReelShare();
|
final DirectItemReelShareModel reelShare = lastItemModel.getReelShare();
|
||||||
if (reelShare == null)
|
if (reelShare == null)
|
||||||
messageText = context.getString(R.string.direct_messages_sent_media);
|
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 String reelType = reelShare.getType();
|
||||||
final int textRes;
|
final int textRes;
|
||||||
if ("reply".equals(reelType)) textRes = R.string.direct_messages_replied_story;
|
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 ("mention".equals(reelType))
|
||||||
else if ("reaction".equals(reelType)) textRes = R.string.direct_messages_reacted_story;
|
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;
|
else textRes = R.string.direct_messages_sent_media;
|
||||||
|
|
||||||
messageText = context.getString(textRes) + " : " + reelShare.getText();
|
messageText = context.getString(textRes) + " : " + reelShare.getText();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (itemType == DirectItemType.RAVEN_MEDIA) {
|
||||||
|
messageText = context.getString(R.string.direct_messages_sent_media);
|
||||||
} else messageText = null;
|
} else messageText = null;
|
||||||
|
|
||||||
holder.tvMessage.setText(messageText);
|
holder.tvMessage.setText(HtmlCompat.fromHtml(messageText.toString(), 63));
|
||||||
|
|
||||||
holder.tvDate.setText(lastItemModel.getDateTime());
|
holder.tvDate.setText(lastItemModel.getDateTime());
|
||||||
}
|
}
|
||||||
|
@ -188,10 +188,11 @@ public final class MessageItemsAdapter extends RecyclerView.Adapter<TextMessageV
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MEDIA_SHARE: {
|
case MEDIA_SHARE:
|
||||||
|
{
|
||||||
final ProfileModel modelUser = mediaModel.getUser();
|
final ProfileModel modelUser = mediaModel.getUser();
|
||||||
if (modelUser != null) {
|
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);
|
holder.tvMessage.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -220,31 +221,34 @@ public final class MessageItemsAdapter extends RecyclerView.Adapter<TextMessageV
|
|||||||
int textRes = R.string.dms_inbox_raven_media_unknown;
|
int textRes = R.string.dms_inbox_raven_media_unknown;
|
||||||
if (isExpired) textRes = R.string.dms_inbox_raven_media_expired;
|
if (isExpired) textRes = R.string.dms_inbox_raven_media_expired;
|
||||||
|
|
||||||
if (!isExpired && mediaActionSummary != null) {
|
if (!isExpired) {
|
||||||
final RavenExpiringMediaType expiringMediaType = mediaActionSummary.getType();
|
if (mediaActionSummary != null) {
|
||||||
|
final RavenExpiringMediaType expiringMediaType = mediaActionSummary.getType();
|
||||||
|
|
||||||
if (expiringMediaType == RavenExpiringMediaType.RAVEN_DELIVERED)
|
if (expiringMediaType == RavenExpiringMediaType.RAVEN_DELIVERED)
|
||||||
textRes = R.string.dms_inbox_raven_media_delivered;
|
textRes = R.string.dms_inbox_raven_media_delivered;
|
||||||
else if (expiringMediaType == RavenExpiringMediaType.RAVEN_SENT)
|
else if (expiringMediaType == RavenExpiringMediaType.RAVEN_SENT)
|
||||||
textRes = R.string.dms_inbox_raven_media_sent;
|
textRes = R.string.dms_inbox_raven_media_sent;
|
||||||
else if (expiringMediaType == RavenExpiringMediaType.RAVEN_OPENED)
|
else if (expiringMediaType == RavenExpiringMediaType.RAVEN_OPENED)
|
||||||
textRes = R.string.dms_inbox_raven_media_opened;
|
textRes = R.string.dms_inbox_raven_media_opened;
|
||||||
else if (expiringMediaType == RavenExpiringMediaType.RAVEN_REPLAYED)
|
else if (expiringMediaType == RavenExpiringMediaType.RAVEN_REPLAYED)
|
||||||
textRes = R.string.dms_inbox_raven_media_replayed;
|
textRes = R.string.dms_inbox_raven_media_replayed;
|
||||||
else if (expiringMediaType == RavenExpiringMediaType.RAVEN_SENDING)
|
else if (expiringMediaType == RavenExpiringMediaType.RAVEN_SENDING)
|
||||||
textRes = R.string.dms_inbox_raven_media_sending;
|
textRes = R.string.dms_inbox_raven_media_sending;
|
||||||
else if (expiringMediaType == RavenExpiringMediaType.RAVEN_BLOCKED)
|
else if (expiringMediaType == RavenExpiringMediaType.RAVEN_BLOCKED)
|
||||||
textRes = R.string.dms_inbox_raven_media_blocked;
|
textRes = R.string.dms_inbox_raven_media_blocked;
|
||||||
else if (expiringMediaType == RavenExpiringMediaType.RAVEN_SUGGESTED)
|
else if (expiringMediaType == RavenExpiringMediaType.RAVEN_SUGGESTED)
|
||||||
textRes = R.string.dms_inbox_raven_media_suggested;
|
textRes = R.string.dms_inbox_raven_media_suggested;
|
||||||
else if (expiringMediaType == RavenExpiringMediaType.RAVEN_SCREENSHOT)
|
else if (expiringMediaType == RavenExpiringMediaType.RAVEN_SCREENSHOT)
|
||||||
textRes = R.string.dms_inbox_raven_media_screenshot;
|
textRes = R.string.dms_inbox_raven_media_screenshot;
|
||||||
else if (expiringMediaType == RavenExpiringMediaType.RAVEN_CANNOT_DELIVER)
|
else if (expiringMediaType == RavenExpiringMediaType.RAVEN_CANNOT_DELIVER)
|
||||||
textRes = R.string.dms_inbox_raven_media_cant_deliver;
|
textRes = R.string.dms_inbox_raven_media_cant_deliver;
|
||||||
|
}
|
||||||
|
|
||||||
final RavenMediaViewType ravenMediaViewType = ravenMediaModel.getViewType();
|
final RavenMediaViewType ravenMediaViewType = ravenMediaModel.getViewType();
|
||||||
if (ravenMediaViewType == RavenMediaViewType.PERMANENT || ravenMediaViewType == RavenMediaViewType.REPLAYABLE) {
|
if (ravenMediaViewType == RavenMediaViewType.PERMANENT || ravenMediaViewType == RavenMediaViewType.REPLAYABLE) {
|
||||||
final MediaItemType mediaType = mediaModel.getMediaType();
|
final MediaItemType mediaType = mediaModel.getMediaType();
|
||||||
|
textRes = -1;
|
||||||
holder.mediaTypeIcon.setVisibility(mediaType == MediaItemType.MEDIA_TYPE_VIDEO ||
|
holder.mediaTypeIcon.setVisibility(mediaType == MediaItemType.MEDIA_TYPE_VIDEO ||
|
||||||
mediaType == MediaItemType.MEDIA_TYPE_SLIDER ? View.VISIBLE : View.GONE);
|
mediaType == MediaItemType.MEDIA_TYPE_SLIDER ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
@ -252,9 +256,10 @@ public final class MessageItemsAdapter extends RecyclerView.Adapter<TextMessageV
|
|||||||
holder.mediaMessageContainer.setVisibility(View.VISIBLE);
|
holder.mediaMessageContainer.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (textRes != -1) {
|
||||||
holder.tvMessage.setText(context.getText(textRes));
|
holder.tvMessage.setText(context.getText(textRes));
|
||||||
holder.tvMessage.setVisibility(View.VISIBLE);
|
holder.tvMessage.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -385,7 +390,7 @@ public final class MessageItemsAdapter extends RecyclerView.Adapter<TextMessageV
|
|||||||
if (users != null) {
|
if (users != null) {
|
||||||
for (final ProfileModel user : users)
|
for (final ProfileModel user : users)
|
||||||
if (Long.toString(userId).equals(user.getId())) return user;
|
if (Long.toString(userId).equals(user.getId())) return user;
|
||||||
return myProfileHolder;
|
return myProfileHolder;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -351,16 +351,17 @@ public final class DirectItemModel implements Serializable, Comparable<DirectIte
|
|||||||
public final static class DirectItemMediaModel implements Serializable {
|
public final static class DirectItemMediaModel implements Serializable {
|
||||||
private final MediaItemType mediaType;
|
private final MediaItemType mediaType;
|
||||||
private final long expiringAt, pk;
|
private final long expiringAt, pk;
|
||||||
private final String id, thumbUrl, code;
|
private final String id, thumbUrl, videoUrl, code;
|
||||||
private final ProfileModel user;
|
private final ProfileModel user;
|
||||||
|
|
||||||
public DirectItemMediaModel(final MediaItemType mediaType, final long expiringAt, final long pk, final String id,
|
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.mediaType = mediaType;
|
||||||
this.expiringAt = expiringAt;
|
this.expiringAt = expiringAt;
|
||||||
this.pk = pk;
|
this.pk = pk;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.thumbUrl = thumbUrl;
|
this.thumbUrl = thumbUrl;
|
||||||
|
this.videoUrl = videoUrl;
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
@ -392,6 +393,13 @@ public final class DirectItemModel implements Serializable, Comparable<DirectIte
|
|||||||
public String getThumbUrl() {
|
public String getThumbUrl() {
|
||||||
return thumbUrl;
|
return thumbUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getVideoUrl() {
|
||||||
|
|
||||||
|
if (mediaType == MediaItemType.MEDIA_TYPE_VIDEO) return videoUrl;
|
||||||
|
else return thumbUrl;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static class DirectItemRavenMediaModel implements Serializable {
|
public final static class DirectItemRavenMediaModel implements Serializable {
|
||||||
|
@ -22,7 +22,7 @@ public final class UpdateChecker extends AsyncTask<Void, Void, Boolean> {
|
|||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
protected Boolean doInBackground(final Void... voids) {
|
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 String versionName = BuildConfig.VERSION_NAME;
|
||||||
final int index = versionName.indexOf('.');
|
final int index = versionName.indexOf('.');
|
||||||
|
|
||||||
|
@ -349,6 +349,16 @@ public final class Utils {
|
|||||||
return thumbnail;
|
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
|
@Nullable
|
||||||
public static MediaItemType getMediaItemType(final int mediaType) {
|
public static MediaItemType getMediaItemType(final int mediaType) {
|
||||||
if (mediaType == 1) return MediaItemType.MEDIA_TYPE_IMAGE;
|
if (mediaType == 1) return MediaItemType.MEDIA_TYPE_IMAGE;
|
||||||
@ -387,6 +397,7 @@ public final class Utils {
|
|||||||
mediaObj.optLong("pk"),
|
mediaObj.optLong("pk"),
|
||||||
id,
|
id,
|
||||||
getThumbnailUrl(mediaObj, mediaType),
|
getThumbnailUrl(mediaObj, mediaType),
|
||||||
|
mediaType == MediaItemType.MEDIA_TYPE_VIDEO ? getVideoUrl(mediaObj) : null,
|
||||||
user,
|
user,
|
||||||
mediaObj.optString("code"));
|
mediaObj.optString("code"));
|
||||||
}
|
}
|
||||||
@ -521,7 +532,7 @@ public final class Utils {
|
|||||||
|
|
||||||
linkModel = new DirectItemLinkModel(linkObj.getString("text"),
|
linkModel = new DirectItemLinkModel(linkObj.getString("text"),
|
||||||
linkObj.getString("client_context"),
|
linkObj.getString("client_context"),
|
||||||
linkObj.getString("mutation_token"),
|
linkObj.optString("mutation_token"),
|
||||||
itemLinkContext);
|
itemLinkContext);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -570,7 +581,7 @@ public final class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ravenMediaModel = new DirectItemRavenMediaModel(
|
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.optInt("playback_duration_secs"),
|
||||||
visualMedia.getInt("seen_count"),
|
visualMedia.getInt("seen_count"),
|
||||||
seenUserIds,
|
seenUserIds,
|
||||||
@ -618,7 +629,6 @@ public final class Utils {
|
|||||||
|
|
||||||
case ACTION_LOG:
|
case ACTION_LOG:
|
||||||
if (inThreadView && itemObject.optInt("hide_in_thread", 0) != 0)
|
if (inThreadView && itemObject.optInt("hide_in_thread", 0) != 0)
|
||||||
// prevents empty viewholders when in thread view mode
|
|
||||||
continue;
|
continue;
|
||||||
final JSONObject actionLog = itemObject.getJSONObject("action_log");
|
final JSONObject actionLog = itemObject.getJSONObject("action_log");
|
||||||
String desc = actionLog.getString("description");
|
String desc = actionLog.getString("description");
|
||||||
@ -910,7 +920,7 @@ public final class Utils {
|
|||||||
|
|
||||||
if (main == null) {
|
if (main == null) {
|
||||||
new DownloadAsync(context,
|
new DownloadAsync(context,
|
||||||
selectedItem.getThumbUrl(),
|
selectedItem.getMediaType() == MediaItemType.MEDIA_TYPE_VIDEO ? selectedItem.getVideoUrl() : selectedItem.getThumbUrl(),
|
||||||
getDownloadSaveFileDm(finalDir, selectedItem, ""),
|
getDownloadSaveFileDm(finalDir, selectedItem, ""),
|
||||||
null).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
null).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
|
||||||
@ -929,7 +939,7 @@ public final class Utils {
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private static File getDownloadSaveFileDm(final File finalDir, @NonNull final DirectItemMediaModel model, final String sliderPrefix) {
|
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 +
|
return new File(finalDir, model.getId() + sliderPrefix +
|
||||||
getExtensionFromModel(displayUrl, model));
|
getExtensionFromModel(displayUrl, model));
|
||||||
}
|
}
|
||||||
|
@ -114,6 +114,7 @@
|
|||||||
<string name="direct_messages_you">You</string>
|
<string name="direct_messages_you">You</string>
|
||||||
<string name="direct_messages_sent_link">Shared a link</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_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_replied_story">Replied to a story</string>
|
||||||
<string name="direct_messages_reacted_story">Reacted on 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>
|
<string name="direct_messages_mention_story">Mentioned in a story</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user