From 7b81e985816c5f11875cada3fe39f1bd7fd8954d Mon Sep 17 00:00:00 2001 From: wb9688 Date: Fri, 1 May 2020 18:26:12 +0200 Subject: [PATCH] Upgrade ACRA --- app/build.gradle | 2 +- app/src/main/java/org/schabi/newpipe/App.java | 6 +++--- .../org/schabi/newpipe/report/AcraReportSender.java | 2 +- .../newpipe/report/AcraReportSenderFactory.java | 4 ++-- .../java/org/schabi/newpipe/report/ErrorActivity.java | 11 ++--------- 5 files changed, 9 insertions(+), 16 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 6ffbd16b5..08323560c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -200,7 +200,7 @@ dependencies { implementation "com.nononsenseapps:filepicker:4.2.1" - implementation "ch.acra:acra:4.9.2" + implementation "ch.acra:acra-core:5.5.0" implementation "io.reactivex.rxjava2:rxjava:2.2.19" implementation "io.reactivex.rxjava2:rxandroid:2.1.1" diff --git a/app/src/main/java/org/schabi/newpipe/App.java b/app/src/main/java/org/schabi/newpipe/App.java index 02c816be9..531cb5a38 100644 --- a/app/src/main/java/org/schabi/newpipe/App.java +++ b/app/src/main/java/org/schabi/newpipe/App.java @@ -16,9 +16,9 @@ import com.nostra13.universalimageloader.core.ImageLoader; import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; import org.acra.ACRA; -import org.acra.config.ACRAConfiguration; import org.acra.config.ACRAConfigurationException; -import org.acra.config.ConfigurationBuilder; +import org.acra.config.CoreConfiguration; +import org.acra.config.CoreConfigurationBuilder; import org.acra.sender.ReportSenderFactory; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.downloader.Downloader; @@ -202,7 +202,7 @@ public class App extends Application { private void initACRA() { try { - final ACRAConfiguration acraConfig = new ConfigurationBuilder(this) + final CoreConfiguration acraConfig = new CoreConfigurationBuilder(this) .setReportSenderFactoryClasses(REPORT_SENDER_FACTORY_CLASSES) .setBuildConfigClass(BuildConfig.class) .build(); diff --git a/app/src/main/java/org/schabi/newpipe/report/AcraReportSender.java b/app/src/main/java/org/schabi/newpipe/report/AcraReportSender.java index a6559d54d..b31e3a31e 100644 --- a/app/src/main/java/org/schabi/newpipe/report/AcraReportSender.java +++ b/app/src/main/java/org/schabi/newpipe/report/AcraReportSender.java @@ -4,7 +4,7 @@ import android.content.Context; import androidx.annotation.NonNull; -import org.acra.collector.CrashReportData; +import org.acra.data.CrashReportData; import org.acra.sender.ReportSender; import org.schabi.newpipe.R; diff --git a/app/src/main/java/org/schabi/newpipe/report/AcraReportSenderFactory.java b/app/src/main/java/org/schabi/newpipe/report/AcraReportSenderFactory.java index 9428df0cb..f4c1c4ac8 100644 --- a/app/src/main/java/org/schabi/newpipe/report/AcraReportSenderFactory.java +++ b/app/src/main/java/org/schabi/newpipe/report/AcraReportSenderFactory.java @@ -4,7 +4,7 @@ import android.content.Context; import androidx.annotation.NonNull; -import org.acra.config.ACRAConfiguration; +import org.acra.config.CoreConfiguration; import org.acra.sender.ReportSender; import org.acra.sender.ReportSenderFactory; @@ -31,7 +31,7 @@ import org.acra.sender.ReportSenderFactory; public class AcraReportSenderFactory implements ReportSenderFactory { @NonNull public ReportSender create(@NonNull final Context context, - @NonNull final ACRAConfiguration config) { + @NonNull final CoreConfiguration config) { return new AcraReportSender(); } } diff --git a/app/src/main/java/org/schabi/newpipe/report/ErrorActivity.java b/app/src/main/java/org/schabi/newpipe/report/ErrorActivity.java index 358c17ad4..20724c02b 100644 --- a/app/src/main/java/org/schabi/newpipe/report/ErrorActivity.java +++ b/app/src/main/java/org/schabi/newpipe/report/ErrorActivity.java @@ -32,7 +32,7 @@ import com.google.android.material.snackbar.Snackbar; import com.grack.nanojson.JsonWriter; import org.acra.ReportField; -import org.acra.collector.CrashReportData; +import org.acra.data.CrashReportData; import org.schabi.newpipe.ActivityCommunicator; import org.schabi.newpipe.BuildConfig; import org.schabi.newpipe.MainActivity; @@ -149,14 +149,7 @@ public class ErrorActivity extends AppCompatActivity { public static void reportError(final Context context, final CrashReportData report, final ErrorInfo errorInfo) { - // get key first (don't ask about this solution) - ReportField key = null; - for (ReportField k : report.keySet()) { - if (k.toString().equals("STACK_TRACE")) { - key = k; - } - } - String[] el = new String[]{report.get(key).toString()}; + String[] el = new String[]{report.getString(ReportField.STACK_TRACE)}; Intent intent = new Intent(context, ErrorActivity.class); intent.putExtra(ERROR_INFO, errorInfo);