Merge pull request #6027 from element-hq/feature/bma/improveRageshake

Let rageshake description mention when a log file is missing
This commit is contained in:
Benoit Marty
2026-01-19 09:22:20 +01:00
committed by GitHub
2 changed files with 11 additions and 5 deletions

View File

@@ -139,7 +139,7 @@ class PreferencesRootPresenter(
return PreferencesRootState(
myUser = matrixUser.value,
version = versionFormatter.get(),
version = remember { versionFormatter.get() },
deviceId = matrixClient.deviceId,
isMultiAccountEnabled = isMultiAccountEnabled,
otherSessions = otherSessions,

View File

@@ -147,14 +147,19 @@ class DefaultBugReporter(
}
}
val gzippedFiles = mutableListOf<File>()
var filesTooBig = 0
if (withDevicesLogs) {
val files = getLogFiles().sortedByDescending { it.lastModified() }
files.mapNotNullTo(gzippedFiles) { file ->
val filesBySize = files.groupBy {
it.length() < RageshakeConfig.MAX_LOG_CONTENT_SIZE
}
filesBySize[true].orEmpty().mapNotNullTo(gzippedFiles) { file ->
when {
file.extension == "gz" -> file
else -> compressFile(file)
}
}
filesTooBig = filesBySize[false].orEmpty().size
}
if (withCrashLogs || withDevicesLogs) {
saveLogCat()
@@ -192,7 +197,9 @@ class DefaultBugReporter(
.addFormDataPart("label", buildMeta.versionName)
.addFormDataPart("label", buildMeta.flavorDescription)
.addFormDataPart("branch_name", buildMeta.gitBranchName)
if (filesTooBig > 0) {
builder.addFormDataPart("omitted_logs", filesTooBig.toString())
}
userId?.let {
matrixClientProvider.getOrNull(it)?.let { client ->
val curveKey = client.encryptionService.deviceCurve25519()
@@ -394,8 +401,7 @@ class DefaultBugReporter(
logDirectory.listFiles()
?.filter {
it.isFile &&
!it.name.endsWith(LOG_CAT_FILENAME) &&
it.length() < RageshakeConfig.MAX_LOG_CONTENT_SIZE
!it.name.endsWith(LOG_CAT_FILENAME)
}
}.orEmpty()
}