From 3f09de05f3a69600492b45d0089a22b48ea624e0 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Sun, 10 Jan 2021 14:00:31 -0500 Subject: [PATCH] small fixes --- .../DirectMessageThreadFragment.java | 15 +++++++++++++++ .../java/awais/instagrabber/utils/Constants.java | 5 ++--- .../instagrabber/webservices/FeedService.java | 3 +-- .../layout/fragment_direct_messages_settings.xml | 2 ++ 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java b/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java index 2328098b..7187820e 100644 --- a/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java @@ -169,6 +169,21 @@ public class DirectMessageThreadFragment extends Fragment { @Override public void onMediaClick(final Media media) { + if (media.isReelMedia()) { + final String pk = media.getPk(); + try { + final long mediaId = Long.parseLong(pk); + final User user = media.getUser(); + if (user == null) return; + final String username = user.getUsername(); + final NavDirections action = DirectMessageThreadFragmentDirections + .actionThreadToStory(StoryViewerOptions.forStory(mediaId, username)); + NavHostFragment.findNavController(DirectMessageThreadFragment.this).navigate(action); + } catch (NumberFormatException e) { + Log.e(TAG, "onMediaClick (story): ", e); + } + return; + } final PostViewV2Fragment.Builder builder = PostViewV2Fragment.builder(media); builder.build().show(getChildFragmentManager(), "post_view"); } diff --git a/app/src/main/java/awais/instagrabber/utils/Constants.java b/app/src/main/java/awais/instagrabber/utils/Constants.java index 46c682c1..51fcf220 100644 --- a/app/src/main/java/awais/instagrabber/utils/Constants.java +++ b/app/src/main/java/awais/instagrabber/utils/Constants.java @@ -56,10 +56,9 @@ public final class Constants { // spoof public static final String USER_AGENT = "Mozilla/5.0 (Linux; Android 8.1.0; motorola one Build/OPKS28.63-18-3; wv) " + - "AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/70.0.3538.80 Mobile Safari/537.36 " + - "Instagram 169.1.0.29.135 Android (27/8.1.0; 320dpi; 720x1362; motorola; motorola one; deen_sprout; qcom; pt_BR; 262886998)"; + "AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/70.0.3538.80 Mobile Safari/537.36"; public static final String I_USER_AGENT = - "Instagram 169.1.0.29.135 Android (27/8.1.0; 320dpi; 720x1362; motorola; motorola one; deen_sprout; qcom; pt_BR; 262886998)"; + "Instagram 169.3.0.30.135 Android (27/8.1.0; 320dpi; 720x1362; motorola; motorola one; deen_sprout; qcom; pt_BR; 264009054)"; public static final String A_USER_AGENT = "https://Barinsta.AustinHuang.me / mailto:Barinsta@AustinHuang.me"; // see https://github.com/dilame/instagram-private-api/blob/master/src/core/constants.ts public static final String SUPPORTED_CAPABILITIES = "[ { \"name\": \"SUPPORTED_SDK_VERSIONS\", \"value\":" + diff --git a/app/src/main/java/awais/instagrabber/webservices/FeedService.java b/app/src/main/java/awais/instagrabber/webservices/FeedService.java index 6ec814c4..08008773 100644 --- a/app/src/main/java/awais/instagrabber/webservices/FeedService.java +++ b/app/src/main/java/awais/instagrabber/webservices/FeedService.java @@ -56,7 +56,6 @@ public class FeedService extends BaseService { form.put("device_id", UUID.randomUUID().toString()); form.put("client_session_id", UUID.randomUUID().toString()); form.put("is_prefetch", "0"); - form.put("timezone_offset", String.valueOf(TimeZone.getDefault().getRawOffset() / 1000)); if (!TextUtils.isEmpty(cursor)) { form.put("max_id", cursor); form.put("reason", "pagination"); @@ -110,7 +109,6 @@ public class FeedService extends BaseService { final List allPosts = new ArrayList<>(); final List items = feedFetchResponse.getItems(); for (final Media media : items) { - if (media.isInjected() || media.getMediaType() == null) continue; if (needNewMaxId && media.getEndOfFeedDemarcator() != null) { final EndOfFeedDemarcator endOfFeedDemarcator = media.getEndOfFeedDemarcator(); final EndOfFeedGroupSet groupSet = endOfFeedDemarcator.getGroupSet(); @@ -129,6 +127,7 @@ public class FeedService extends BaseService { } continue; } + if (media.isInjected() || media.getMediaType() == null) continue; allPosts.add(media); } return new PostsFetchResponse(allPosts, moreAvailable, nextMaxId); diff --git a/app/src/main/res/layout/fragment_direct_messages_settings.xml b/app/src/main/res/layout/fragment_direct_messages_settings.xml index a5116031..1723c9fc 100644 --- a/app/src/main/res/layout/fragment_direct_messages_settings.xml +++ b/app/src/main/res/layout/fragment_direct_messages_settings.xml @@ -72,6 +72,7 @@ android:layout_height="wrap_content" android:paddingStart="0dp" android:paddingEnd="8dp" + android:layout_margin="8dp" app:layout_constraintBottom_toTopOf="@id/mute_mentions" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@id/title_edit_input_layout" /> @@ -98,6 +99,7 @@ android:layout_height="wrap_content" android:paddingStart="0dp" android:paddingEnd="8dp" + android:layout_margin="8dp" app:layout_constraintBottom_toTopOf="@id/leave" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@id/mute_messages" />