Browse Source

small fixes

renovate/org.robolectric-robolectric-4.x
Austin Huang 4 years ago
parent
commit
3f09de05f3
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 15
      app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java
  2. 5
      app/src/main/java/awais/instagrabber/utils/Constants.java
  3. 3
      app/src/main/java/awais/instagrabber/webservices/FeedService.java
  4. 2
      app/src/main/res/layout/fragment_direct_messages_settings.xml

15
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");
}

5
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:[email protected]";
// 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\":" +

3
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<Media> allPosts = new ArrayList<>();
final List<Media> 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);

2
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" />

Loading…
Cancel
Save