mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-05-11 09:33:04 -04:00
Set up ACRA with email crash alerts for foss build
This commit is contained in:
@@ -4,6 +4,12 @@ import android.app.Application;
|
||||
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
|
||||
import org.acra.ACRA;
|
||||
import org.acra.config.CoreConfigurationBuilder;
|
||||
import org.acra.config.DialogConfigurationBuilder;
|
||||
import org.acra.config.MailSenderConfigurationBuilder;
|
||||
import org.acra.data.StringFormat;
|
||||
|
||||
import protect.card_locker.preferences.Settings;
|
||||
|
||||
public class LoyaltyCardLockerApplication extends Application {
|
||||
@@ -12,6 +18,27 @@ public class LoyaltyCardLockerApplication extends Application {
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
// Initialize crash reporter (if enabled)
|
||||
if (BuildConfig.useAcraCrashReporter) {
|
||||
ACRA.init(this, new CoreConfigurationBuilder()
|
||||
//core configuration:
|
||||
.withBuildConfigClass(BuildConfig.class)
|
||||
.withReportFormat(StringFormat.KEY_VALUE_LIST)
|
||||
.withPluginConfigurations(
|
||||
new DialogConfigurationBuilder()
|
||||
.withText(String.format(getString(R.string.acra_catima_has_crashed), getString(R.string.app_name)))
|
||||
.withCommentPrompt(getString(R.string.acra_explain_crash))
|
||||
.withResTheme(R.style.AppTheme)
|
||||
.build(),
|
||||
new MailSenderConfigurationBuilder()
|
||||
.withMailTo("acra-crash@catima.app")
|
||||
.withSubject(String.format(getString(R.string.acra_crash_email_subject), getString(R.string.app_name)))
|
||||
.build()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Set theme
|
||||
Settings settings = new Settings(this);
|
||||
AppCompatDelegate.setDefaultNightMode(settings.getTheme());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user