mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-09 08:01:20 +02:00
Send crash reports to the server (#65)
Adds ability to send app crash reports to the last connected server. The app prompts you before sending. There is an advanced settings to disable this as well. Additionally, there is an advanced settings button to send the app logs to the current server. The resulting reports can be found on the server's web UI under Dashboard->Logs If sharing the logs, make sure there's no private information present!
This commit is contained in:
parent
05f3811149
commit
2667090485
11 changed files with 278 additions and 41 deletions
|
|
@ -1,10 +1,20 @@
|
|||
package com.github.damontecres.wholphin
|
||||
|
||||
import android.app.Application
|
||||
import android.os.Build
|
||||
import android.util.Log
|
||||
import androidx.compose.runtime.Composer
|
||||
import androidx.compose.runtime.ExperimentalComposeRuntimeApi
|
||||
import androidx.compose.runtime.tooling.ComposeStackTraceMode
|
||||
import dagger.hilt.android.HiltAndroidApp
|
||||
import org.acra.ACRA
|
||||
import org.acra.ReportField
|
||||
import org.acra.config.dialog
|
||||
import org.acra.data.StringFormat
|
||||
import org.acra.ktx.initAcra
|
||||
import timber.log.Timber
|
||||
|
||||
@OptIn(ExperimentalComposeRuntimeApi::class)
|
||||
@HiltAndroidApp
|
||||
class WholphinApplication : Application() {
|
||||
init {
|
||||
|
|
@ -31,6 +41,48 @@ class WholphinApplication : Application() {
|
|||
},
|
||||
)
|
||||
}
|
||||
|
||||
Composer.setDiagnosticStackTraceMode(
|
||||
if (BuildConfig.DEBUG) ComposeStackTraceMode.SourceInformation else ComposeStackTraceMode.GroupKeys,
|
||||
)
|
||||
}
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
initAcra {
|
||||
buildConfigClass = BuildConfig::class.java
|
||||
reportFormat = StringFormat.JSON
|
||||
excludeMatchingSharedPreferencesKeys = listOf()
|
||||
reportContent =
|
||||
listOf(
|
||||
ReportField.ANDROID_VERSION,
|
||||
ReportField.APP_VERSION_CODE,
|
||||
ReportField.APP_VERSION_NAME,
|
||||
ReportField.BRAND,
|
||||
// ReportField.BUILD_CONFIG,
|
||||
// ReportField.BUILD,
|
||||
ReportField.CUSTOM_DATA,
|
||||
ReportField.LOGCAT,
|
||||
ReportField.PHONE_MODEL,
|
||||
ReportField.PRODUCT,
|
||||
ReportField.REPORT_ID,
|
||||
ReportField.SHARED_PREFERENCES,
|
||||
ReportField.STACK_TRACE,
|
||||
ReportField.USER_COMMENT,
|
||||
ReportField.USER_CRASH_DATE,
|
||||
)
|
||||
dialog {
|
||||
text =
|
||||
"Wholphin has crashed! Would you like to attempt to " +
|
||||
"send a crash report to your Jellyfin server?"
|
||||
title = "Wholphin Crash Report"
|
||||
positiveButtonText = "Send"
|
||||
negativeButtonText = "Do not send"
|
||||
}
|
||||
reportSendFailureToast = "Crash report failed to send"
|
||||
reportSendSuccessToast = "Sent crash report!"
|
||||
}
|
||||
ACRA.errorReporter.putCustomData("SDK_INT", Build.VERSION.SDK_INT.toString())
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue