From aa34e36559a61cf2cade059f659d89eef718b621 Mon Sep 17 00:00:00 2001 From: androidacy-user Date: Wed, 10 May 2023 04:03:46 +0000 Subject: [PATCH] (fix) fix crashes Signed-off-by: androidacy-user --- app/build.gradle.kts | 2 +- app/proguard-rules.pro | 1 + app/src/main/java/com/fox2code/mmm/CrashHandler.java | 6 ++++-- app/src/main/java/com/fox2code/mmm/MainActivity.java | 4 ++-- settings.gradle.kts | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 9f95ca90..8f568ef7 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -467,7 +467,7 @@ dependencies { implementation("androidx.security:security-crypto:1.1.0-alpha06") // some utils - implementation("commons-io:commons-io:20030203.000550") + implementation("commons-io:commons-io:2.11.0") implementation("org.apache.commons:commons-compress:1.23.0") // analytics diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index b2de4b1d..19014176 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -192,6 +192,7 @@ -keepclassmembers class kotlin.SafePublicationLazyImpl { java.lang.Object _value; } +-keepclassmembers class org.apache.commons.compress.archivers.zip.* { *; } # fix bug with androidx work and future # -keep class androidx.work.impl.utils.futures.* { *; } diff --git a/app/src/main/java/com/fox2code/mmm/CrashHandler.java b/app/src/main/java/com/fox2code/mmm/CrashHandler.java index af6d4f0b..649829c0 100644 --- a/app/src/main/java/com/fox2code/mmm/CrashHandler.java +++ b/app/src/main/java/com/fox2code/mmm/CrashHandler.java @@ -106,7 +106,9 @@ protected void onCreate(Bundle savedInstanceState) { }); // get restart button findViewById(R.id.restart).setOnClickListener(v -> { - // Restart the app + // Restart the app and submit sans feedback + Throwable sentryException = (Throwable) getIntent().getSerializableExtra("sentryException"); + if (crashReportingEnabled) Sentry.captureException(sentryException); finish(); startActivity(getPackageManager().getLaunchIntentForPackage(getPackageName())); }); @@ -169,4 +171,4 @@ public void copyCrashDetails(View view) { runOnUiThread(() -> view.setBackgroundResource(R.drawable.baseline_copy_all_24)); }).start(); } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/fox2code/mmm/MainActivity.java b/app/src/main/java/com/fox2code/mmm/MainActivity.java index cb9359ff..3d001d43 100644 --- a/app/src/main/java/com/fox2code/mmm/MainActivity.java +++ b/app/src/main/java/com/fox2code/mmm/MainActivity.java @@ -738,7 +738,7 @@ public void maybeShowUpgrade() { } // if it's still null, but it's enabled, throw an error if (AndroidacyRepoData.getInstance().isEnabled() && AndroidacyRepoData.getInstance().memberLevel == null) { - throw new IllegalStateException("AndroidacyRepoData is enabled, but member level is null"); + Timber.e("AndroidacyRepoData is enabled, but member level is null"); } if (AndroidacyRepoData.getInstance() != null && AndroidacyRepoData.getInstance().isEnabled() && Objects.equals(AndroidacyRepoData.getInstance().memberLevel, "Guest")) { runtimeUtils.showUpgradeSnackbar(this, this); @@ -763,4 +763,4 @@ public void maybeShowUpgrade() { } } } -} \ No newline at end of file +} diff --git a/settings.gradle.kts b/settings.gradle.kts index 13865ced..7111a3d7 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -17,8 +17,8 @@ gradleEnterprise { dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { - google() mavenCentral() + google() // enable jitpack maven { setUrl("https://jitpack.io") } }