1. Added ACRA lib for crash reports

This commit is contained in:
vadym 2021-06-15 00:13:05 +03:00
parent 41d498fdfe
commit f60536a72b
6 changed files with 57 additions and 4 deletions

View File

@ -7,8 +7,8 @@ android {
applicationId "io.github.chronosx88.yggdrasil"
minSdkVersion 15
targetSdkVersion 29
versionCode 20
versionName "2.0"
versionCode 23
versionName "2.0.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
setProperty("archivesBaseName", project.getParent().name+"-"+versionName)
}
@ -62,12 +62,15 @@ gradle.projectsEvaluated {
}
dependencies {
implementation 'ch.acra:acra-http:5.8.3'
implementation 'ch.acra:acra-dialog:5.8.3'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(path: ':yggdrasil')
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation "androidx.preference:preference-ktx:1.1.1"
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8'

View File

@ -8,6 +8,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".YggApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"

View File

@ -0,0 +1,46 @@
package io.github.chronosx88.yggdrasil
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 YggApplication : Application() {
override fun attachBaseContext(base: Context) {
super.attachBaseContext(base)
initAcra {
//core configuration:
buildConfigClass = BuildConfig::class.java
reportFormat = StringFormat.JSON
//each plugin you chose above can be configured in a block like this:
httpSender {
uri = "http://<host>/report"
basicAuthLogin="***"
basicAuthPassword = "***"
httpMethod = HttpSender.Method.POST
}
dialog {
//required
text = getString(R.string.report_dialog_text)
//optional, enables the dialog title
title = getString(R.string.app_name)
//defaults to android.R.string.ok
positiveButtonText = getString(android.R.string.ok)
//defaults to android.R.string.cancel
negativeButtonText = getString(android.R.string.cancel)
//optional, enables the comment input
commentPrompt = getString(R.string.report_dialog_comment)
//optional, enables the email input
//emailPrompt = getString(R.string.report_dialog_email)
//defaults to android.R.drawable.ic_dialog_alert
resIcon = android.R.drawable.ic_dialog_alert
//optional, defaults to @android:style/Theme.Dialog
resTheme = R.style.Theme_AppCompat_Dialog
}
}
}
}

View File

@ -145,7 +145,6 @@ class YggdrasilTunService : VpnService() {
convertPeer2PeerStringList(meshPeers)
);
pi?.send(this, MainActivity.STATUS_PEERS_UPDATE, intent)
}
private fun fixConfig(

View File

@ -3,6 +3,7 @@ package io.github.chronosx88.yggdrasil.models.config
import com.google.gson.Gson
import io.github.chronosx88.yggdrasil.models.DNSInfo
import io.github.chronosx88.yggdrasil.models.PeerInfo
import org.acra.ACRA
import java.net.InetAddress
import java.net.InetSocketAddress
import java.net.Socket
@ -113,6 +114,7 @@ class Utils {
@JvmStatic
fun deserializePeerStringList2PeerInfoSet(list: List<String>?): MutableSet<PeerInfo> {
var gson = Gson()
ACRA.errorReporter.putCustomData("Peer list", gson.toJson(list))
var out = mutableSetOf<PeerInfo>()
if (list != null) {
for(s in list) {

View File

@ -9,4 +9,6 @@
<string name="schema">Schema</string>
<string name="title_activity_about">Yggdrasil</string>
<string name="title_activity_copy_local_node_info">Node info</string>
<string name="report_dialog_text">Sorry, the application crashed.</string>
<string name="report_dialog_comment">Please describe what were you doing when the app crashed:</string>
</resources>