mirror of
				https://github.com/KokaKiwi/BarInsta
				synced 2025-11-04 05:25:35 +00:00 
			
		
		
		
	disable LogCollector
This commit is contained in:
		
							parent
							
								
									7f4196e119
								
							
						
					
					
						commit
						8a0f119970
					
				@ -18,14 +18,14 @@ import awais.instagrabber.utils.LocaleUtils;
 | 
			
		||||
import awais.instagrabber.utils.SettingsHelper;
 | 
			
		||||
import awais.instagrabber.utils.TextUtils;
 | 
			
		||||
import awaisomereport.CrashReporter;
 | 
			
		||||
import awaisomereport.LogCollector;
 | 
			
		||||
//import awaisomereport.LogCollector;
 | 
			
		||||
 | 
			
		||||
import static awais.instagrabber.utils.CookieUtils.NET_COOKIE_MANAGER;
 | 
			
		||||
import static awais.instagrabber.utils.Utils.applicationHandler;
 | 
			
		||||
import static awais.instagrabber.utils.Utils.cacheDir;
 | 
			
		||||
import static awais.instagrabber.utils.Utils.clipboardManager;
 | 
			
		||||
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;
 | 
			
		||||
 | 
			
		||||
public final class InstaGrabberApplication extends Application {
 | 
			
		||||
@ -56,7 +56,7 @@ public final class InstaGrabberApplication extends Application {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!BuildConfig.DEBUG) CrashReporter.get(this).start();
 | 
			
		||||
        logCollector = new LogCollector(this);
 | 
			
		||||
//        logCollector = new LogCollector(this);
 | 
			
		||||
 | 
			
		||||
        CookieHandler.setDefault(NET_COOKIE_MANAGER);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -22,9 +22,9 @@ import awais.instagrabber.repositories.responses.User;
 | 
			
		||||
import awais.instagrabber.utils.Constants;
 | 
			
		||||
import awais.instagrabber.utils.NetworkUtils;
 | 
			
		||||
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>> {
 | 
			
		||||
    private static final String TAG = "CommentsFetcher";
 | 
			
		||||
@ -130,11 +130,11 @@ public final class CommentsFetcher extends AsyncTask<Void, Void, List<CommentMod
 | 
			
		||||
                }
 | 
			
		||||
                conn.disconnect();
 | 
			
		||||
            } catch (final Exception e) {
 | 
			
		||||
                if (logCollector != null)
 | 
			
		||||
                    logCollector.appendException(e,
 | 
			
		||||
                                                 LogCollector.LogFile.ASYNC_COMMENTS_FETCHER,
 | 
			
		||||
                                                 "getChildComments",
 | 
			
		||||
                                                 new Pair<>("commentModels.size", commentModels.size()));
 | 
			
		||||
//                if (logCollector != null)
 | 
			
		||||
//                    logCollector.appendException(e,
 | 
			
		||||
//                                                 LogCollector.LogFile.ASYNC_COMMENTS_FETCHER,
 | 
			
		||||
//                                                 "getChildComments",
 | 
			
		||||
//                                                 new Pair<>("commentModels.size", commentModels.size()));
 | 
			
		||||
                if (BuildConfig.DEBUG) Log.e(TAG, "", e);
 | 
			
		||||
                if (fetchListener != null) fetchListener.onFailure(e);
 | 
			
		||||
                break;
 | 
			
		||||
@ -256,9 +256,9 @@ public final class CommentsFetcher extends AsyncTask<Void, Void, List<CommentMod
 | 
			
		||||
 | 
			
		||||
            conn.disconnect();
 | 
			
		||||
        } catch (final Exception e) {
 | 
			
		||||
            if (logCollector != null)
 | 
			
		||||
                logCollector.appendException(e, LogCollector.LogFile.ASYNC_COMMENTS_FETCHER, "getParentComments",
 | 
			
		||||
                                             new Pair<>("commentModelsList.size", commentModels.size()));
 | 
			
		||||
//            if (logCollector != null)
 | 
			
		||||
//                logCollector.appendException(e, LogCollector.LogFile.ASYNC_COMMENTS_FETCHER, "getParentComments",
 | 
			
		||||
//                                             new Pair<>("commentModelsList.size", commentModels.size()));
 | 
			
		||||
            if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "", e);
 | 
			
		||||
            if (fetchListener != null) fetchListener.onFailure(e);
 | 
			
		||||
            return null;
 | 
			
		||||
 | 
			
		||||
