Include the number of omitted logs (if > 0) in the bug report.

This commit is contained in:
Benoit Marty
2026-01-16 15:55:23 +01:00
parent b89e165dd6
commit de8d3aa695

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()
}