1
0
mirror of https://github.com/etesync/android synced 2024-12-23 23:18:46 +00:00

ACRA: switch to notification alerts on crashes.

On some devices users weren't able to send stack traces because
EteSync would restart and then hide/cancel the email app chooser.
This commit is contained in:
Tom Hacohen 2019-03-07 08:26:10 +00:00
parent 332caf1631
commit cf8afd541c
4 changed files with 9 additions and 7 deletions

View File

@ -131,7 +131,7 @@ dependencies {
def acraVersion = '5.2.1'
implementation "ch.acra:acra-mail:$acraVersion"
implementation "ch.acra:acra-toast:$acraVersion"
implementation "ch.acra:acra-notification:$acraVersion"
def supportVersion = '1.0.0'
implementation "androidx.legacy:legacy-support-core-ui:$supportVersion"
implementation "androidx.core:core:$supportVersion"

View File

@ -1,11 +1,10 @@
package com.etesync.syncadapter;
import android.content.Context;
import android.widget.Toast;
import org.acra.config.CoreConfigurationBuilder;
import org.acra.config.MailSenderConfigurationBuilder;
import org.acra.config.ToastConfigurationBuilder;
import org.acra.config.NotificationConfigurationBuilder;
import org.acra.data.StringFormat;
import static com.etesync.syncadapter.utils.EventEmailInvitationKt.emailSupportsAttachments;
@ -22,9 +21,11 @@ public class AcraConfiguration {
.setReportFileName("ACRA-report.stacktrace.json")
.setReportAsFile(emailSupportsAttachments(context))
.setEnabled(true);
builder.getPluginConfigurationBuilder(ToastConfigurationBuilder.class)
builder.getPluginConfigurationBuilder(NotificationConfigurationBuilder.class)
.setResTitle(R.string.crash_title)
.setResText(R.string.crash_message)
.setLength(Toast.LENGTH_SHORT)
.setChannelName("crash-notification")
.setSendOnClick(true)
.setEnabled(true);
return builder;

View File

@ -113,7 +113,7 @@ class App : Application() {
// The following line triggers the initialization of ACRA
ACRA.init(this, AcraConfiguration.getConfig(this))
val pm = base.packageManager
var installedFrom = pm.getInstallerPackageName(BuildConfig.APPLICATION_ID)
val installedFrom = pm.getInstallerPackageName(BuildConfig.APPLICATION_ID)
ACRA.getErrorReporter().putCustomData("installedFrom", installedFrom);
}
}

View File

@ -22,7 +22,8 @@
<string name="send">Send</string>
<!-- Crash -->
<string name="crash_message">EteSync has crashed, please send stack trace to developers.</string>
<string name="crash_title">EteSync has crashed!</string>
<string name="crash_message">Please send stack trace to developers.</string>
<string name="crash_email_subject">EteSync Debug Info</string>
<!-- tourguide -->