Add export log to debug settings screen
This commit is contained in:
parent
ed11330674
commit
ef01439ded
@ -440,6 +440,7 @@
|
|||||||
|
|
||||||
<string name="preference_crash_reporter">Crash-Reporter</string>
|
<string name="preference_crash_reporter">Crash-Reporter</string>
|
||||||
<string name="preference_crash_reporter_summary">Fehler- und Absturzberichte</string>
|
<string name="preference_crash_reporter_summary">Fehler- und Absturzberichte</string>
|
||||||
|
<string name="preference_export_log">Log-Datei exportieren</string>
|
||||||
|
|
||||||
<string name="preference_music_filter_sources">Auf Musik-Apps begrenzen</string>
|
<string name="preference_music_filter_sources">Auf Musik-Apps begrenzen</string>
|
||||||
<string name="preference_music_filter_sources_summary">Mediensitzungen von Apps ignorieren, die keine Musik-Apps sind</string>
|
<string name="preference_music_filter_sources_summary">Mediensitzungen von Apps ignorieren, die keine Musik-Apps sind</string>
|
||||||
|
|||||||
@ -478,6 +478,7 @@
|
|||||||
|
|
||||||
<string name="preference_crash_reporter">Crash reporter</string>
|
<string name="preference_crash_reporter">Crash reporter</string>
|
||||||
<string name="preference_crash_reporter_summary">Error and crash reports</string>
|
<string name="preference_crash_reporter_summary">Error and crash reports</string>
|
||||||
|
<string name="preference_export_log">Export log file</string>
|
||||||
|
|
||||||
<string name="preference_music_filter_sources">Restrict to music apps</string>
|
<string name="preference_music_filter_sources">Restrict to music apps</string>
|
||||||
<string name="preference_music_filter_sources_summary">Ignore media sessions of apps that are not music apps</string>
|
<string name="preference_music_filter_sources_summary">Ignore media sessions of apps that are not music apps</string>
|
||||||
|
|||||||
@ -1,16 +1,24 @@
|
|||||||
package de.mm20.launcher2.ui.settings.debug
|
package de.mm20.launcher2.ui.settings.debug
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.core.content.FileProvider
|
||||||
import de.mm20.launcher2.crashreporter.CrashReporter
|
import de.mm20.launcher2.crashreporter.CrashReporter
|
||||||
|
import de.mm20.launcher2.debug.DebugInformationDumper
|
||||||
|
import de.mm20.launcher2.ktx.tryStartActivity
|
||||||
import de.mm20.launcher2.ui.R
|
import de.mm20.launcher2.ui.R
|
||||||
import de.mm20.launcher2.ui.component.preferences.Preference
|
import de.mm20.launcher2.ui.component.preferences.Preference
|
||||||
import de.mm20.launcher2.ui.component.preferences.PreferenceScreen
|
import de.mm20.launcher2.ui.component.preferences.PreferenceScreen
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun DebugSettingsScreen() {
|
fun DebugSettingsScreen() {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
val scope = rememberCoroutineScope()
|
||||||
PreferenceScreen(
|
PreferenceScreen(
|
||||||
stringResource(R.string.preference_screen_debug)
|
stringResource(R.string.preference_screen_debug)
|
||||||
) {
|
) {
|
||||||
@ -21,6 +29,28 @@ fun DebugSettingsScreen() {
|
|||||||
onClick = {
|
onClick = {
|
||||||
context.startActivity(CrashReporter.getLaunchIntent())
|
context.startActivity(CrashReporter.getLaunchIntent())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Preference(
|
||||||
|
title = stringResource(R.string.preference_export_log),
|
||||||
|
onClick = {
|
||||||
|
scope.launch {
|
||||||
|
val path = DebugInformationDumper().dump(context)
|
||||||
|
context.tryStartActivity(
|
||||||
|
Intent.createChooser(
|
||||||
|
Intent(Intent.ACTION_SEND).apply {
|
||||||
|
type = "text/plain"
|
||||||
|
putExtra(
|
||||||
|
Intent.EXTRA_STREAM, FileProvider.getUriForFile(
|
||||||
|
context,
|
||||||
|
context.applicationContext.packageName + ".fileprovider",
|
||||||
|
File(path)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}, null
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user