@ -20,9 +20,9 @@ import awais.instagrabber.interfaces.FetchListener;
 | 
			
		||||
import awais.instagrabber.models.HashtagModel;
 | 
			
		||||
import awais.instagrabber.utils.Constants;
 | 
			
		||||
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> {
 | 
			
		||||
    private static final String TAG = "HashtagFetcher";
 | 
			
		||||
@ -86,8 +86,8 @@ public final class HashtagFetcher extends AsyncTask<Void, Void, HashtagModel> {
 | 
			
		||||
 | 
			
		||||
            conn.disconnect();
 | 
			
		||||
        } catch (final Exception e) {
 | 
			
		||||
            if (logCollector != null)
 | 
			
		||||
                logCollector.appendException(e, LogCollector.LogFile.ASYNC_HASHTAG_FETCHER, "doInBackground");
 | 
			
		||||
//            if (logCollector != null)
 | 
			
		||||
//                logCollector.appendException(e, LogCollector.LogFile.ASYNC_HASHTAG_FETCHER, "doInBackground");
 | 
			
		||||
            if (BuildConfig.DEBUG) Log.e(TAG, "", e);
 | 
			
		||||
            if (fetchListener != null) fetchListener.onFailure(e);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -16,9 +16,9 @@ import awais.instagrabber.interfaces.FetchListener;
 | 
			
		||||
import awais.instagrabber.models.LocationModel;
 | 
			
		||||
import awais.instagrabber.utils.Constants;
 | 
			
		||||
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> {
 | 
			
		||||
    private static final String TAG = "LocationFetcher";
 | 
			
		||||
@ -65,8 +65,8 @@ public final class LocationFetcher extends AsyncTask<Void, Void, LocationModel>
 | 
			
		||||
 | 
			
		||||
            conn.disconnect();
 | 
			
		||||
        } catch (final Exception e) {
 | 
			
		||||
            if (logCollector != null)
 | 
			
		||||
                logCollector.appendException(e, LogCollector.LogFile.ASYNC_LOCATION_FETCHER, "doInBackground");
 | 
			
		||||
//            if (logCollector != null)
 | 
			
		||||
//                logCollector.appendException(e, LogCollector.LogFile.ASYNC_LOCATION_FETCHER, "doInBackground");
 | 
			
		||||
            if (BuildConfig.DEBUG) {
 | 
			
		||||
                Log.e(TAG, "", e);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -12,9 +12,9 @@ import awais.instagrabber.interfaces.FetchListener;
 | 
			
		||||
import awais.instagrabber.repositories.responses.Media;
 | 
			
		||||
import awais.instagrabber.utils.NetworkUtils;
 | 
			
		||||
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> {
 | 
			
		||||
    private static final String TAG = "PostFetcher";
 | 
			
		||||
@ -136,9 +136,9 @@ public final class PostFetcher extends AsyncTask<Void, Void, Media> {
 | 
			
		||||
                return ResponseBodyUtils.parseGraphQLItem(media);
 | 
			
		||||
            }
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            if (logCollector != null) {
 | 
			
		||||
                logCollector.appendException(e, LogCollector.LogFile.ASYNC_POST_FETCHER, "doInBackground");
 | 
			
		||||
            }
 | 
			
		||||
//            if (logCollector != null) {
 | 
			
		||||
//                logCollector.appendException(e, LogCollector.LogFile.ASYNC_POST_FETCHER, "doInBackground");
 | 
			
		||||
//            }
 | 
			
		||||
            Log.e(TAG, "Error fetching post", e);
 | 
			
		||||
        } finally {
 | 
			
		||||
            if (conn != null) {
 | 
			
		||||
 | 
			
		||||
@ -70,11 +70,11 @@ import awais.instagrabber.utils.Utils;
 | 
			
		||||
import awais.instagrabber.webservices.ServiceCallback;
 | 
			
		||||
import awais.instagrabber.webservices.StoriesService;
 | 
			
		||||
import awais.instagrabber.webservices.TagsService;
 | 
			
		||||
import awaisomereport.LogCollector;
 | 
			
		||||
//import awaisomereport.LogCollector;
 | 
			
		||||
 | 
			
		||||
import static androidx.core.content.PermissionChecker.checkSelfPermission;
 | 
			
		||||
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;
 | 
			
		||||
 | 
			
		||||
public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener {
 | 
			
		||||
@ -607,8 +607,8 @@ public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRe
 | 
			
		||||
            try {
 | 
			
		||||
                currentlyExecuting.cancel(true);
 | 
			
		||||
            } catch (final Exception e) {
 | 
			
		||||
                if (logCollector != null)
 | 
			
		||||
                    logCollector.appendException(e, LogCollector.LogFile.MAIN_HELPER, "stopCurrentExecutor");
 | 
			
		||||
//                if (logCollector != null)
 | 
			
		||||
//                    logCollector.appendException(e, LogCollector.LogFile.MAIN_HELPER, "stopCurrentExecutor");
 | 
			
		||||
                Log.e(TAG, "", e);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -69,12 +69,12 @@ import awais.instagrabber.utils.TextUtils;
 | 
			
		||||
import awais.instagrabber.utils.Utils;
 | 
			
		||||
import awais.instagrabber.webservices.ServiceCallback;
 | 
			
		||||
import awais.instagrabber.webservices.StoriesService;
 | 
			
		||||
import awaisomereport.LogCollector;
 | 
			
		||||
//import awaisomereport.LogCollector;
 | 
			
		||||
 | 
			
		||||
import static androidx.core.content.PermissionChecker.checkSelfPermission;
 | 
			
		||||
import static awais.instagrabber.fragments.HashTagFragment.ARG_HASHTAG;
 | 
			
		||||
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;
 | 
			
		||||
 | 
			
		||||
public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener {
 | 
			
		||||
@ -586,8 +586,8 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR
 | 
			
		||||
            try {
 | 
			
		||||
                currentlyExecuting.cancel(true);
 | 
			
		||||
            } catch (final Exception e) {
 | 
			
		||||
                if (logCollector != null) logCollector.appendException(
 | 
			
		||||
                        e, LogCollector.LogFile.MAIN_HELPER, "stopCurrentExecutor");
 | 
			
		||||
//                if (logCollector != null) logCollector.appendException(
 | 
			
		||||
//                        e, LogCollector.LogFile.MAIN_HELPER, "stopCurrentExecutor");
 | 
			
		||||
                Log.e(TAG, "", e);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -103,7 +103,7 @@ import awais.instagrabber.webservices.DirectMessagesService;
 | 
			
		||||
import awais.instagrabber.webservices.MediaService;
 | 
			
		||||
import awais.instagrabber.webservices.ServiceCallback;
 | 
			
		||||
import awais.instagrabber.webservices.StoriesService;
 | 
			
		||||
import awaisomereport.LogCollector;
 | 
			
		||||
//import awaisomereport.LogCollector;
 | 
			
		||||
import retrofit2.Call;
 | 
			
		||||
import retrofit2.Callback;
 | 
			
		||||
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_VELOCITY_THRESHOLD;
 | 
			
		||||
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;
 | 
			
		||||
 | 
			
		||||
public class StoryViewerFragment extends Fragment {
 | 
			
		||||
@ -400,10 +400,10 @@ public class StoryViewerFragment extends Fragment {
 | 
			
		||||
                        return true;
 | 
			
		||||
                    }
 | 
			
		||||
                } catch (final Exception e) {
 | 
			
		||||
                    if (logCollector != null)
 | 
			
		||||
                        logCollector.appendException(e, LogCollector.LogFile.ACTIVITY_STORY_VIEWER, "setupListeners",
 | 
			
		||||
                                                     new Pair<>("swipeEvent", swipeEvent),
 | 
			
		||||
                                                     new Pair<>("diffX", diffX));
 | 
			
		||||
//                    if (logCollector != null)
 | 
			
		||||
//                        logCollector.appendException(e, LogCollector.LogFile.ACTIVITY_STORY_VIEWER, "setupListeners",
 | 
			
		||||
//                                                     new Pair<>("swipeEvent", swipeEvent),
 | 
			
		||||
//                                                     new Pair<>("diffX", diffX));
 | 
			
		||||
                    if (BuildConfig.DEBUG) Log.e(TAG, "Error", e);
 | 
			
		||||
                }
 | 
			
		||||
                return false;
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,7 @@ import awais.instagrabber.BuildConfig;
 | 
			
		||||
import awais.instagrabber.db.datasources.AccountDataSource;
 | 
			
		||||
import awais.instagrabber.db.repositories.AccountRepository;
 | 
			
		||||
import awais.instagrabber.db.repositories.RepositoryCallback;
 | 
			
		||||
import awaisomereport.LogCollector;
 | 
			
		||||
//import awaisomereport.LogCollector;
 | 
			
		||||
 | 
			
		||||
public final class CookieUtils {
 | 
			
		||||
    private static final String TAG = CookieUtils.class.getSimpleName();
 | 
			
		||||
@ -52,8 +52,8 @@ public final class CookieUtils {
 | 
			
		||||
                cookieStore.add(uri3, httpCookie);
 | 
			
		||||
            }
 | 
			
		||||
        } catch (final URISyntaxException e) {
 | 
			
		||||
            if (Utils.logCollector != null)
 | 
			
		||||
                Utils.logCollector.appendException(e, LogCollector.LogFile.UTILS, "setupCookies");
 | 
			
		||||
//            if (Utils.logCollector != null)
 | 
			
		||||
//                Utils.logCollector.appendException(e, LogCollector.LogFile.UTILS, "setupCookies");
 | 
			
		||||
            if (BuildConfig.DEBUG) Log.e(TAG, "", e);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -41,9 +41,9 @@ import awais.instagrabber.db.repositories.RepositoryCallback;
 | 
			
		||||
import awais.instagrabber.interfaces.FetchListener;
 | 
			
		||||
import awais.instagrabber.models.enums.FavoriteType;
 | 
			
		||||
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;
 | 
			
		||||
 | 
			
		||||
public final class ExportImportUtils {
 | 
			
		||||
@ -80,8 +80,8 @@ public final class ExportImportUtils {
 | 
			
		||||
                    throw e;
 | 
			
		||||
                } catch (final Exception e) {
 | 
			
		||||
                    if (fetchListener != null) fetchListener.onResult(false);
 | 
			
		||||
                    if (logCollector != null)
 | 
			
		||||
                        logCollector.appendException(e, LogFile.UTILS_IMPORT, "Import::pass");
 | 
			
		||||
//                    if (logCollector != null)
 | 
			
		||||
//                        logCollector.appendException(e, LogFile.UTILS_IMPORT, "Import::pass");
 | 
			
		||||
                    if (BuildConfig.DEBUG) Log.e(TAG, "Error importing backup", e);
 | 
			
		||||
                }
 | 
			
		||||
            } else if (configType == 'Z') {
 | 
			
		||||
@ -99,7 +99,7 @@ public final class ExportImportUtils {
 | 
			
		||||
            throw e;
 | 
			
		||||
        } catch (final Exception e) {
 | 
			
		||||
            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);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@ -122,7 +122,7 @@ public final class ExportImportUtils {
 | 
			
		||||
            if (fetchListener != null) fetchListener.onResult(true);
 | 
			
		||||
        } catch (final Exception e) {
 | 
			
		||||
            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);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@ -241,8 +241,8 @@ public final class ExportImportUtils {
 | 
			
		||||
                    exportBytes = PasswordUtils.enc(exportString, bytes);
 | 
			
		||||
                } catch (final Exception e) {
 | 
			
		||||
                    if (fetchListener != null) fetchListener.onResult(false);
 | 
			
		||||
                    if (logCollector != null)
 | 
			
		||||
                        logCollector.appendException(e, LogFile.UTILS_EXPORT, "Export::isPass");
 | 
			
		||||
//                    if (logCollector != null)
 | 
			
		||||
//                        logCollector.appendException(e, LogFile.UTILS_EXPORT, "Export::isPass");
 | 
			
		||||
                    if (BuildConfig.DEBUG) Log.e(TAG, "", e);
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
@ -255,8 +255,8 @@ public final class ExportImportUtils {
 | 
			
		||||
                    if (fetchListener != null) fetchListener.onResult(true);
 | 
			
		||||
                } catch (final Exception e) {
 | 
			
		||||
                    if (fetchListener != null) fetchListener.onResult(false);
 | 
			
		||||
                    if (logCollector != null)
 | 
			
		||||
                        logCollector.appendException(e, LogFile.UTILS_EXPORT, "Export::notPass");
 | 
			
		||||
//                    if (logCollector != null)
 | 
			
		||||
//                        logCollector.appendException(e, LogFile.UTILS_EXPORT, "Export::notPass");
 | 
			
		||||
                    if (BuildConfig.DEBUG) Log.e(TAG, "", e);
 | 
			
		||||
                }
 | 
			
		||||
            } else if (fetchListener != null) fetchListener.onResult(false);
 | 
			
		||||
@ -324,7 +324,7 @@ public final class ExportImportUtils {
 | 
			
		||||
            }, AppExecutors.getInstance().tasksThread());
 | 
			
		||||
            return;
 | 
			
		||||
        } 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);
 | 
			
		||||
        }
 | 
			
		||||
        callback.onCreated(null);
 | 
			
		||||
@ -373,9 +373,9 @@ public final class ExportImportUtils {
 | 
			
		||||
                        jsonArray.put(jsonObject);
 | 
			
		||||
                    }
 | 
			
		||||
                } catch (Exception e) {
 | 
			
		||||
                    if (logCollector != null) {
 | 
			
		||||
                        logCollector.appendException(e, LogFile.UTILS_EXPORT, "getFavorites");
 | 
			
		||||
                    }
 | 
			
		||||
//                    if (logCollector != null) {
 | 
			
		||||
//                        logCollector.appendException(e, LogFile.UTILS_EXPORT, "getFavorites");
 | 
			
		||||
//                    }
 | 
			
		||||
                    if (BuildConfig.DEBUG) {
 | 
			
		||||
                        Log.e(TAG, "Error exporting favorites", e);
 | 
			
		||||
                    }
 | 
			
		||||
@ -409,9 +409,9 @@ public final class ExportImportUtils {
 | 
			
		||||
                        jsonArray.put(jsonObject);
 | 
			
		||||
                    }
 | 
			
		||||
                } catch (Exception e) {
 | 
			
		||||
                    if (logCollector != null) {
 | 
			
		||||
                        logCollector.appendException(e, LogFile.UTILS_EXPORT, "getCookies");
 | 
			
		||||
                    }
 | 
			
		||||
//                    if (logCollector != null) {
 | 
			
		||||
//                        logCollector.appendException(e, LogFile.UTILS_EXPORT, "getCookies");
 | 
			
		||||
//                    }
 | 
			
		||||
                    if (BuildConfig.DEBUG) {
 | 
			
		||||
                        Log.e(TAG, "Error exporting accounts", e);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
@ -31,7 +31,7 @@ import awais.instagrabber.repositories.responses.Media;
 | 
			
		||||
import awais.instagrabber.repositories.responses.MediaCandidate;
 | 
			
		||||
import awais.instagrabber.repositories.responses.User;
 | 
			
		||||
import awais.instagrabber.repositories.responses.VideoVersion;
 | 
			
		||||
import awaisomereport.LogCollector;
 | 
			
		||||
//import awaisomereport.LogCollector;
 | 
			
		||||
 | 
			
		||||
public final class ResponseBodyUtils {
 | 
			
		||||
    private static final String TAG = "ResponseBodyUtils";
 | 
			
		||||
@ -76,10 +76,10 @@ public final class ResponseBodyUtils {
 | 
			
		||||
            if (lastIndexMain >= 0) return sources[lastIndexMain];
 | 
			
		||||
            else if (lastIndexBase >= 0) return sources[lastIndexBase];
 | 
			
		||||
        } catch (final Exception e) {
 | 
			
		||||
            if (Utils.logCollector != null)
 | 
			
		||||
                Utils.logCollector.appendException(e, LogCollector.LogFile.UTILS, "getHighQualityPost",
 | 
			
		||||
                                                   new Pair<>("resourcesNull", resources == null),
 | 
			
		||||
                                                   new Pair<>("isVideo", isVideo));
 | 
			
		||||
//            if (Utils.logCollector != null)
 | 
			
		||||
//                Utils.logCollector.appendException(e, LogCollector.LogFile.UTILS, "getHighQualityPost",
 | 
			
		||||
//                                                   new Pair<>("resourcesNull", resources == null),
 | 
			
		||||
//                                                   new Pair<>("isVideo", isVideo));
 | 
			
		||||
            if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "", e);
 | 
			
		||||
        }
 | 
			
		||||
        return null;
 | 
			
		||||
@ -94,9 +94,9 @@ public final class ResponseBodyUtils {
 | 
			
		||||
                src = getHighQualityPost(resources.getJSONObject("image_versions2").getJSONArray("candidates"), false, true, false);
 | 
			
		||||
            if (src == null) return resources.getString("display_url");
 | 
			
		||||
        } catch (final Exception e) {
 | 
			
		||||
            if (Utils.logCollector != null)
 | 
			
		||||
                Utils.logCollector.appendException(e, LogCollector.LogFile.UTILS, "getHighQualityImage",
 | 
			
		||||
                                                   new Pair<>("resourcesNull", resources == null));
 | 
			
		||||
//            if (Utils.logCollector != null)
 | 
			
		||||
//                Utils.logCollector.appendException(e, LogCollector.LogFile.UTILS, "getHighQualityImage",
 | 
			
		||||
//                                                   new Pair<>("resourcesNull", resources == null));
 | 
			
		||||
            if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "", e);
 | 
			
		||||
        }
 | 
			
		||||
        return src;
 | 
			
		||||
 | 
			
		||||
@ -56,13 +56,13 @@ import java.util.Map;
 | 
			
		||||
import awais.instagrabber.R;
 | 
			
		||||
import awais.instagrabber.models.PostsLayoutPreferences;
 | 
			
		||||
import awais.instagrabber.models.enums.FavoriteType;
 | 
			
		||||
import awaisomereport.LogCollector;
 | 
			
		||||
//import awaisomereport.LogCollector;
 | 
			
		||||
 | 
			
		||||
public final class Utils {
 | 
			
		||||
    private static final String TAG = "Utils";
 | 
			
		||||
    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 boolean sessionVolumeFull = false;
 | 
			
		||||
    public static final MimeTypeMap mimeTypeMap = MimeTypeMap.getSingleton();
 | 
			
		||||
 | 
			
		||||
@ -52,11 +52,11 @@ import awais.instagrabber.utils.Constants;
 | 
			
		||||
import awais.instagrabber.utils.DownloadUtils;
 | 
			
		||||
import awais.instagrabber.utils.TextUtils;
 | 
			
		||||
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.NOTIF_GROUP_NAME;
 | 
			
		||||
import static awais.instagrabber.utils.Utils.logCollector;
 | 
			
		||||
//import static awais.instagrabber.utils.Utils.logCollector;
 | 
			
		||||
 | 
			
		||||
public class DownloadWorker extends Worker {
 | 
			
		||||
    private static final String TAG = "DownloadWorker";
 | 
			
		||||
@ -260,8 +260,8 @@ public class DownloadWorker extends Worker {
 | 
			
		||||
                    try (final InputStream inputStream = contentResolver.openInputStream(uri)) {
 | 
			
		||||
                        bitmap = BitmapFactory.decodeStream(inputStream);
 | 
			
		||||
                    } catch (final Exception e) {
 | 
			
		||||
                        if (logCollector != null)
 | 
			
		||||
                            logCollector.appendException(e, LogCollector.LogFile.ASYNC_DOWNLOADER, "onPostExecute::bitmap_1");
 | 
			
		||||
//                        if (logCollector != null)
 | 
			
		||||
//                            logCollector.appendException(e, LogCollector.LogFile.ASYNC_DOWNLOADER, "onPostExecute::bitmap_1");
 | 
			
		||||
                        if (BuildConfig.DEBUG) Log.e(TAG, "", e);
 | 
			
		||||
                    }
 | 
			
		||||
                } else if (mimeType.startsWith("video")) {
 | 
			
		||||
@ -277,13 +277,13 @@ public class DownloadWorker extends Worker {
 | 
			
		||||
                            try {
 | 
			
		||||
                                retriever.close();
 | 
			
		||||
                            } catch (final Exception e) {
 | 
			
		||||
                                if (logCollector != null)
 | 
			
		||||
                                    logCollector.appendException(e, LogCollector.LogFile.ASYNC_DOWNLOADER, "onPostExecute::bitmap_2");
 | 
			
		||||
//                                if (logCollector != null)
 | 
			
		||||
//                                    logCollector.appendException(e, LogCollector.LogFile.ASYNC_DOWNLOADER, "onPostExecute::bitmap_2");
 | 
			
		||||
                            }
 | 
			
		||||
                    } catch (final Exception e) {
 | 
			
		||||
                        if (BuildConfig.DEBUG) Log.e(TAG, "", e);
 | 
			
		||||
                        if (logCollector != null)
 | 
			
		||||
                            logCollector.appendException(e, LogCollector.LogFile.ASYNC_DOWNLOADER, "onPostExecute::bitmap_3");
 | 
			
		||||
//                        if (logCollector != null)
 | 
			
		||||
//                            logCollector.appendException(e, LogCollector.LogFile.ASYNC_DOWNLOADER, "onPostExecute::bitmap_3");
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -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 = "barinsta@austinhuang.me";
 | 
			
		||||
        this.crashLogsZip = new File(application.getExternalCacheDir(), "crash_logs.zip");
 | 
			
		||||
//        this.crashLogsZip = new File(application.getExternalCacheDir(), "crash_logs.zip");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void start() {
 | 
			
		||||
@ -99,53 +99,51 @@ 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();
 | 
			
		||||
@ -154,13 +152,10 @@ public final class CrashReporter implements Thread.UncaughtExceptionHandler {
 | 
			
		||||
            } 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;
 | 
			
		||||
 | 
			
		||||
@ -181,12 +176,11 @@ public final class CrashReporter implements Thread.UncaughtExceptionHandler {
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                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"));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -44,7 +44,7 @@ public final class ErrorReporterActivity extends Activity implements View.OnClic
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onClick(@NonNull final View v) {
 | 
			
		||||
        if (v == btnReport)
 | 
			
		||||
            CrashReporter.get(getApplication()).startCrashEmailIntent(this, false);
 | 
			
		||||
            CrashReporter.get(getApplication()).startCrashEmailIntent(this);
 | 
			
		||||
        finish();
 | 
			
		||||
        System.exit(10);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
package awaisomereport;
 | 
			
		||||
/*package awaisomereport;
 | 
			
		||||
 | 
			
		||||
import android.app.Application;
 | 
			
		||||
import android.os.Build;
 | 
			
		||||
@ -140,4 +140,4 @@ public final class LogCollector {
 | 
			
		||||
        //noinspection ResultOfMethodCallIgnored
 | 
			
		||||
        fileOrDirectory.delete();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}*/
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user