From 15ba12809524f53be0f3ce1fe9fed798953f2366 Mon Sep 17 00:00:00 2001 From: Aleksandras Kostarevas Date: Tue, 2 Apr 2024 16:56:53 -0500 Subject: [PATCH] Add back http crash report for now --- build.gradle | 1 + .../latin/CrashLoggingApplication.kt | 24 ++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 2d49ae7bd..dabc8cf33 100644 --- a/build.gradle +++ b/build.gradle @@ -192,6 +192,7 @@ dependencies { implementation 'androidx.datastore:datastore-preferences:1.0.0' implementation 'androidx.autofill:autofill:1.1.0' + implementation 'ch.acra:acra-http:5.11.1' // TODO: Remove upon release implementation 'ch.acra:acra-mail:5.11.1' implementation 'ch.acra:acra-dialog:5.11.1' diff --git a/java/src/org/futo/inputmethod/latin/CrashLoggingApplication.kt b/java/src/org/futo/inputmethod/latin/CrashLoggingApplication.kt index 86d081399..00373aee0 100644 --- a/java/src/org/futo/inputmethod/latin/CrashLoggingApplication.kt +++ b/java/src/org/futo/inputmethod/latin/CrashLoggingApplication.kt @@ -3,9 +3,11 @@ package org.futo.inputmethod.latin import android.app.Application import android.content.Context import org.acra.config.dialog +import org.acra.config.httpSender import org.acra.config.mailSender import org.acra.data.StringFormat import org.acra.ktx.initAcra +import org.acra.sender.HttpSender class CrashLoggingApplication : Application() { override fun attachBaseContext(base: Context?) { @@ -22,12 +24,22 @@ class CrashLoggingApplication : Application() { resTheme = android.R.style.Theme_DeviceDefault_Dialog } - mailSender { - mailTo = "keyboard@futo.org" - reportAsFile = true - reportFileName = "Crash.txt" - subject = "Keyboard Crash Report" - body = "I experienced this crash. My version: ${BuildConfig.VERSION_NAME}.\n\n(Enter details here if necessary)" + if(BuildConfig.ENABLE_ACRA) { + httpSender { + uri = BuildConfig.ACRA_URL + basicAuthLogin = BuildConfig.ACRA_USER + basicAuthPassword = BuildConfig.ACRA_PASSWORD + httpMethod = HttpSender.Method.POST + } + } else { + mailSender { + mailTo = "keyboard@futo.org" + reportAsFile = true + reportFileName = "Crash.txt" + subject = "Keyboard Crash Report" + body = + "I experienced this crash. My version: ${BuildConfig.VERSION_NAME}.\n\n(Enter details here if necessary)" + } } } }