Author: Adam Evyčędo <git@apiote.xyz>
add error reporting
app/build.gradle.kts | 3 + app/src/main/java/xyz/apiote/bimba/czwek/Bimba.kt | 39 +++++++++++++++++ app/src/main/res/drawable/comment.xml | 17 +++++++ app/src/main/res/drawable/discard.xml | 17 +++++++ app/src/main/res/drawable/send.xml | 19 ++++++++ app/src/main/res/values/strings.xml | 8 +++
diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 6ff0eb7f653b62e4287a86c19dd3f3612f2c5881..7e019b72fe274987a66a2cf8951a5522338bd7b7 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -72,7 +72,10 @@ implementation("androidx.preference:preference-ktx:1.2.1") implementation("androidx.work:work-runtime-ktx:2.9.1") implementation("com.github.doyaaaaaken:kotlin-csv-jvm:1.10.0") implementation("commons-io:commons-io:2.16.1") + implementation("com.google.guava:guava:31.0.1-android") implementation(project(":fruchtfleisch")) + implementation("ch.acra:acra-http:5.11.3") + implementation("ch.acra:acra-notification:5.11.3") coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4") diff --git a/app/src/main/java/xyz/apiote/bimba/czwek/Bimba.kt b/app/src/main/java/xyz/apiote/bimba/czwek/Bimba.kt index ac8fd82f922094e41a9dc17ba643694a1833df24..964bd42cfa0c06c32cc7cbb680d9c4e9a2c80c5f 100644 --- a/app/src/main/java/xyz/apiote/bimba/czwek/Bimba.kt +++ b/app/src/main/java/xyz/apiote/bimba/czwek/Bimba.kt @@ -4,6 +4,15 @@ // SPDX-License-Identifier: GPL-3.0-or-later package xyz.apiote.bimba.czwek +import android.content.Context +import androidx.core.app.NotificationManagerCompat +import org.acra.BuildConfig +import org.acra.config.httpSender +import org.acra.config.notification +import org.acra.data.StringFormat +import org.acra.ktx.initAcra +import org.acra.security.TLS +import org.acra.sender.HttpSender import org.osmdroid.config.Configuration import java.io.File @@ -20,5 +29,35 @@ config.osmdroidBasePath = File(applicationContext.cacheDir.absolutePath, "osmdroid") config.osmdroidTileCache = File(config.osmdroidBasePath.absolutePath, "tile") } + } + + override fun attachBaseContext(base: Context) { + super.attachBaseContext(base) + + initAcra { + buildConfigClass = BuildConfig::class.java + reportFormat = StringFormat.JSON + + httpSender { + uri = "https://acra-bimba.apiote.xyz/report" + httpMethod = HttpSender.Method.POST + tlsProtocols = listOf(TLS.V1_3, TLS.V1_2) + } + + notification { + title = getString(R.string.acra_notification_title) + text = getString(R.string.acra_notification_text) + channelName = getString(R.string.acra_notification_channel) + channelDescription = getString(R.string.acra_notification_channel_description) + channelImportance = NotificationManagerCompat.IMPORTANCE_DEFAULT + sendButtonText = getString(R.string.send) + resSendButtonIcon = R.drawable.send + discardButtonText = getString(R.string.discard) + resDiscardButtonIcon = R.drawable.discard + sendWithCommentButtonText = getString(R.string.send_with_comment) + resSendWithCommentButtonIcon = R.drawable.comment + commentPrompt = getString(R.string.acra_notification_comment) + } + } } } \ No newline at end of file diff --git a/app/src/main/res/drawable/comment.xml b/app/src/main/res/drawable/comment.xml new file mode 100644 index 0000000000000000000000000000000000000000..bd983286222a7a64987fe28d3cd5bd7eff9816c9 --- /dev/null +++ b/app/src/main/res/drawable/comment.xml @@ -0,0 +1,17 @@ +<!-- +SPDX-FileCopyrightText: Google + +SPDX-License-Identifier: Apache-2.0 +--> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:tint="#000000" + android:viewportWidth="24" + android:viewportHeight="24"> + + <path + android:fillColor="@android:color/white" + android:pathData="M21.99,4c0,-1.1 -0.89,-2 -1.99,-2H4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h14l4,4 -0.01,-18zM17,11h-4v4h-2v-4H7V9h4V5h2v4h4v2z" /> + +</vector> diff --git a/app/src/main/res/drawable/discard.xml b/app/src/main/res/drawable/discard.xml new file mode 100644 index 0000000000000000000000000000000000000000..dd97b1f0bcfa64600d99e7794bbc07c29c6b8456 --- /dev/null +++ b/app/src/main/res/drawable/discard.xml @@ -0,0 +1,17 @@ +<!-- +SPDX-FileCopyrightText: Google + +SPDX-License-Identifier: Apache-2.0 +--> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:tint="#000000" + android:viewportWidth="24" + android:viewportHeight="24"> + + <path + android:fillColor="@android:color/white" + android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z" /> + +</vector> diff --git a/app/src/main/res/drawable/send.xml b/app/src/main/res/drawable/send.xml new file mode 100644 index 0000000000000000000000000000000000000000..42caa11f3d69d9e70a3b73d5f03d617c349af2cc --- /dev/null +++ b/app/src/main/res/drawable/send.xml @@ -0,0 +1,19 @@ +<!-- +SPDX-FileCopyrightText: Google + +SPDX-License-Identifier: Apache-2.0 +--> + +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:autoMirrored="true" + android:tint="#000000" + android:viewportWidth="24" + android:viewportHeight="24"> + + <path + android:fillColor="@android:color/white" + android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z" /> + +</vector> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5544a08fa8e80201a2b7dc37609f9afdfc7921d9..fc80263a37be6d8ee0697ece51f1bb3c570cc960 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -268,4 +268,12 @@none <string name="italics">italics</string> <string name="colour">colour</string> <string name="line_decorations">Line name decorations</string> + <string name="acra_notification_channel">Crash reports channel</string> + <string name="acra_notification_channel_description">Notifications showing crashes and allowing sending crash reports</string> + <string name="acra_notification_title">Bimba has crashed</string> + <string name="acra_notification_text">An unexpected obstruction has shown up on Bimba’s way. Do you want to send a report?</string> + <string name="send">Send</string> + <string name="discard">Discard</string> + <string name="send_with_comment">Send with commend</string> + <string name="acra_notification_comment">Comment added to crash report</string> </resources>