1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-22 14:47:29 +00:00

small fixes

This commit is contained in:
Austin Huang 2021-01-10 14:00:31 -05:00
parent 4b055c8050
commit 3f09de05f3
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
4 changed files with 20 additions and 5 deletions

View File

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

View File

@ -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\":" +

View File

@ -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);

View File

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