Skip to content
Snippets Groups Projects
Commit 08296ec4 authored by Aleksandras Kostarevas's avatar Aleksandras Kostarevas
Browse files

Add crash reporting using ACRA

parent d180b564
No related branches found
No related tags found
1 merge request!1Integrate voice input
......@@ -5,3 +5,5 @@
LatinIME.iml
build/
local.properties
crashreporting.properties
keystore.properties
\ No newline at end of file
......@@ -51,6 +51,16 @@ android {
project.logger.lifecycle('keystore.properties not found, APK may not be signed')
}
final def crashReportPropertiesFile = rootProject.file("crashreporting.properties")
final def crashReportProperties = new Properties()
if (crashReportPropertiesFile.exists()) {
crashReportProperties.load(new FileInputStream(crashReportPropertiesFile))
} else {
project.logger.lifecycle('crashreporting.properties not found, crash reporting will be disabled')
}
buildTypes {
debug {
minifyEnabled false
......@@ -60,6 +70,24 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.flags'
signingConfig releaseSigning
}
buildTypes.each {
if (crashReportPropertiesFile.exists()) {
it.buildConfigField "boolean", "ENABLE_ACRA", crashReportProperties['acraEnabled']
it.buildConfigField "String", "ACRA_URL", crashReportProperties['acraUrl']
it.buildConfigField "String", "ACRA_USER", crashReportProperties['acraUser']
it.buildConfigField "String", "ACRA_PASSWORD", crashReportProperties['acraPassword']
} else {
it.buildConfigField "boolean", "ENABLE_ACRA", "false"
it.buildConfigField "String", "ACRA_URL", ""
it.buildConfigField "String", "ACRA_USER", ""
it.buildConfigField "String", "ACRA_PASSWORD", ""
}
}
}
buildFeatures {
buildConfig = true
}
compileOptions {
......@@ -132,6 +160,9 @@ dependencies {
implementation 'androidx.datastore:datastore-preferences:1.0.0'
implementation 'androidx.autofill:autofill:1.1.0'
implementation 'ch.acra:acra-http:5.11.1'
implementation 'ch.acra:acra-dialog:5.11.1'
implementation project(":voiceinput-shared")
debugImplementation 'androidx.compose.ui:ui-tooling'
......
......@@ -56,7 +56,8 @@
android:supportsRtl="true"
android:allowBackup="true"
android:defaultToDeviceProtectedStorage="true"
android:directBootAware="true">
android:directBootAware="true"
android:name=".CrashLoggingApplication">
<!-- Services -->
<service android:name=".LatinIME"
......
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.data.StringFormat
import org.acra.ktx.initAcra
import org.acra.sender.HttpSender
class CrashLoggingApplication : Application() {
override fun attachBaseContext(base: Context?) {
super.attachBaseContext(base)
if(BuildConfig.ENABLE_ACRA) {
initAcra {
reportFormat = StringFormat.JSON
dialog {
text = "FUTO Keyboard has crashed! Please send a report to help us fix this."
title = "Crash"
positiveButtonText = "Send Report"
negativeButtonText = "Ignore"
resTheme = android.R.style.Theme_DeviceDefault_Dialog
}
httpSender {
uri = BuildConfig.ACRA_URL
basicAuthLogin = BuildConfig.ACRA_USER
basicAuthPassword = BuildConfig.ACRA_PASSWORD
httpMethod = HttpSender.Method.POST
}
}
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment