add share gpu log button

This commit is contained in:
MrPurple666 2026-01-26 23:47:01 -03:00
parent 0f5c595908
commit 572810e022
2 changed files with 45 additions and 0 deletions

View File

@ -222,6 +222,14 @@ class HomeSettingsFragment : Fragment() {
{ shareLog() } { shareLog() }
) )
) )
add(
HomeSetting(
R.string.share_gpu_log,
R.string.share_gpu_log_description,
R.drawable.ic_log,
{ shareGpuLog() }
)
)
add( add(
HomeSetting( HomeSetting(
R.string.open_user_folder, R.string.open_user_folder,
@ -408,6 +416,40 @@ class HomeSettingsFragment : Fragment() {
} }
} }
private fun shareGpuLog() {
val currentLog = DocumentFile.fromSingleUri(
mainActivity,
DocumentsContract.buildDocumentUri(
DocumentProvider.AUTHORITY,
"${DocumentProvider.ROOT_ID}/log/eden_gpu.log"
)
)!!
val oldLog = DocumentFile.fromSingleUri(
mainActivity,
DocumentsContract.buildDocumentUri(
DocumentProvider.AUTHORITY,
"${DocumentProvider.ROOT_ID}/log/eden_gpu.log.old.txt"
)
)!!
val intent = Intent(Intent.ACTION_SEND)
.setDataAndType(currentLog.uri, FileUtil.TEXT_PLAIN)
.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
if (!Log.gameLaunched && oldLog.exists()) {
intent.putExtra(Intent.EXTRA_STREAM, oldLog.uri)
startActivity(Intent.createChooser(intent, getText(R.string.share_gpu_log)))
} else if (currentLog.exists()) {
intent.putExtra(Intent.EXTRA_STREAM, currentLog.uri)
startActivity(Intent.createChooser(intent, getText(R.string.share_gpu_log)))
} else {
Toast.makeText(
requireContext(),
getText(R.string.share_gpu_log_missing),
Toast.LENGTH_SHORT
).show()
}
}
private fun setInsets() = private fun setInsets() =
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { view, windowInsets -> ViewCompat.setOnApplyWindowInsetsListener(binding.root) { view, windowInsets ->
val barInsets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()) val barInsets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())

View File

@ -325,6 +325,9 @@
<string name="share_log">Share debug logs</string> <string name="share_log">Share debug logs</string>
<string name="share_log_description">Share Eden\'s log file to debug issues</string> <string name="share_log_description">Share Eden\'s log file to debug issues</string>
<string name="share_log_missing">No log file found</string> <string name="share_log_missing">No log file found</string>
<string name="share_gpu_log">Share GPU logs</string>
<string name="share_gpu_log_description">Share Eden\'s GPU log file to debug graphics issues</string>
<string name="share_gpu_log_missing">No GPU log file found</string>
<string name="install_game_content">Install game content</string> <string name="install_game_content">Install game content</string>
<string name="install_game_content_description">Install game updates or DLC</string> <string name="install_game_content_description">Install game updates or DLC</string>
<string name="installing_game_content">Installing content…</string> <string name="installing_game_content">Installing content…</string>