From b543fb68c1ab3ad991d6ac5e7fe4d1e2a6fe8583 Mon Sep 17 00:00:00 2001 From: serso Date: Mon, 30 Apr 2018 14:30:18 +0200 Subject: [PATCH] Remove ACRA --- app/build.gradle | 5 +- .../android/calculator/AcraErrorReporter.java | 59 ------------------- .../android/calculator/AppModule.java | 10 +++- .../calculator/CalculatorApplication.java | 12 ---- 4 files changed, 10 insertions(+), 76 deletions(-) delete mode 100644 app/src/main/java/org/solovyev/android/calculator/AcraErrorReporter.java diff --git a/app/build.gradle b/app/build.gradle index b3bc1351..554128c2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -74,9 +74,6 @@ dependencies { implementation "com.android.support:support-v4:${versions.supportLib}" implementation "com.android.support:appcompat-v7:${versions.supportLib}" implementation "com.android.support:design:${versions.supportLib}" - implementation('ch.acra:acra:4.7.0') { - exclude group: 'org.json' - } implementation ':measure:' implementation ':square-otto:1.3.9-SNAPSHOT' annotationProcessor ':square-otto:1.3.9-SNAPSHOT' @@ -215,4 +212,4 @@ uploadArchives { } } } -} \ No newline at end of file +} diff --git a/app/src/main/java/org/solovyev/android/calculator/AcraErrorReporter.java b/app/src/main/java/org/solovyev/android/calculator/AcraErrorReporter.java deleted file mode 100644 index a845effd..00000000 --- a/app/src/main/java/org/solovyev/android/calculator/AcraErrorReporter.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2013 serso aka se.solovyev - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * Contact details - * - * Email: se.solovyev@gmail.com - * Site: http://se.solovyev.org - */ - -package org.solovyev.android.calculator; - -import android.util.Log; -import jscl.CustomFunctionCalculationException; -import jscl.text.msg.JsclMessage; -import jscl.text.msg.Messages; -import org.acra.ACRA; -import org.solovyev.common.msg.MessageType; - -import javax.annotation.Nonnull; - -public class AcraErrorReporter implements ErrorReporter { - - public static final boolean ENABLED = !BuildConfig.DEBUG; - - @Override - public void onException(@Nonnull Throwable e) { - if (!ENABLED) { - Log.e("Acra", e.getMessage(), e); - return; - } - if (e instanceof CustomFunctionCalculationException) { - final CustomFunctionCalculationException e1 = (CustomFunctionCalculationException) e; - e1.setMessage(new JsclMessage(Messages.msg_19, MessageType.error, "XXX", e1.getCauseMessage().getMessageCode())); - } - ACRA.getErrorReporter().reportBuilder().forceSilent().exception(e).send(); - } - - @Override - public void onError(@Nonnull String message) { - if (!ENABLED) { - Log.e("Acra", message); - return; - } - ACRA.getErrorReporter().reportBuilder().forceSilent().exception(new Throwable(message)).send(); - } -} diff --git a/app/src/main/java/org/solovyev/android/calculator/AppModule.java b/app/src/main/java/org/solovyev/android/calculator/AppModule.java index 4c772b0a..d17cedd6 100644 --- a/app/src/main/java/org/solovyev/android/calculator/AppModule.java +++ b/app/src/main/java/org/solovyev/android/calculator/AppModule.java @@ -143,7 +143,15 @@ public class AppModule { @Provides @Singleton ErrorReporter provideErrorReporter() { - return new AcraErrorReporter(); + return new ErrorReporter() { + @Override + public void onException(@Nonnull Throwable e) { + } + + @Override + public void onError(@Nonnull String message) { + } + }; } @Provides diff --git a/app/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java b/app/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java index a01ca9bf..5b5c36a1 100644 --- a/app/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java +++ b/app/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java @@ -32,9 +32,6 @@ import android.util.TimingLogger; import com.squareup.otto.Bus; -import org.acra.ACRA; -import org.acra.ACRAConfiguration; -import org.acra.sender.HttpSender; import org.solovyev.android.calculator.floating.FloatingCalculatorActivity; import org.solovyev.android.calculator.ga.Ga; import org.solovyev.android.calculator.history.History; @@ -188,15 +185,6 @@ public class CalculatorApplication extends android.app.Application implements Sh private void onPreCreate(@Nonnull SharedPreferences prefs, @NonNull SharedPreferences uiPrefs, @Nonnull Languages languages) { - // first we need to setup crash handler and memory leak analyzer - if (AcraErrorReporter.ENABLED) { - ACRA.init(this, new ACRAConfiguration() - .setFormUri("https://serso.cloudant.com/acra-cpp/_design/acra-storage/_update/report") - .setReportType(HttpSender.Type.JSON) - .setHttpMethod(HttpSender.Method.PUT) - .setFormUriBasicAuthLogin("timbeenterumisideffecird") - .setFormUriBasicAuthPassword("ECL65PO2TH5quIFNAK4hQ5Ng")); - } // initializing App before #onCreate as FloatingCalculatorService might be created in // #onCreate App.init(this, prefs);