Skip to content

Commit

Permalink
Merge branch 'mihonapp:main' into test-2
Browse files Browse the repository at this point in the history
  • Loading branch information
xteamlyer authored May 2, 2024
2 parents 54dd524 + a3d438e commit 6013a37
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fun CrashScreen(
acceptText = stringResource(MR.strings.pref_dump_crash_logs),
onAcceptClick = {
scope.launch {
CrashLogUtil(context).dumpLogs()
CrashLogUtil(context).dumpLogs(exception)
}
},
rejectText = stringResource(MR.strings.crash_screen_restart_application),
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/eu/kanade/tachiyomi/util/CrashLogUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ class CrashLogUtil(
private val extensionManager: ExtensionManager = Injekt.get(),
) {

suspend fun dumpLogs() = withNonCancellableContext {
suspend fun dumpLogs(exception: Throwable? = null) = withNonCancellableContext {
try {
val file = context.createFileInCacheDir("mihon_crash_logs.txt")

file.appendText(getDebugInfo() + "\n\n")
getExtensionsInfo()?.let { file.appendText("$it\n\n") }
exception?.let { file.appendText("$it\n\n") }

Runtime.getRuntime().exec("logcat *:E -d -f ${file.absolutePath}").waitFor()

Expand Down

0 comments on commit 6013a37

Please sign in to comment.