mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Add crash reporting using ACRA
This commit is contained in:
parent
d180b5646f
commit
08296ec484
2
.gitignore
vendored
2
.gitignore
vendored
@ -5,3 +5,5 @@
|
|||||||
LatinIME.iml
|
LatinIME.iml
|
||||||
build/
|
build/
|
||||||
local.properties
|
local.properties
|
||||||
|
crashreporting.properties
|
||||||
|
keystore.properties
|
31
build.gradle
31
build.gradle
@ -51,6 +51,16 @@ android {
|
|||||||
project.logger.lifecycle('keystore.properties not found, APK may not be signed')
|
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 {
|
buildTypes {
|
||||||
debug {
|
debug {
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
@ -60,6 +70,24 @@ android {
|
|||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.flags'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.flags'
|
||||||
signingConfig releaseSigning
|
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 {
|
compileOptions {
|
||||||
@ -132,6 +160,9 @@ dependencies {
|
|||||||
implementation 'androidx.datastore:datastore-preferences:1.0.0'
|
implementation 'androidx.datastore:datastore-preferences:1.0.0'
|
||||||
implementation 'androidx.autofill:autofill:1.1.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")
|
implementation project(":voiceinput-shared")
|
||||||
|
|
||||||
debugImplementation 'androidx.compose.ui:ui-tooling'
|
debugImplementation 'androidx.compose.ui:ui-tooling'
|
||||||
|
@ -56,7 +56,8 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:defaultToDeviceProtectedStorage="true"
|
android:defaultToDeviceProtectedStorage="true"
|
||||||
android:directBootAware="true">
|
android:directBootAware="true"
|
||||||
|
android:name=".CrashLoggingApplication">
|
||||||
|
|
||||||
<!-- Services -->
|
<!-- Services -->
|
||||||
<service android:name=".LatinIME"
|
<service android:name=".LatinIME"
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user