Browse Source
Merge remote-tracking branch 'origin/dm-notifications-enhancements' into dm-notifications-enhancements
renovate/org.robolectric-robolectric-4.x
Merge remote-tracking branch 'origin/dm-notifications-enhancements' into dm-notifications-enhancements
renovate/org.robolectric-robolectric-4.x
Ammar Githam
4 years ago
41 changed files with 429 additions and 231 deletions
-
4app/build.gradle
-
12app/src/main/java/awais/instagrabber/InstaGrabberApplication.java
-
61app/src/main/java/awais/instagrabber/animations/FabAnimation.java
-
2app/src/main/java/awais/instagrabber/asyncs/CreateThreadAction.java
-
3app/src/main/java/awais/instagrabber/asyncs/FeedPostFetchService.java
-
3app/src/main/java/awais/instagrabber/asyncs/GetActivityAsyncTask.java
-
4app/src/main/java/awais/instagrabber/asyncs/ProfileFetcher.java
-
3app/src/main/java/awais/instagrabber/asyncs/UsernameFetcher.java
-
30app/src/main/java/awais/instagrabber/fragments/CommentsViewerFragment.java
-
2app/src/main/java/awais/instagrabber/fragments/FollowViewerFragment.java
-
5app/src/main/java/awais/instagrabber/fragments/HashTagFragment.java
-
2app/src/main/java/awais/instagrabber/fragments/LikesViewerFragment.java
-
12app/src/main/java/awais/instagrabber/fragments/NotificationsViewerFragment.java
-
38app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java
-
15app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java
-
19app/src/main/java/awais/instagrabber/fragments/main/FeedFragment.java
-
34app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java
-
10app/src/main/java/awais/instagrabber/repositories/FriendshipRepository.java
-
11app/src/main/java/awais/instagrabber/repositories/NewsRepository.java
-
6app/src/main/java/awais/instagrabber/repositories/StoriesRepository.java
-
7app/src/main/java/awais/instagrabber/repositories/responses/Media.java
-
13app/src/main/java/awais/instagrabber/utils/Constants.java
-
2app/src/main/java/awais/instagrabber/utils/DirectItemFactory.java
-
4app/src/main/java/awais/instagrabber/utils/ExportImportUtils.java
-
8app/src/main/java/awais/instagrabber/utils/FlavorTown.java
-
14app/src/main/java/awais/instagrabber/utils/LocaleUtils.java
-
1app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java
-
17app/src/main/java/awais/instagrabber/utils/SettingsHelper.java
-
2app/src/main/java/awais/instagrabber/utils/UpdateChecker.java
-
77app/src/main/java/awais/instagrabber/utils/UserAgentUtils.java
-
10app/src/main/java/awais/instagrabber/viewmodels/DirectSettingsViewModel.java
-
6app/src/main/java/awais/instagrabber/viewmodels/DirectThreadViewModel.java
-
16app/src/main/java/awais/instagrabber/viewmodels/PostViewV2ViewModel.java
-
2app/src/main/java/awais/instagrabber/webservices/AddCookiesInterceptor.java
-
9app/src/main/java/awais/instagrabber/webservices/FeedService.java
-
84app/src/main/java/awais/instagrabber/webservices/FriendshipService.java
-
79app/src/main/java/awais/instagrabber/webservices/MediaService.java
-
12app/src/main/java/awais/instagrabber/webservices/NewsService.java
-
4app/src/main/java/awais/instagrabber/webservices/StoriesService.java
-
15app/src/main/java/awais/instagrabber/webservices/TagsService.java
-
2app/src/main/res/layout/fragment_direct_messages_settings.xml
@ -0,0 +1,61 @@ |
|||
package awais.instagrabber.animations; |
|||
|
|||
import android.animation.Animator; |
|||
import android.animation.AnimatorListenerAdapter; |
|||
import android.view.View; |
|||
|
|||
// https://medium.com/better-programming/animated-fab-button-with-more-options-2dcf7118fff6 |
|||
|
|||
public class FabAnimation { |
|||
public static boolean rotateFab(final View v, boolean rotate) { |
|||
v.animate().setDuration(200) |
|||
.setListener(new AnimatorListenerAdapter() { |
|||
@Override |
|||
public void onAnimationEnd(Animator animation) { |
|||
super.onAnimationEnd(animation); |
|||
} |
|||
}) |
|||
.rotation(rotate ? 135f : 0f); |
|||
return rotate; |
|||
} |
|||
|
|||
public static void showIn(final View v) { |
|||
v.setVisibility(View.VISIBLE); |
|||
v.setAlpha(0f); |
|||
v.setTranslationY(v.getHeight()); |
|||
v.animate() |
|||
.setDuration(200) |
|||
.translationY(0) |
|||
.setListener(new AnimatorListenerAdapter() { |
|||
@Override |
|||
public void onAnimationEnd(Animator animation) { |
|||
super.onAnimationEnd(animation); |
|||
} |
|||
}) |
|||
.alpha(1f) |
|||
.start(); |
|||
} |
|||
|
|||
public static void showOut(final View v) { |
|||
v.setVisibility(View.VISIBLE); |
|||
v.setAlpha(1f); |
|||
v.setTranslationY(0); |
|||
v.animate() |
|||
.setDuration(200) |
|||
.translationY(v.getHeight()) |
|||
.setListener(new AnimatorListenerAdapter() { |
|||
@Override |
|||
public void onAnimationEnd(Animator animation) { |
|||
v.setVisibility(View.GONE); |
|||
super.onAnimationEnd(animation); |
|||
} |
|||
}).alpha(0f) |
|||
.start(); |
|||
} |
|||
|
|||
public static void init(final View v) { |
|||
v.setVisibility(View.GONE); |
|||
v.setTranslationY(v.getHeight()); |
|||
v.setAlpha(0f); |
|||
} |
|||
} |
@ -9,8 +9,10 @@ public final class Constants { |
|||
public static final String APP_THEME = "app_theme_v19"; |
|||
public static final String APP_LANGUAGE = "app_language_v19"; |
|||
public static final String STORY_SORT = "story_sort"; |
|||
// int prefs |
|||
// int prefs, do not export |
|||
public static final String PREV_INSTALL_VERSION = "prevVersion"; |
|||
public static final String BROWSER_UA_CODE = "browser_ua_code"; |
|||
public static final String APP_UA_CODE = "app_ua_code"; |
|||
// boolean prefs |
|||
public static final String DOWNLOAD_USER_FOLDER = "download_user_folder"; |
|||
// deprecated: public static final String BOTTOM_TOOLBAR = "bottom_toolbar"; |
|||
@ -31,6 +33,8 @@ public final class Constants { |
|||
public static final String COOKIE = "cookie"; |
|||
public static final String SHOW_QUICK_ACCESS_DIALOG = "show_quick_dlg"; |
|||
public static final String DEVICE_UUID = "device_uuid"; |
|||
public static final String BROWSER_UA = "browser_ua"; |
|||
public static final String APP_UA = "app_ua"; |
|||
//////////////////////// EXTRAS //////////////////////// |
|||
public static final String EXTRAS_USER = "user"; |
|||
public static final String EXTRAS_HASHTAG = "hashtag"; |
|||
@ -54,13 +58,6 @@ public final class Constants { |
|||
// Notification ids |
|||
public static final int ACTIVITY_NOTIFICATION_ID = 10; |
|||
|
|||
// 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)"; |
|||
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)"; |
|||
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\":" + |
|||
" \"13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,25.0,26.0,27.0,28.0,29.0,30.0,31.0," + |
|||
|
@ -30,7 +30,7 @@ public final class UpdateChecker extends AsyncTask<Void, Void, Boolean> { |
|||
HttpURLConnection conn = |
|||
(HttpURLConnection) new URL("https://f-droid.org/api/v1/packages/me.austinhuang.instagrabber").openConnection(); |
|||
conn.setUseCaches(false); |
|||
conn.setRequestProperty("User-Agent", Constants.A_USER_AGENT); |
|||
conn.setRequestProperty("User-Agent", "https://Barinsta.AustinHuang.me / mailto:[email protected]"); |
|||
conn.connect(); |
|||
|
|||
final int responseCode = conn.getResponseCode(); |
|||
|
@ -0,0 +1,77 @@ |
|||
package awais.instagrabber.utils; |
|||
|
|||
import androidx.annotation.NonNull; |
|||
|
|||
public class UserAgentUtils { |
|||
|
|||
/* GraphQL user agents (which are just standard browser UA's). |
|||
* Go to https://www.whatismybrowser.com/guides/the-latest-user-agent/ to update it |
|||
* Windows first (Assume win64 not wow64): Chrome, Firefox, Edge |
|||
* Then macOS: Chrome, Firefox, Safari |
|||
*/ |
|||
public static final String[] browsers = { |
|||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36", |
|||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0", |
|||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36 Edg/87.0.664.75", |
|||
"Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36", |
|||
"Mozilla/5.0 (Macintosh; Intel Mac OS X 11.1; rv:84.0) Gecko/20100101 Firefox/84.0", |
|||
"Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.2 Safari/605.1.15" |
|||
}; |
|||
// use APKpure, assume x86 |
|||
private static final String igVersion = "169.3.0.30.135"; |
|||
private static final String igVersionCode = "264009054"; |
|||
// https://github.com/dilame/instagram-private-api/blob/master/src/samples/devices.json |
|||
// presumed constant, so no need to update |
|||
public static final String[] devices = { |
|||
"25/7.1.1; 440dpi; 1080x1920; Xiaomi; Mi Note 3; jason; qcom", |
|||
"23/6.0.1; 480dpi; 1080x1920; Xiaomi; Redmi Note 3; kenzo; qcom", |
|||
"23/6.0; 480dpi; 1080x1920; Xiaomi; Redmi Note 4; nikel; mt6797", |
|||
"24/7.0; 480dpi; 1080x1920; Xiaomi/xiaomi; Redmi Note 4; mido; qcom", |
|||
"23/6.0; 480dpi; 1080x1920; Xiaomi; Redmi Note 4X; nikel; mt6797", |
|||
"27/8.1.0; 440dpi; 1080x2030; Xiaomi/xiaomi; Redmi Note 5; whyred; qcom", |
|||
"23/6.0.1; 480dpi; 1080x1920; Xiaomi; Redmi 4; markw; qcom", |
|||
"27/8.1.0; 440dpi; 1080x2030; Xiaomi/xiaomi; Redmi 5 Plus; vince; qcom", |
|||
"25/7.1.2; 440dpi; 1080x2030; Xiaomi/xiaomi; Redmi 5 Plus; vince; qcom", |
|||
"26/8.0.0; 480dpi; 1080x1920; Xiaomi; MI 5; gemini; qcom", |
|||
"27/8.1.0; 480dpi; 1080x1920; Xiaomi/xiaomi; Mi A1; tissot_sprout; qcom", |
|||
"26/8.0.0; 480dpi; 1080x1920; Xiaomi; MI 6; sagit; qcom", |
|||
"25/7.1.1; 440dpi; 1080x1920; Xiaomi; MI MAX 2; oxygen; qcom", |
|||
"24/7.0; 480dpi; 1080x1920; Xiaomi; MI 5s; capricorn; qcom", |
|||
"26/8.0.0; 480dpi; 1080x1920; samsung; SM-A520F; a5y17lte; samsungexynos7880", |
|||
"26/8.0.0; 480dpi; 1080x2076; samsung; SM-G950F; dreamlte; samsungexynos8895", |
|||
"26/8.0.0; 640dpi; 1440x2768; samsung; SM-G950F; dreamlte; samsungexynos8895", |
|||
"26/8.0.0; 420dpi; 1080x2094; samsung; SM-G955F; dream2lte; samsungexynos8895", |
|||
"26/8.0.0; 560dpi; 1440x2792; samsung; SM-G955F; dream2lte; samsungexynos8895", |
|||
"24/7.0; 480dpi; 1080x1920; samsung; SM-A510F; a5xelte; samsungexynos7580", |
|||
"26/8.0.0; 480dpi; 1080x1920; samsung; SM-G930F; herolte; samsungexynos8890", |
|||
"26/8.0.0; 480dpi; 1080x1920; samsung; SM-G935F; hero2lte; samsungexynos8890", |
|||
"26/8.0.0; 420dpi; 1080x2094; samsung; SM-G965F; star2lte; samsungexynos9810", |
|||
"26/8.0.0; 480dpi; 1080x2076; samsung; SM-A530F; jackpotlte; samsungexynos7885", |
|||
"24/7.0; 640dpi; 1440x2560; samsung; SM-G925F; zerolte; samsungexynos7420", |
|||
"26/8.0.0; 420dpi; 1080x1920; samsung; SM-A720F; a7y17lte; samsungexynos7880", |
|||
"24/7.0; 640dpi; 1440x2560; samsung; SM-G920F; zeroflte; samsungexynos7420", |
|||
"24/7.0; 420dpi; 1080x1920; samsung; SM-J730FM; j7y17lte; samsungexynos7870", |
|||
"26/8.0.0; 480dpi; 1080x2076; samsung; SM-G960F; starlte; samsungexynos9810", |
|||
"26/8.0.0; 420dpi; 1080x2094; samsung; SM-N950F; greatlte; samsungexynos8895", |
|||
"26/8.0.0; 420dpi; 1080x2094; samsung; SM-A730F; jackpot2lte; samsungexynos7885", |
|||
"26/8.0.0; 420dpi; 1080x2094; samsung; SM-A605FN; a6plte; qcom", |
|||
"26/8.0.0; 480dpi; 1080x1920; HUAWEI/HONOR; STF-L09; HWSTF; hi3660", |
|||
"27/8.1.0; 480dpi; 1080x2280; HUAWEI/HONOR; COL-L29; HWCOL; kirin970", |
|||
"26/8.0.0; 480dpi; 1080x2032; HUAWEI/HONOR; LLD-L31; HWLLD-H; hi6250", |
|||
"26/8.0.0; 480dpi; 1080x2150; HUAWEI; ANE-LX1; HWANE; hi6250", |
|||
"26/8.0.0; 480dpi; 1080x2032; HUAWEI; FIG-LX1; HWFIG-H; hi6250", |
|||
"27/8.1.0; 480dpi; 1080x2150; HUAWEI/HONOR; COL-L29; HWCOL; kirin970", |
|||
"26/8.0.0; 480dpi; 1080x2038; HUAWEI/HONOR; BND-L21; HWBND-H; hi6250", |
|||
"23/6.0.1; 420dpi; 1080x1920; LeMobile/LeEco; Le X527; le_s2_ww; qcom" |
|||
}; |
|||
|
|||
@NonNull |
|||
public static String generateBrowserUA(final int code) { |
|||
return browsers[code - 1]; |
|||
} |
|||
|
|||
@NonNull |
|||
public static String generateAppUA(final int code, final String lang) { |
|||
return "Instagram " + igVersion + " Android (" + devices[code] + "; " + lang + "; " + igVersionCode + ")"; |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue