1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-08 07:57:28 +00:00

disable LogCollector

This commit is contained in:
Austin Huang 2021-03-18 21:20:15 -04:00
parent 7f4196e119
commit 8a0f119970
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
16 changed files with 141 additions and 147 deletions

View File

@ -18,14 +18,14 @@ import awais.instagrabber.utils.LocaleUtils;
import awais.instagrabber.utils.SettingsHelper; import awais.instagrabber.utils.SettingsHelper;
import awais.instagrabber.utils.TextUtils; import awais.instagrabber.utils.TextUtils;
import awaisomereport.CrashReporter; import awaisomereport.CrashReporter;
import awaisomereport.LogCollector; //import awaisomereport.LogCollector;
import static awais.instagrabber.utils.CookieUtils.NET_COOKIE_MANAGER; import static awais.instagrabber.utils.CookieUtils.NET_COOKIE_MANAGER;
import static awais.instagrabber.utils.Utils.applicationHandler; import static awais.instagrabber.utils.Utils.applicationHandler;
import static awais.instagrabber.utils.Utils.cacheDir; import static awais.instagrabber.utils.Utils.cacheDir;
import static awais.instagrabber.utils.Utils.clipboardManager; import static awais.instagrabber.utils.Utils.clipboardManager;
import static awais.instagrabber.utils.Utils.datetimeParser; import static awais.instagrabber.utils.Utils.datetimeParser;
import static awais.instagrabber.utils.Utils.logCollector; //import static awais.instagrabber.utils.Utils.logCollector;
import static awais.instagrabber.utils.Utils.settingsHelper; import static awais.instagrabber.utils.Utils.settingsHelper;
public final class InstaGrabberApplication extends Application { public final class InstaGrabberApplication extends Application {
@ -56,7 +56,7 @@ public final class InstaGrabberApplication extends Application {
} }
if (!BuildConfig.DEBUG) CrashReporter.get(this).start(); if (!BuildConfig.DEBUG) CrashReporter.get(this).start();
logCollector = new LogCollector(this); // logCollector = new LogCollector(this);
CookieHandler.setDefault(NET_COOKIE_MANAGER); CookieHandler.setDefault(NET_COOKIE_MANAGER);

View File

@ -22,9 +22,9 @@ import awais.instagrabber.repositories.responses.User;
import awais.instagrabber.utils.Constants; import awais.instagrabber.utils.Constants;
import awais.instagrabber.utils.NetworkUtils; import awais.instagrabber.utils.NetworkUtils;
import awais.instagrabber.utils.TextUtils; import awais.instagrabber.utils.TextUtils;
import awaisomereport.LogCollector; //import awaisomereport.LogCollector;
import static awais.instagrabber.utils.Utils.logCollector; //import static awais.instagrabber.utils.Utils.logCollector;
public final class CommentsFetcher extends AsyncTask<Void, Void, List<CommentModel>> { public final class CommentsFetcher extends AsyncTask<Void, Void, List<CommentModel>> {
private static final String TAG = "CommentsFetcher"; private static final String TAG = "CommentsFetcher";
@ -130,11 +130,11 @@ public final class CommentsFetcher extends AsyncTask<Void, Void, List<CommentMod
} }
conn.disconnect(); conn.disconnect();
} catch (final Exception e) { } catch (final Exception e) {
if (logCollector != null) // if (logCollector != null)
logCollector.appendException(e, // logCollector.appendException(e,
LogCollector.LogFile.ASYNC_COMMENTS_FETCHER, // LogCollector.LogFile.ASYNC_COMMENTS_FETCHER,
"getChildComments", // "getChildComments",
new Pair<>("commentModels.size", commentModels.size())); // new Pair<>("commentModels.size", commentModels.size()));
if (BuildConfig.DEBUG) Log.e(TAG, "", e); if (BuildConfig.DEBUG) Log.e(TAG, "", e);
if (fetchListener != null) fetchListener.onFailure(e); if (fetchListener != null) fetchListener.onFailure(e);
break; break;
@ -256,9 +256,9 @@ public final class CommentsFetcher extends AsyncTask<Void, Void, List<CommentMod
conn.disconnect(); conn.disconnect();
} catch (final Exception e) { } catch (final Exception e) {
if (logCollector != null) // if (logCollector != null)
logCollector.appendException(e, LogCollector.LogFile.ASYNC_COMMENTS_FETCHER, "getParentComments", // logCollector.appendException(e, LogCollector.LogFile.ASYNC_COMMENTS_FETCHER, "getParentComments",
new Pair<>("commentModelsList.size", commentModels.size())); // new Pair<>("commentModelsList.size", commentModels.size()));
if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "", e); if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "", e);
if (fetchListener != null) fetchListener.onFailure(e); if (fetchListener != null) fetchListener.onFailure(e);
return null; return null;

View File

@ -20,9 +20,9 @@ import awais.instagrabber.interfaces.FetchListener;
import awais.instagrabber.models.HashtagModel; import awais.instagrabber.models.HashtagModel;
import awais.instagrabber.utils.Constants; import awais.instagrabber.utils.Constants;
import awais.instagrabber.utils.NetworkUtils; import awais.instagrabber.utils.NetworkUtils;
import awaisomereport.LogCollector; //import awaisomereport.LogCollector;
import static awais.instagrabber.utils.Utils.logCollector; //import static awais.instagrabber.utils.Utils.logCollector;
public final class HashtagFetcher extends AsyncTask<Void, Void, HashtagModel> { public final class HashtagFetcher extends AsyncTask<Void, Void, HashtagModel> {
private static final String TAG = "HashtagFetcher"; private static final String TAG = "HashtagFetcher";
@ -86,8 +86,8 @@ public final class HashtagFetcher extends AsyncTask<Void, Void, HashtagModel> {
conn.disconnect(); conn.disconnect();
} catch (final Exception e) { } catch (final Exception e) {
if (logCollector != null) // if (logCollector != null)
logCollector.appendException(e, LogCollector.LogFile.ASYNC_HASHTAG_FETCHER, "doInBackground"); // logCollector.appendException(e, LogCollector.LogFile.ASYNC_HASHTAG_FETCHER, "doInBackground");
if (BuildConfig.DEBUG) Log.e(TAG, "", e); if (BuildConfig.DEBUG) Log.e(TAG, "", e);
if (fetchListener != null) fetchListener.onFailure(e); if (fetchListener != null) fetchListener.onFailure(e);
} }

View File

@ -16,9 +16,9 @@ import awais.instagrabber.interfaces.FetchListener;
import awais.instagrabber.models.LocationModel; import awais.instagrabber.models.LocationModel;
import awais.instagrabber.utils.Constants; import awais.instagrabber.utils.Constants;
import awais.instagrabber.utils.NetworkUtils; import awais.instagrabber.utils.NetworkUtils;
import awaisomereport.LogCollector; //import awaisomereport.LogCollector;
import static awais.instagrabber.utils.Utils.logCollector; //import static awais.instagrabber.utils.Utils.logCollector;
public final class LocationFetcher extends AsyncTask<Void, Void, LocationModel> { public final class LocationFetcher extends AsyncTask<Void, Void, LocationModel> {
private static final String TAG = "LocationFetcher"; private static final String TAG = "LocationFetcher";
@ -65,8 +65,8 @@ public final class LocationFetcher extends AsyncTask<Void, Void, LocationModel>
conn.disconnect(); conn.disconnect();
} catch (final Exception e) { } catch (final Exception e) {
if (logCollector != null) // if (logCollector != null)
logCollector.appendException(e, LogCollector.LogFile.ASYNC_LOCATION_FETCHER, "doInBackground"); // logCollector.appendException(e, LogCollector.LogFile.ASYNC_LOCATION_FETCHER, "doInBackground");
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
Log.e(TAG, "", e); Log.e(TAG, "", e);
} }

View File

@ -12,9 +12,9 @@ import awais.instagrabber.interfaces.FetchListener;
import awais.instagrabber.repositories.responses.Media; import awais.instagrabber.repositories.responses.Media;
import awais.instagrabber.utils.NetworkUtils; import awais.instagrabber.utils.NetworkUtils;
import awais.instagrabber.utils.ResponseBodyUtils; import awais.instagrabber.utils.ResponseBodyUtils;
import awaisomereport.LogCollector; //import awaisomereport.LogCollector;
import static awais.instagrabber.utils.Utils.logCollector; //import static awais.instagrabber.utils.Utils.logCollector;
public final class PostFetcher extends AsyncTask<Void, Void, Media> { public final class PostFetcher extends AsyncTask<Void, Void, Media> {
private static final String TAG = "PostFetcher"; private static final String TAG = "PostFetcher";
@ -136,9 +136,9 @@ public final class PostFetcher extends AsyncTask<Void, Void, Media> {
return ResponseBodyUtils.parseGraphQLItem(media); return ResponseBodyUtils.parseGraphQLItem(media);
} }
} catch (Exception e) { } catch (Exception e) {
if (logCollector != null) { // if (logCollector != null) {
logCollector.appendException(e, LogCollector.LogFile.ASYNC_POST_FETCHER, "doInBackground"); // logCollector.appendException(e, LogCollector.LogFile.ASYNC_POST_FETCHER, "doInBackground");
} // }
Log.e(TAG, "Error fetching post", e); Log.e(TAG, "Error fetching post", e);
} finally { } finally {
if (conn != null) { if (conn != null) {

View File

@ -70,11 +70,11 @@ import awais.instagrabber.utils.Utils;
import awais.instagrabber.webservices.ServiceCallback; import awais.instagrabber.webservices.ServiceCallback;
import awais.instagrabber.webservices.StoriesService; import awais.instagrabber.webservices.StoriesService;
import awais.instagrabber.webservices.TagsService; import awais.instagrabber.webservices.TagsService;
import awaisomereport.LogCollector; //import awaisomereport.LogCollector;
import static androidx.core.content.PermissionChecker.checkSelfPermission; import static androidx.core.content.PermissionChecker.checkSelfPermission;
import static awais.instagrabber.utils.DownloadUtils.WRITE_PERMISSION; import static awais.instagrabber.utils.DownloadUtils.WRITE_PERMISSION;
import static awais.instagrabber.utils.Utils.logCollector; //import static awais.instagrabber.utils.Utils.logCollector;
import static awais.instagrabber.utils.Utils.settingsHelper; import static awais.instagrabber.utils.Utils.settingsHelper;
public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener { public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener {
@ -607,8 +607,8 @@ public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRe
try { try {
currentlyExecuting.cancel(true); currentlyExecuting.cancel(true);
} catch (final Exception e) { } catch (final Exception e) {
if (logCollector != null) // if (logCollector != null)
logCollector.appendException(e, LogCollector.LogFile.MAIN_HELPER, "stopCurrentExecutor"); // logCollector.appendException(e, LogCollector.LogFile.MAIN_HELPER, "stopCurrentExecutor");
Log.e(TAG, "", e); Log.e(TAG, "", e);
} }
} }

View File

@ -69,12 +69,12 @@ import awais.instagrabber.utils.TextUtils;
import awais.instagrabber.utils.Utils; import awais.instagrabber.utils.Utils;
import awais.instagrabber.webservices.ServiceCallback; import awais.instagrabber.webservices.ServiceCallback;
import awais.instagrabber.webservices.StoriesService; import awais.instagrabber.webservices.StoriesService;
import awaisomereport.LogCollector; //import awaisomereport.LogCollector;
import static androidx.core.content.PermissionChecker.checkSelfPermission; import static androidx.core.content.PermissionChecker.checkSelfPermission;
import static awais.instagrabber.fragments.HashTagFragment.ARG_HASHTAG; import static awais.instagrabber.fragments.HashTagFragment.ARG_HASHTAG;
import static awais.instagrabber.utils.DownloadUtils.WRITE_PERMISSION; import static awais.instagrabber.utils.DownloadUtils.WRITE_PERMISSION;
import static awais.instagrabber.utils.Utils.logCollector; //import static awais.instagrabber.utils.Utils.logCollector;
import static awais.instagrabber.utils.Utils.settingsHelper; import static awais.instagrabber.utils.Utils.settingsHelper;
public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener { public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener {
@ -586,8 +586,8 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR
try { try {
currentlyExecuting.cancel(true); currentlyExecuting.cancel(true);
} catch (final Exception e) { } catch (final Exception e) {
if (logCollector != null) logCollector.appendException( // if (logCollector != null) logCollector.appendException(
e, LogCollector.LogFile.MAIN_HELPER, "stopCurrentExecutor"); // e, LogCollector.LogFile.MAIN_HELPER, "stopCurrentExecutor");
Log.e(TAG, "", e); Log.e(TAG, "", e);
} }
} }

View File

@ -103,7 +103,7 @@ import awais.instagrabber.webservices.DirectMessagesService;
import awais.instagrabber.webservices.MediaService; import awais.instagrabber.webservices.MediaService;
import awais.instagrabber.webservices.ServiceCallback; import awais.instagrabber.webservices.ServiceCallback;
import awais.instagrabber.webservices.StoriesService; import awais.instagrabber.webservices.StoriesService;
import awaisomereport.LogCollector; //import awaisomereport.LogCollector;
import retrofit2.Call; import retrofit2.Call;
import retrofit2.Callback; import retrofit2.Callback;
import retrofit2.Response; import retrofit2.Response;
@ -111,7 +111,7 @@ import retrofit2.Response;
import static awais.instagrabber.customviews.helpers.SwipeGestureListener.SWIPE_THRESHOLD; import static awais.instagrabber.customviews.helpers.SwipeGestureListener.SWIPE_THRESHOLD;
import static awais.instagrabber.customviews.helpers.SwipeGestureListener.SWIPE_VELOCITY_THRESHOLD; import static awais.instagrabber.customviews.helpers.SwipeGestureListener.SWIPE_VELOCITY_THRESHOLD;
import static awais.instagrabber.utils.Constants.MARK_AS_SEEN; import static awais.instagrabber.utils.Constants.MARK_AS_SEEN;
import static awais.instagrabber.utils.Utils.logCollector; //import static awais.instagrabber.utils.Utils.logCollector;
import static awais.instagrabber.utils.Utils.settingsHelper; import static awais.instagrabber.utils.Utils.settingsHelper;
public class StoryViewerFragment extends Fragment { public class StoryViewerFragment extends Fragment {
@ -400,10 +400,10 @@ public class StoryViewerFragment extends Fragment {
return true; return true;
} }
} catch (final Exception e) { } catch (final Exception e) {
if (logCollector != null) // if (logCollector != null)
logCollector.appendException(e, LogCollector.LogFile.ACTIVITY_STORY_VIEWER, "setupListeners", // logCollector.appendException(e, LogCollector.LogFile.ACTIVITY_STORY_VIEWER, "setupListeners",
new Pair<>("swipeEvent", swipeEvent), // new Pair<>("swipeEvent", swipeEvent),
new Pair<>("diffX", diffX)); // new Pair<>("diffX", diffX));
if (BuildConfig.DEBUG) Log.e(TAG, "Error", e); if (BuildConfig.DEBUG) Log.e(TAG, "Error", e);
} }
return false; return false;

View File

@ -21,7 +21,7 @@ import awais.instagrabber.BuildConfig;
import awais.instagrabber.db.datasources.AccountDataSource; import awais.instagrabber.db.datasources.AccountDataSource;
import awais.instagrabber.db.repositories.AccountRepository; import awais.instagrabber.db.repositories.AccountRepository;
import awais.instagrabber.db.repositories.RepositoryCallback; import awais.instagrabber.db.repositories.RepositoryCallback;
import awaisomereport.LogCollector; //import awaisomereport.LogCollector;
public final class CookieUtils { public final class CookieUtils {
private static final String TAG = CookieUtils.class.getSimpleName(); private static final String TAG = CookieUtils.class.getSimpleName();
@ -52,8 +52,8 @@ public final class CookieUtils {
cookieStore.add(uri3, httpCookie); cookieStore.add(uri3, httpCookie);
} }
} catch (final URISyntaxException e) { } catch (final URISyntaxException e) {
if (Utils.logCollector != null) // if (Utils.logCollector != null)
Utils.logCollector.appendException(e, LogCollector.LogFile.UTILS, "setupCookies"); // Utils.logCollector.appendException(e, LogCollector.LogFile.UTILS, "setupCookies");
if (BuildConfig.DEBUG) Log.e(TAG, "", e); if (BuildConfig.DEBUG) Log.e(TAG, "", e);
} }
} }

View File

@ -41,9 +41,9 @@ import awais.instagrabber.db.repositories.RepositoryCallback;
import awais.instagrabber.interfaces.FetchListener; import awais.instagrabber.interfaces.FetchListener;
import awais.instagrabber.models.enums.FavoriteType; import awais.instagrabber.models.enums.FavoriteType;
import awais.instagrabber.utils.PasswordUtils.IncorrectPasswordException; import awais.instagrabber.utils.PasswordUtils.IncorrectPasswordException;
import awaisomereport.LogCollector.LogFile; //import awaisomereport.LogCollector.LogFile;
import static awais.instagrabber.utils.Utils.logCollector; //import static awais.instagrabber.utils.Utils.logCollector;
import static awais.instagrabber.utils.Utils.settingsHelper; import static awais.instagrabber.utils.Utils.settingsHelper;
public final class ExportImportUtils { public final class ExportImportUtils {
@ -80,8 +80,8 @@ public final class ExportImportUtils {
throw e; throw e;
} catch (final Exception e) { } catch (final Exception e) {
if (fetchListener != null) fetchListener.onResult(false); if (fetchListener != null) fetchListener.onResult(false);
if (logCollector != null) // if (logCollector != null)
logCollector.appendException(e, LogFile.UTILS_IMPORT, "Import::pass"); // logCollector.appendException(e, LogFile.UTILS_IMPORT, "Import::pass");
if (BuildConfig.DEBUG) Log.e(TAG, "Error importing backup", e); if (BuildConfig.DEBUG) Log.e(TAG, "Error importing backup", e);
} }
} else if (configType == 'Z') { } else if (configType == 'Z') {
@ -99,7 +99,7 @@ public final class ExportImportUtils {
throw e; throw e;
} catch (final Exception e) { } catch (final Exception e) {
if (fetchListener != null) fetchListener.onResult(false); if (fetchListener != null) fetchListener.onResult(false);
if (logCollector != null) logCollector.appendException(e, LogFile.UTILS_IMPORT, "Import"); // if (logCollector != null) logCollector.appendException(e, LogFile.UTILS_IMPORT, "Import");
if (BuildConfig.DEBUG) Log.e(TAG, "", e); if (BuildConfig.DEBUG) Log.e(TAG, "", e);
} }
} }
@ -122,7 +122,7 @@ public final class ExportImportUtils {
if (fetchListener != null) fetchListener.onResult(true); if (fetchListener != null) fetchListener.onResult(true);
} catch (final Exception e) { } catch (final Exception e) {
if (fetchListener != null) fetchListener.onResult(false); if (fetchListener != null) fetchListener.onResult(false);
if (logCollector != null) logCollector.appendException(e, LogFile.UTILS_IMPORT, "importJson"); // if (logCollector != null) logCollector.appendException(e, LogFile.UTILS_IMPORT, "importJson");
if (BuildConfig.DEBUG) Log.e(TAG, "", e); if (BuildConfig.DEBUG) Log.e(TAG, "", e);
} }
} }
@ -241,8 +241,8 @@ public final class ExportImportUtils {
exportBytes = PasswordUtils.enc(exportString, bytes); exportBytes = PasswordUtils.enc(exportString, bytes);
} catch (final Exception e) { } catch (final Exception e) {
if (fetchListener != null) fetchListener.onResult(false); if (fetchListener != null) fetchListener.onResult(false);
if (logCollector != null) // if (logCollector != null)
logCollector.appendException(e, LogFile.UTILS_EXPORT, "Export::isPass"); // logCollector.appendException(e, LogFile.UTILS_EXPORT, "Export::isPass");
if (BuildConfig.DEBUG) Log.e(TAG, "", e); if (BuildConfig.DEBUG) Log.e(TAG, "", e);
} }
} else { } else {
@ -255,8 +255,8 @@ public final class ExportImportUtils {
if (fetchListener != null) fetchListener.onResult(true); if (fetchListener != null) fetchListener.onResult(true);
} catch (final Exception e) { } catch (final Exception e) {
if (fetchListener != null) fetchListener.onResult(false); if (fetchListener != null) fetchListener.onResult(false);
if (logCollector != null) // if (logCollector != null)
logCollector.appendException(e, LogFile.UTILS_EXPORT, "Export::notPass"); // logCollector.appendException(e, LogFile.UTILS_EXPORT, "Export::notPass");
if (BuildConfig.DEBUG) Log.e(TAG, "", e); if (BuildConfig.DEBUG) Log.e(TAG, "", e);
} }
} else if (fetchListener != null) fetchListener.onResult(false); } else if (fetchListener != null) fetchListener.onResult(false);
@ -324,7 +324,7 @@ public final class ExportImportUtils {
}, AppExecutors.getInstance().tasksThread()); }, AppExecutors.getInstance().tasksThread());
return; return;
} catch (final Exception e) { } catch (final Exception e) {
if (logCollector != null) logCollector.appendException(e, LogFile.UTILS_EXPORT, "getExportString"); // if (logCollector != null) logCollector.appendException(e, LogFile.UTILS_EXPORT, "getExportString");
if (BuildConfig.DEBUG) Log.e(TAG, "", e); if (BuildConfig.DEBUG) Log.e(TAG, "", e);
} }
callback.onCreated(null); callback.onCreated(null);
@ -373,9 +373,9 @@ public final class ExportImportUtils {
jsonArray.put(jsonObject); jsonArray.put(jsonObject);
} }
} catch (Exception e) { } catch (Exception e) {
if (logCollector != null) { // if (logCollector != null) {
logCollector.appendException(e, LogFile.UTILS_EXPORT, "getFavorites"); // logCollector.appendException(e, LogFile.UTILS_EXPORT, "getFavorites");
} // }
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
Log.e(TAG, "Error exporting favorites", e); Log.e(TAG, "Error exporting favorites", e);
} }
@ -409,9 +409,9 @@ public final class ExportImportUtils {
jsonArray.put(jsonObject); jsonArray.put(jsonObject);
} }
} catch (Exception e) { } catch (Exception e) {
if (logCollector != null) { // if (logCollector != null) {
logCollector.appendException(e, LogFile.UTILS_EXPORT, "getCookies"); // logCollector.appendException(e, LogFile.UTILS_EXPORT, "getCookies");
} // }
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
Log.e(TAG, "Error exporting accounts", e); Log.e(TAG, "Error exporting accounts", e);
} }

View File

@ -31,7 +31,7 @@ import awais.instagrabber.repositories.responses.Media;
import awais.instagrabber.repositories.responses.MediaCandidate; import awais.instagrabber.repositories.responses.MediaCandidate;
import awais.instagrabber.repositories.responses.User; import awais.instagrabber.repositories.responses.User;
import awais.instagrabber.repositories.responses.VideoVersion; import awais.instagrabber.repositories.responses.VideoVersion;
import awaisomereport.LogCollector; //import awaisomereport.LogCollector;
public final class ResponseBodyUtils { public final class ResponseBodyUtils {
private static final String TAG = "ResponseBodyUtils"; private static final String TAG = "ResponseBodyUtils";
@ -76,10 +76,10 @@ public final class ResponseBodyUtils {
if (lastIndexMain >= 0) return sources[lastIndexMain]; if (lastIndexMain >= 0) return sources[lastIndexMain];
else if (lastIndexBase >= 0) return sources[lastIndexBase]; else if (lastIndexBase >= 0) return sources[lastIndexBase];
} catch (final Exception e) { } catch (final Exception e) {
if (Utils.logCollector != null) // if (Utils.logCollector != null)
Utils.logCollector.appendException(e, LogCollector.LogFile.UTILS, "getHighQualityPost", // Utils.logCollector.appendException(e, LogCollector.LogFile.UTILS, "getHighQualityPost",
new Pair<>("resourcesNull", resources == null), // new Pair<>("resourcesNull", resources == null),
new Pair<>("isVideo", isVideo)); // new Pair<>("isVideo", isVideo));
if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "", e); if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "", e);
} }
return null; return null;
@ -94,9 +94,9 @@ public final class ResponseBodyUtils {
src = getHighQualityPost(resources.getJSONObject("image_versions2").getJSONArray("candidates"), false, true, false); src = getHighQualityPost(resources.getJSONObject("image_versions2").getJSONArray("candidates"), false, true, false);
if (src == null) return resources.getString("display_url"); if (src == null) return resources.getString("display_url");
} catch (final Exception e) { } catch (final Exception e) {
if (Utils.logCollector != null) // if (Utils.logCollector != null)
Utils.logCollector.appendException(e, LogCollector.LogFile.UTILS, "getHighQualityImage", // Utils.logCollector.appendException(e, LogCollector.LogFile.UTILS, "getHighQualityImage",
new Pair<>("resourcesNull", resources == null)); // new Pair<>("resourcesNull", resources == null));
if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "", e); if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "", e);
} }
return src; return src;

View File

@ -56,13 +56,13 @@ import java.util.Map;
import awais.instagrabber.R; import awais.instagrabber.R;
import awais.instagrabber.models.PostsLayoutPreferences; import awais.instagrabber.models.PostsLayoutPreferences;
import awais.instagrabber.models.enums.FavoriteType; import awais.instagrabber.models.enums.FavoriteType;
import awaisomereport.LogCollector; //import awaisomereport.LogCollector;
public final class Utils { public final class Utils {
private static final String TAG = "Utils"; private static final String TAG = "Utils";
private static final int VIDEO_CACHE_MAX_BYTES = 10 * 1024 * 1024; private static final int VIDEO_CACHE_MAX_BYTES = 10 * 1024 * 1024;
public static LogCollector logCollector; // public static LogCollector logCollector;
public static SettingsHelper settingsHelper; public static SettingsHelper settingsHelper;
public static boolean sessionVolumeFull = false; public static boolean sessionVolumeFull = false;
public static final MimeTypeMap mimeTypeMap = MimeTypeMap.getSingleton(); public static final MimeTypeMap mimeTypeMap = MimeTypeMap.getSingleton();

View File

@ -52,11 +52,11 @@ import awais.instagrabber.utils.Constants;
import awais.instagrabber.utils.DownloadUtils; import awais.instagrabber.utils.DownloadUtils;
import awais.instagrabber.utils.TextUtils; import awais.instagrabber.utils.TextUtils;
import awais.instagrabber.utils.Utils; import awais.instagrabber.utils.Utils;
import awaisomereport.LogCollector; //import awaisomereport.LogCollector;
import static awais.instagrabber.utils.Constants.DOWNLOAD_CHANNEL_ID; import static awais.instagrabber.utils.Constants.DOWNLOAD_CHANNEL_ID;
import static awais.instagrabber.utils.Constants.NOTIF_GROUP_NAME; import static awais.instagrabber.utils.Constants.NOTIF_GROUP_NAME;
import static awais.instagrabber.utils.Utils.logCollector; //import static awais.instagrabber.utils.Utils.logCollector;
public class DownloadWorker extends Worker { public class DownloadWorker extends Worker {
private static final String TAG = "DownloadWorker"; private static final String TAG = "DownloadWorker";
@ -260,8 +260,8 @@ public class DownloadWorker extends Worker {
try (final InputStream inputStream = contentResolver.openInputStream(uri)) { try (final InputStream inputStream = contentResolver.openInputStream(uri)) {
bitmap = BitmapFactory.decodeStream(inputStream); bitmap = BitmapFactory.decodeStream(inputStream);
} catch (final Exception e) { } catch (final Exception e) {
if (logCollector != null) // if (logCollector != null)
logCollector.appendException(e, LogCollector.LogFile.ASYNC_DOWNLOADER, "onPostExecute::bitmap_1"); // logCollector.appendException(e, LogCollector.LogFile.ASYNC_DOWNLOADER, "onPostExecute::bitmap_1");
if (BuildConfig.DEBUG) Log.e(TAG, "", e); if (BuildConfig.DEBUG) Log.e(TAG, "", e);
} }
} else if (mimeType.startsWith("video")) { } else if (mimeType.startsWith("video")) {
@ -277,13 +277,13 @@ public class DownloadWorker extends Worker {
try { try {
retriever.close(); retriever.close();
} catch (final Exception e) { } catch (final Exception e) {
if (logCollector != null) // if (logCollector != null)
logCollector.appendException(e, LogCollector.LogFile.ASYNC_DOWNLOADER, "onPostExecute::bitmap_2"); // logCollector.appendException(e, LogCollector.LogFile.ASYNC_DOWNLOADER, "onPostExecute::bitmap_2");
} }
} catch (final Exception e) { } catch (final Exception e) {
if (BuildConfig.DEBUG) Log.e(TAG, "", e); if (BuildConfig.DEBUG) Log.e(TAG, "", e);
if (logCollector != null) // if (logCollector != null)
logCollector.appendException(e, LogCollector.LogFile.ASYNC_DOWNLOADER, "onPostExecute::bitmap_3"); // logCollector.appendException(e, LogCollector.LogFile.ASYNC_DOWNLOADER, "onPostExecute::bitmap_3");
} }
} }
} }

