mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 21:35:59 +00:00
Add enhanced one-session diagnostic bundles
This commit is contained in:
1 parent
b563b8d1eb
commit
5614bd5d5a
32 files changed
+3100
-141
No files matched your search
@@ -1884,7 +1884,17 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
Toast.makeText(this, R.string.session_no_logs, Toast.LENGTH_LONG).show()
|
||||
return
|
||||
}
|
||||
SessionLogShare.prepare(this, { folder }) { zip ->
|
||||
if (com.droiddeck.launcher.session.EnhancedDiagnostics.isActive(this, folder)) {
|
||||
SessionLogShare.prepareEnhanced(this, { folder }) { zips ->
|
||||
if (zips.isEmpty()) {
|
||||
Toast.makeText(this, R.string.session_logs_archive_failed, Toast.LENGTH_LONG).show()
|
||||
} else runCatching { shareEnhancedArchives(zips) }
|
||||
.onFailure {
|
||||
Log.w(TAG, "could not share current session logs", it)
|
||||
Toast.makeText(this, R.string.session_logs_share_failed, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
} else SessionLogShare.prepare(this, { folder }) { zip ->
|
||||
if (zip == null) {
|
||||
Toast.makeText(this, R.string.session_logs_archive_failed, Toast.LENGTH_LONG).show()
|
||||
} else {
|
||||
@@ -1897,6 +1907,26 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
}
|
||||
}
|
||||
|
||||
private fun shareEnhancedArchives(zips: List<File>) {
|
||||
val choices = zips.map { zip ->
|
||||
val label = when {
|
||||
zip.name.endsWith("-session.zip") -> getString(R.string.diagnostics_share_session)
|
||||
zip.name.endsWith("-graphics.zip") -> getString(R.string.diagnostics_share_graphics)
|
||||
else -> getString(R.string.diagnostics_share_games)
|
||||
}
|
||||
label to listOf(zip)
|
||||
} + (getString(R.string.diagnostics_share_all) to zips)
|
||||
android.app.AlertDialog.Builder(this)
|
||||
.setTitle(R.string.diagnostics_share_title)
|
||||
.setItems(choices.map { it.first }.toTypedArray()) { _, which ->
|
||||
val selected = choices[which].second
|
||||
startActivity(if (selected.size == 1) SessionLogShare.shareIntent(this, selected.single())
|
||||
else SessionLogShare.shareEnhancedIntent(this, selected))
|
||||
}
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.show()
|
||||
}
|
||||
|
||||
private fun readPrefs() {
|
||||
pipAutoEnter = SessionPrefs.pipAutoEnter(this)
|
||||
unfoldedControls = SessionPrefs.unfoldedControls(this)
|
||||
|
||||
Reference in new issue
Block a user