Remove ACRA

This commit is contained in:
serso 2018-04-30 14:30:18 +02:00
parent 836678ee3f
commit b543fb68c1
4 changed files with 10 additions and 76 deletions

View File

@ -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 {
}
}
}
}
}

View File

@ -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();
}
}

View File

@ -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

View File

@ -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);