View File

@ -19,8 +19,8 @@ import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import java.io.Writer; import java.io.Writer;
import java.util.Date; import java.util.Date;
import java.util.zip.ZipEntry; //import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; //import java.util.zip.ZipOutputStream;
import awais.instagrabber.BuildConfig; import awais.instagrabber.BuildConfig;
import awais.instagrabber.utils.Utils; import awais.instagrabber.utils.Utils;
@ -29,7 +29,7 @@ public final class CrashReporter implements Thread.UncaughtExceptionHandler {
private static CrashReporter reporterInstance; private static CrashReporter reporterInstance;
private final Application application; private final Application application;
private final String email; private final String email;
private final File crashLogsZip; // private final File crashLogsZip;
private boolean startAttempted = false; private boolean startAttempted = false;
public static CrashReporter get(final Application application) { public static CrashReporter get(final Application application) {
@ -40,7 +40,7 @@ public final class CrashReporter implements Thread.UncaughtExceptionHandler {
private CrashReporter(@NonNull final Application application) { private CrashReporter(@NonNull final Application application) {
this.application = application; this.application = application;
this.email = "barinsta@austinhuang.me"; this.email = "barinsta@austinhuang.me";
this.crashLogsZip = new File(application.getExternalCacheDir(), "crash_logs.zip"); // this.crashLogsZip = new File(application.getExternalCacheDir(), "crash_logs.zip");
} }
public void start() { 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)); application.startActivity(new Intent(application, ErrorReporterActivity.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
zipLogs(); // zipLogs();
Process.killProcess(Process.myPid()); Process.killProcess(Process.myPid());
System.exit(10); System.exit(10);
} }
public synchronized CrashReporter zipLogs() { // public synchronized CrashReporter zipLogs() {
final File logDir = Utils.logCollector != null ? Utils.logCollector.getLogDir() : // final File logDir = Utils.logCollector != null ? Utils.logCollector.getLogDir() :
new File(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ? application.getDataDir() : application.getFilesDir(), "crashlogs"); // new File(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ? application.getDataDir() : application.getFilesDir(), "crashlogs");
//
try (final FileOutputStream fos = new FileOutputStream(crashLogsZip); // try (final FileOutputStream fos = new FileOutputStream(crashLogsZip);
final ZipOutputStream zos = new ZipOutputStream(fos)) { // final ZipOutputStream zos = new ZipOutputStream(fos)) {
//
final File[] files = logDir.listFiles(); // final File[] files = logDir.listFiles();
//
if (files != null) { // if (files != null) {
zos.setLevel(5); // zos.setLevel(5);
byte[] buffer; // byte[] buffer;
for (final File file : files) { // for (final File file : files) {
if (file != null && file.length() > 0) { // if (file != null && file.length() > 0) {
buffer = new byte[1024]; // buffer = new byte[1024];
try (final FileInputStream fis = new FileInputStream(file)) { // try (final FileInputStream fis = new FileInputStream(file)) {
zos.putNextEntry(new ZipEntry(file.getName())); // zos.putNextEntry(new ZipEntry(file.getName()));
int length; // int length;
while ((length = fis.read(buffer)) > 0) zos.write(buffer, 0, length); // while ((length = fis.read(buffer)) > 0) zos.write(buffer, 0, length);
zos.closeEntry(); // zos.closeEntry();
} // }
} // }
} // }
} // }
//
} catch (final Exception e) { // } catch (final Exception e) {
if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "", e); // if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "", e);
} // }
//
return this; // return this;
} // }
@SuppressWarnings("ResultOfMethodCallIgnored") @SuppressWarnings("ResultOfMethodCallIgnored")
public void startCrashEmailIntent(final Context context, final boolean sendZipsOnly) { public void startCrashEmailIntent(final Context context) {
try { try {
final String filePath = context.getFilesDir().getAbsolutePath(); final String filePath = context.getFilesDir().getAbsolutePath();
String[] errorFileList; String[] errorFileList;
if (sendZipsOnly) errorFileList = null; try {
else { final File dir = new File(filePath);
try { if (dir.exists() && !dir.isDirectory()) dir.delete();
final File dir = new File(filePath); dir.mkdir();
if (dir.exists() && !dir.isDirectory()) dir.delete(); errorFileList = dir.list((d, name) -> name.endsWith(".stacktrace"));
dir.mkdir(); } catch (final Exception e) {
errorFileList = dir.list((d, name) -> name.endsWith(".stacktrace")); errorFileList = null;
} catch (final Exception e) {
errorFileList = null;
}
} }
if ((errorFileList != null && errorFileList.length > 0) || sendZipsOnly) { if (errorFileList != null && errorFileList.length > 0) {
final StringBuilder errorStringBuilder; final StringBuilder errorStringBuilder;
if (sendZipsOnly) errorStringBuilder = new StringBuilder("(Not a crash)\n\n"); errorStringBuilder = new StringBuilder("\r\n\r\n");
else { final int maxSendMail = 5;
errorStringBuilder = new StringBuilder("\r\n\r\n");
final int maxSendMail = 5;
int curIndex = 0; int curIndex = 0;
for (final String curString : errorFileList) { for (final String curString : errorFileList) {
final File file = new File(filePath + '/' + curString); final File file = new File(filePath + '/' + curString);
if (curIndex++ <= maxSendMail) { if (curIndex++ <= maxSendMail) {
errorStringBuilder.append("New Trace collected:\r\n=====================\r\n"); errorStringBuilder.append("New Trace collected:\r\n=====================\r\n");
try (final BufferedReader input = new BufferedReader(new FileReader(file))) { try (final BufferedReader input = new BufferedReader(new FileReader(file))) {
String line; String line;
while ((line = input.readLine()) != null) while ((line = input.readLine()) != null)
errorStringBuilder.append(line).append("\r\n"); errorStringBuilder.append(line).append("\r\n");
}
} }
file.delete();
} }
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") 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) .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_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_SUBJECT, "Barinsta Crash Report")
.putExtra(Intent.EXTRA_TEXT, errorStringBuilder.toString()), "Select an email app to send crash logs")); .putExtra(Intent.EXTRA_TEXT, errorStringBuilder.toString()), "Select an email app to send crash logs"));
} }

View File

@ -44,7 +44,7 @@ public final class ErrorReporterActivity extends Activity implements View.OnClic
@Override @Override
public void onClick(@NonNull final View v) { public void onClick(@NonNull final View v) {
if (v == btnReport) if (v == btnReport)
CrashReporter.get(getApplication()).startCrashEmailIntent(this, false); CrashReporter.get(getApplication()).startCrashEmailIntent(this);
finish(); finish();
System.exit(10); System.exit(10);
} }

View File

@ -1,4 +1,4 @@
package awaisomereport; /*package awaisomereport;
import android.app.Application; import android.app.Application;
import android.os.Build; import android.os.Build;
@ -140,4 +140,4 @@ public final class LogCollector {
//noinspection ResultOfMethodCallIgnored //noinspection ResultOfMethodCallIgnored
fileOrDirectory.delete(); fileOrDirectory.delete();
} }
} }*/