Browse Source
Merge pull request #1 from austinhuang0131/master
Merge pull request #1 from austinhuang0131/master
Upstream from Masterrenovate/org.robolectric-robolectric-4.x
Zerrium
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
65 changed files with 499 additions and 1415 deletions
-
6app/src/main/java/awais/instagrabber/InstaGrabberApplication.java
-
3app/src/main/java/awais/instagrabber/activities/MainActivity.java
-
42app/src/main/java/awais/instagrabber/adapters/FeedStoriesListAdapter.java
-
2app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectItemMediaShareViewHolder.java
-
4app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectItemMediaViewHolder.java
-
3app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectItemProfileViewHolder.java
-
4app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectItemRavenMediaViewHolder.java
-
4app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectItemReelShareViewHolder.java
-
4app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectItemStoryShareViewHolder.java
-
6app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectItemViewHolder.java
-
20app/src/main/java/awais/instagrabber/asyncs/CommentsFetcher.java
-
8app/src/main/java/awais/instagrabber/asyncs/HashtagFetcher.java
-
8app/src/main/java/awais/instagrabber/asyncs/LocationFetcher.java
-
10app/src/main/java/awais/instagrabber/asyncs/PostFetcher.java
-
19app/src/main/java/awais/instagrabber/asyncs/ProfileFetcher.java
-
55app/src/main/java/awais/instagrabber/asyncs/UsernameFetcher.java
-
8app/src/main/java/awais/instagrabber/fragments/HashTagFragment.java
-
8app/src/main/java/awais/instagrabber/fragments/LocationFragment.java
-
7app/src/main/java/awais/instagrabber/fragments/NotificationsViewerFragment.java
-
1app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java
-
32app/src/main/java/awais/instagrabber/fragments/StoryListViewerFragment.java
-
129app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java
-
119app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java
-
169app/src/main/java/awais/instagrabber/fragments/settings/AboutFragment.java
-
14app/src/main/java/awais/instagrabber/fragments/settings/GeneralPreferencesFragment.java
-
9app/src/main/java/awais/instagrabber/models/FeedStoryModel.java
-
1app/src/main/java/awais/instagrabber/utils/Constants.java
-
6app/src/main/java/awais/instagrabber/utils/CookieUtils.java
-
34app/src/main/java/awais/instagrabber/utils/ExportImportUtils.java
-
57app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java
-
4app/src/main/java/awais/instagrabber/utils/SettingsHelper.java
-
2app/src/main/java/awais/instagrabber/utils/UserAgentUtils.java
-
4app/src/main/java/awais/instagrabber/utils/Utils.java
-
45app/src/main/java/awais/instagrabber/viewmodels/AppStateViewModel.java
-
1app/src/main/java/awais/instagrabber/viewmodels/DirectThreadViewModel.java
-
16app/src/main/java/awais/instagrabber/workers/DownloadWorker.java
-
130app/src/main/java/awaisomereport/CrashReporter.java
-
2app/src/main/java/awaisomereport/ErrorReporterActivity.java
-
4app/src/main/java/awaisomereport/LogCollector.java
-
13app/src/main/res/menu/search.xml
-
36app/src/main/res/values-ca/strings.xml
-
36app/src/main/res/values-cs/strings.xml
-
36app/src/main/res/values-de/strings.xml
-
36app/src/main/res/values-el/strings.xml
-
36app/src/main/res/values-es/strings.xml
-
36app/src/main/res/values-eu/strings.xml
-
36app/src/main/res/values-fa/strings.xml
-
36app/src/main/res/values-fr/strings.xml
-
36app/src/main/res/values-hi/strings.xml
-
36app/src/main/res/values-in/strings.xml
-
36app/src/main/res/values-it/strings.xml
-
36app/src/main/res/values-ja/strings.xml
-
36app/src/main/res/values-kn/strings.xml
-
36app/src/main/res/values-mk/strings.xml
-
36app/src/main/res/values-nl/strings.xml
-
36app/src/main/res/values-or/strings.xml
-
36app/src/main/res/values-pl/strings.xml
-
36app/src/main/res/values-pt/strings.xml
-
36app/src/main/res/values-ru/strings.xml
-
36app/src/main/res/values-sk/strings.xml
-
36app/src/main/res/values-tr/strings.xml
-
36app/src/main/res/values-vi/strings.xml
-
36app/src/main/res/values-zh-rCN/strings.xml
-
36app/src/main/res/values-zh-rTW/strings.xml
-
37app/src/main/res/values/strings.xml
@ -1,55 +0,0 @@ |
|||
package awais.instagrabber.asyncs; |
|||
|
|||
import android.os.AsyncTask; |
|||
import android.util.Log; |
|||
|
|||
import androidx.annotation.Nullable; |
|||
|
|||
import org.json.JSONObject; |
|||
|
|||
import java.net.HttpURLConnection; |
|||
import java.net.URL; |
|||
|
|||
import awais.instagrabber.BuildConfig; |
|||
import awais.instagrabber.interfaces.FetchListener; |
|||
import awais.instagrabber.utils.Constants; |
|||
import awais.instagrabber.utils.NetworkUtils; |
|||
import awais.instagrabber.utils.Utils; |
|||
|
|||
public final class UsernameFetcher extends AsyncTask<Void, Void, String> { |
|||
private final FetchListener<String> fetchListener; |
|||
private final long uid; |
|||
|
|||
public UsernameFetcher(final long uid, final FetchListener<String> fetchListener) { |
|||
this.uid = uid; |
|||
this.fetchListener = fetchListener; |
|||
} |
|||
|
|||
@Nullable |
|||
@Override |
|||
protected String doInBackground(final Void... voids) { |
|||
String result = null; |
|||
|
|||
try { |
|||
final HttpURLConnection conn = (HttpURLConnection) new URL("https://i.instagram.com/api/v1/users/" + uid + "/info/").openConnection(); |
|||
conn.setRequestProperty("User-Agent", Utils.settingsHelper.getString(Constants.BROWSER_UA)); |
|||
conn.setUseCaches(true); |
|||
|
|||
final JSONObject user; |
|||
if (conn.getResponseCode() == HttpURLConnection.HTTP_OK && |
|||
(user = new JSONObject(NetworkUtils.readFromConnection(conn)).optJSONObject(Constants.EXTRAS_USER)) != null) |
|||
result = user.getString(Constants.EXTRAS_USERNAME); |
|||
|
|||
conn.disconnect(); |
|||
} catch (final Exception e) { |
|||
if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "", e); |
|||
} |
|||
|
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
protected void onPostExecute(final String result) { |
|||
if (fetchListener != null) fetchListener.onResult(result); |
|||
} |
|||
} |
@ -19,8 +19,8 @@ import java.io.PrintWriter; |
|||
import java.io.StringWriter; |
|||
import java.io.Writer; |
|||
import java.util.Date; |
|||
import java.util.zip.ZipEntry; |
|||
import java.util.zip.ZipOutputStream; |
|||
//import java.util.zip.ZipEntry; |
|||
//import java.util.zip.ZipOutputStream; |
|||
|
|||
import awais.instagrabber.BuildConfig; |
|||
import awais.instagrabber.utils.Utils; |
|||
@ -29,7 +29,7 @@ public final class CrashReporter implements Thread.UncaughtExceptionHandler { |
|||
private static CrashReporter reporterInstance; |
|||
private final Application application; |
|||
private final String email; |
|||
private final File crashLogsZip; |
|||
// private final File crashLogsZip; |
|||
private boolean startAttempted = false; |
|||
|
|||
public static CrashReporter get(final Application application) { |
|||
@ -40,7 +40,7 @@ public final class CrashReporter implements Thread.UncaughtExceptionHandler { |
|||
private CrashReporter(@NonNull final Application application) { |
|||
this.application = application; |
|||
this.email = "[email protected]"; |
|||
this.crashLogsZip = new File(application.getExternalCacheDir(), "crash_logs.zip"); |
|||
// this.crashLogsZip = new File(application.getExternalCacheDir(), "crash_logs.zip"); |
|||
} |
|||
|
|||
public void start() { |
|||
@ -99,94 +99,88 @@ public final class CrashReporter implements Thread.UncaughtExceptionHandler { |
|||
|
|||
application.startActivity(new Intent(application, ErrorReporterActivity.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); |
|||
|
|||
zipLogs(); |
|||
// zipLogs(); |
|||
|
|||
Process.killProcess(Process.myPid()); |
|||
System.exit(10); |
|||
} |
|||
|
|||
public synchronized CrashReporter zipLogs() { |
|||
final File logDir = Utils.logCollector != null ? Utils.logCollector.getLogDir() : |
|||
new File(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ? application.getDataDir() : application.getFilesDir(), "crashlogs"); |
|||
|
|||
try (final FileOutputStream fos = new FileOutputStream(crashLogsZip); |
|||
final ZipOutputStream zos = new ZipOutputStream(fos)) { |
|||
|
|||
final File[] files = logDir.listFiles(); |
|||
|
|||
if (files != null) { |
|||
zos.setLevel(5); |
|||
byte[] buffer; |
|||
for (final File file : files) { |
|||
if (file != null && file.length() > 0) { |
|||
buffer = new byte[1024]; |
|||
try (final FileInputStream fis = new FileInputStream(file)) { |
|||
zos.putNextEntry(new ZipEntry(file.getName())); |
|||
int length; |
|||
while ((length = fis.read(buffer)) > 0) zos.write(buffer, 0, length); |
|||
zos.closeEntry(); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
} catch (final Exception e) { |
|||
if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "", e); |
|||
} |
|||
|
|||
return this; |
|||
} |
|||
// public synchronized CrashReporter zipLogs() { |
|||
// final File logDir = Utils.logCollector != null ? Utils.logCollector.getLogDir() : |
|||
// new File(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ? application.getDataDir() : application.getFilesDir(), "crashlogs"); |
|||
// |
|||
// try (final FileOutputStream fos = new FileOutputStream(crashLogsZip); |
|||
// final ZipOutputStream zos = new ZipOutputStream(fos)) { |
|||
// |
|||
// final File[] files = logDir.listFiles(); |
|||
// |
|||
// if (files != null) { |
|||
// zos.setLevel(5); |
|||
// byte[] buffer; |
|||
// for (final File file : files) { |
|||
// if (file != null && file.length() > 0) { |
|||
// buffer = new byte[1024]; |
|||
// try (final FileInputStream fis = new FileInputStream(file)) { |
|||
// zos.putNextEntry(new ZipEntry(file.getName())); |
|||
// int length; |
|||
// while ((length = fis.read(buffer)) > 0) zos.write(buffer, 0, length); |
|||
// zos.closeEntry(); |
|||
// } |
|||
// } |
|||
// } |
|||
// } |
|||
// |
|||
// } catch (final Exception e) { |
|||
// if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "", e); |
|||
// } |
|||
// |
|||
// return this; |
|||
// } |
|||
|
|||
@SuppressWarnings("ResultOfMethodCallIgnored") |
|||
public void startCrashEmailIntent(final Context context, final boolean sendZipsOnly) { |
|||
public void startCrashEmailIntent(final Context context) { |
|||
try { |
|||
final String filePath = context.getFilesDir().getAbsolutePath(); |
|||
|
|||
String[] errorFileList; |
|||
|
|||
if (sendZipsOnly) errorFileList = null; |
|||
else { |
|||
try { |
|||
final File dir = new File(filePath); |
|||
if (dir.exists() && !dir.isDirectory()) dir.delete(); |
|||
dir.mkdir(); |
|||
errorFileList = dir.list((d, name) -> name.endsWith(".stacktrace")); |
|||
} catch (final Exception e) { |
|||
errorFileList = null; |
|||
} |
|||
try { |
|||
final File dir = new File(filePath); |
|||
if (dir.exists() && !dir.isDirectory()) dir.delete(); |
|||
dir.mkdir(); |
|||
errorFileList = dir.list((d, name) -> name.endsWith(".stacktrace")); |
|||
} catch (final Exception e) { |
|||
errorFileList = null; |
|||
} |
|||
|
|||
if ((errorFileList != null && errorFileList.length > 0) || sendZipsOnly) { |
|||
if (errorFileList != null && errorFileList.length > 0) { |
|||
final StringBuilder errorStringBuilder; |
|||
|
|||
if (sendZipsOnly) errorStringBuilder = new StringBuilder("(Not a crash)\n\n"); |
|||
else { |
|||
errorStringBuilder = new StringBuilder("\r\n\r\n"); |
|||
final int maxSendMail = 5; |
|||
|
|||
int curIndex = 0; |
|||
for (final String curString : errorFileList) { |
|||
final File file = new File(filePath + '/' + curString); |
|||
|
|||
if (curIndex++ <= maxSendMail) { |
|||
errorStringBuilder.append("New Trace collected:\r\n=====================\r\n"); |
|||
try (final BufferedReader input = new BufferedReader(new FileReader(file))) { |
|||
String line; |
|||
while ((line = input.readLine()) != null) |
|||
errorStringBuilder.append(line).append("\r\n"); |
|||
} |
|||
} |
|||
errorStringBuilder = new StringBuilder("\r\n\r\n"); |
|||
final int maxSendMail = 5; |
|||
|
|||
file.delete(); |
|||
int curIndex = 0; |
|||
for (final String curString : errorFileList) { |
|||
final File file = new File(filePath + '/' + curString); |
|||
|
|||
if (curIndex++ <= maxSendMail) { |
|||
errorStringBuilder.append("New Trace collected:\r\n=====================\r\n"); |
|||
try (final BufferedReader input = new BufferedReader(new FileReader(file))) { |
|||
String line; |
|||
while ((line = input.readLine()) != null) |
|||
errorStringBuilder.append(line).append("\r\n"); |
|||
} |
|||
} |
|||
|
|||
errorStringBuilder.append("\r\n\r\n"); |
|||
file.delete(); |
|||
} |
|||
|
|||
errorStringBuilder.append("\r\n\r\n"); |
|||
|
|||
context.startActivity(Intent.createChooser(new Intent(Intent.ACTION_SEND).setType("message/rfc822") |
|||
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION) |
|||
.putExtra(Intent.EXTRA_EMAIL, new String[]{email}) |
|||
.putExtra(Intent.EXTRA_STREAM, FileProvider.getUriForFile(application, BuildConfig.APPLICATION_ID + ".provider", crashLogsZip)) |
|||
// .putExtra(Intent.EXTRA_STREAM, FileProvider.getUriForFile(application, BuildConfig.APPLICATION_ID + ".provider", crashLogsZip)) |
|||
.putExtra(Intent.EXTRA_SUBJECT, "Barinsta Crash Report") |
|||
.putExtra(Intent.EXTRA_TEXT, errorStringBuilder.toString()), "Select an email app to send crash logs")); |
|||
} |
|||
|
@ -0,0 +1,13 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<menu xmlns:android="http://schemas.android.com/apk/res/android" |
|||
xmlns:app="http://schemas.android.com/apk/res-auto"> |
|||
|
|||
<item |
|||
android:id="@+id/action_search" |
|||
android:actionLayout="@layout/layout_searchview" |
|||
android:icon="@drawable/ic_search_24" |
|||
android:title="@string/action_search" |
|||
android:titleCondensed="@string/action_search" |
|||
app:actionViewClass="androidx.appcompat.widget.SearchView" |
|||
app:showAsAction="always|collapseActionView" /> |
|||
</menu> |
@ -19,15 +19,12 @@ |
|||
<string name="cancel">Cancel</string> |
|||
<string name="no">No</string> |
|||
<string name="confirm">Confirm</string> |
|||
<string name="nav_up">Up</string> |
|||
<string name="dont_show_again">Don\'t Show Again</string> |
|||
<string name="selected_folder_label">Current directory</string> |
|||
<string name="title_favorites">Favorites</string> |
|||
<string name="title_discover">Discover</string> |
|||
<string name="title_comments">Comments</string> |
|||
<string name="title_notifications">Activity</string> |
|||
<string name="title_highlight">Highlight: %s</string> |
|||
<string name="update_check">Check for updates at startup</string> |
|||
<string name="flag_secure">Block screenshots & app preview</string> |
|||
<string name="download_user_folder">Download posts to username folders</string> |
|||
<string name="mark_as_seen_setting">Mark stories as seen after viewing</string> |
|||
<string name="mark_as_seen_setting_summary">Story author will know you viewed it</string> |
|||
@ -45,8 +42,6 @@ |
|||
<string name="theme_settings">Theme</string> |
|||
<string name="login_settings">Only affects logged-in users:</string> |
|||
<string name="anonymous_settings">Only affects anonymous users:</string> |
|||
<string name="instadp_settings">Use Instadp for high definition profile pictures</string> |
|||
<string name="import_export">Import/Export</string> |
|||
<string name="select_language">Language</string> |
|||
<plurals name="main_posts_count"> |
|||
<item quantity="one">%s\nPost</item> |
|||
@ -93,11 +88,8 @@ |
|||
<string name="priv_acc">This Account is Private</string> |
|||
<string name="priv_acc_confirm">You won\'t be able to access posts after unfollowing! Are you sure?</string> |
|||
<string name="no_acc">You can log in via More -> Account on the bottom-right corner or you can view public accounts without login!</string> |
|||
<string name="no_acc_logged_in">You can swipe left/right for explore/feed, or search something below!</string> |
|||
<string name="empty_acc">This Account has No Posts</string> |
|||
<string name="empty_list">No Such Posts!</string> |
|||
<string name="curr_version">Current version: v%s</string> |
|||
<string name="read_more">read more…</string> |
|||
<string name="login">Login</string> |
|||
<string name="logout">Logout</string> |
|||
<string name="logout_summary">Browse Instagram anonymously</string> |
|||
@ -136,21 +128,13 @@ |
|||
<string name="status_following">Following</string> |
|||
<string name="status_follower">Follower</string> |
|||
<string name="map">Map</string> |
|||
<string name="dialog_export_btn_export">Export</string> |
|||
<string name="dialog_export_btn_import">Import</string> |
|||
<string name="dialog_export_logins">Export Logins</string> |
|||
<string name="dialog_export_accounts">Accounts</string> |
|||
<string name="dialog_export_settings">Settings</string> |
|||
<string name="dialog_export_favorites">Favorites</string> |
|||
<string name="dialog_import_settings">Import settings</string> |
|||
<string name="dialog_import_logins">Import Logins</string> |
|||
<string name="dialog_import_accounts">Import accounts</string> |
|||
<string name="dialog_import_favorites">Import favorites</string> |
|||
<string name="dialog_import_success">Successfully imported!</string> |
|||
<string name="dialog_import_failed">Failed to import!</string> |
|||
<string name="dialog_export_success">Successfully exported!</string> |
|||
<string name="dialog_export_failed">Failed to export!</string> |
|||
<string name="dialog_export_err_password_empty">Password is empty!</string> |
|||
<string name="refresh">Refresh</string> |
|||
<string name="get_cookies">Get cookies</string> |
|||
<string name="desktop_2fa">Desktop Mode</string> |
|||
@ -165,21 +149,8 @@ |
|||
<string name="open_profile">Open profile</string> |
|||
<string name="view_story">View story</string> |
|||
<string name="view_pfp">View profile picture</string> |
|||
<string name="direct_messages_you">You</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_raven">Shared a timed message</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_mention_story">Mentioned in a story</string> |
|||
<string name="dms_inbox_raven_message_unknown">Unsupported message type</string> |
|||
<string name="dms_inbox_open_link">Open link</string> |
|||
<string name="dms_inbox_copy_text">Copy text</string> |
|||
<string name="dms_inbox_download">Download attachment</string> |
|||
<string name="dms_inbox_like">Like message</string> |
|||
<string name="dms_inbox_unlike">Unlike message</string> |
|||
<string name="dms_inbox_unsend">Unsend message</string> |
|||
<string name="dms_inbox_author">View author profile</string> |
|||
<string name="dms_inbox_giphy">View on GIPHY</string> |
|||
<string name="dms_inbox_shared_post">%s shared a post by @%s</string> |
|||
<string name="dms_inbox_shared_image">%s shared an image</string> |
|||
@ -215,7 +186,6 @@ |
|||
<string name="dms_thread_message_hint">Message...</string> |
|||
<string name="dms_thread_audio_hint">Press and hold to record audio</string> |
|||
<string name="dms_thread_updating">Updating...</string> |
|||
<string name="dms_action_success">Great success!</string> |
|||
<string name="dms_action_leave">Leave chat</string> |
|||
<string name="dms_action_leave_question">Leave this chat?</string> |
|||
<string name="dms_action_kick">Kick</string> |
|||
@ -226,18 +196,14 @@ |
|||
<string name="direct_download">Download directly</string> |
|||
<string name="direct_download_desc">Downloads posts directly to the phone!</string> |
|||
<string name="direct_download_loading">Fetching post(s)</string> |
|||
<string name="direct_download_perms_ask">Please grant permissions and try downloading again!</string> |
|||
<string name="downloader_started">Download started</string> |
|||
<string name="downloader_complete">Download completed</string> |
|||
<string name="downloader_downloading_post">Downloading post…</string> |
|||
<string name="downloader_downloading_media">Downloading media</string> |
|||
<string name="downloader_downloading_pfp">Downloading profile picture</string> |
|||
<string name="downloader_downloaded_in_folder">File downloaded in Downloads folder!</string> |
|||
<string name="downloader_unknown_error">Unknown error occurred!!!</string> |
|||
<string name="downloader_error_creating_folder">Error creating folder!</string> |
|||
<string name="downloader_error_download_file">Error downloading file</string> |
|||
<string name="downloader_too_many">You can only download 100 posts at a time. Don\'t be too greedy!</string> |
|||
<string name="comment_viewer_copy_user">Copy username</string> |
|||
<string name="comment_viewer_copy_comment">Copy comment</string> |
|||
<string name="comment_viewer_see_likers">View comment likers</string> |
|||
<string name="comment_viewer_reply_comment">Reply to comment</string> |
|||
@ -314,7 +280,6 @@ |
|||
<string name="about_feedback">Send feedback by email</string> |
|||
<string name="about_feedback_summary" translatable="false">[email protected]</string> |
|||
<string name="about_category_3pt">Third-Party Attributions</string> |
|||
<string name="about_category_3pt_summary">The following third-party open-source libraries are used:</string> |
|||
<string name="reminder">Reminder</string> |
|||
<string name="reminder_summary">Please use this app responsibly. Downloaded images should only be used for purposes allowed by applicable laws.</string> |
|||
<string name="light_white_theme">White</string> |
|||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue