Quick fixes on auto uisi RS

This commit is contained in:
Valere 2022-01-21 10:27:33 +01:00
parent a085b4db21
commit 4d7e46b751
2 changed files with 41 additions and 20 deletions

View file

@ -68,6 +68,7 @@ class AutoRageShaker @Inject constructor(
fun initialize() {
observeActiveSession()
// It's a singleton...
enable(vectorPreferences.labsAutoReportUISI())
vectorPreferences.subscribeToChanges(this)
// Simple rate limit, notice that order is not
@ -141,17 +142,19 @@ class AutoRageShaker @Inject constructor(
withCrashLogs = true,
withKeyRequestHistory = true,
withScreenshot = false,
theBugDescription = "UISI detected",
theBugDescription = "Auto-reporting decryption error (recipient)",
serverVersion = "",
canContact = false,
customFields = mapOf("auto-uisi" to buildString {
append("\neventId: ${target.eventId}")
append("\nroomId: ${target.roomId}")
append("\nsenderKey: ${target.senderKey}")
append("\nsource: ${target.source}")
append("\ndeviceId: ${target.senderDeviceId}")
append("\nuserId: ${target.senderUserId}")
append("\nsessionId: ${target.sessionId}")
customFields = mapOf("auto_uisi" to buildString {
append("{")
append("\"event_id\": \"${target.eventId}\",")
append("\"room_id\": \"${target.roomId}\",")
append("\"sender_key\": \"${target.senderKey}\",")
append("\"device_id\": \"${target.senderDeviceId}\",")
append("\"source\": \"${target.source}\",")
append("\"user_id\": \"${target.senderUserId}\",")
append("\"session_id\": \"${target.sessionId}\"")
append("}")
}),
listener = object : BugReporter.IMXBugReportListener {
override fun onUploadCancelled() {
@ -221,17 +224,19 @@ class AutoRageShaker @Inject constructor(
withCrashLogs = true,
withKeyRequestHistory = true,
withScreenshot = false,
theBugDescription = "UISI detected $matchingIssue",
theBugDescription = "Auto-reporting decryption error \nRecipient rageshake: $matchingIssue",
serverVersion = "",
canContact = false,
customFields = mapOf(
"auto-uisi" to buildString {
append("\neventId: $eventId")
append("\nroomId: $roomId")
append("\nsenderKey: $senderKey")
append("\ndeviceId: $deviceId")
append("\nuserId: $userId")
append("\nsessionId: $sessionId")
"auto_uisi" to buildString {
append("{")
append("\"event_id\": \"$eventId\",")
append("\"room_id\": \"$roomId\",")
append("\"sender_key\": \"$senderKey\",")
append("\"device_id\": \"$deviceId\",")
append("\"user_id\": \"$userId\",")
append("\"session_id\": \"$sessionId\"")
append("}")
},
"recipient_rageshake" to matchingIssue
),

View file

@ -259,13 +259,23 @@ class BugReporter @Inject constructor(
ReportType.SUGGESTION -> "[Element] [Suggestion] $bugDescription"
ReportType.SPACE_BETA_FEEDBACK -> "[Element] [spaces-feedback] $bugDescription"
ReportType.AUTO_UISI_SENDER,
ReportType.AUTO_UISI -> "[AutoUISI] $bugDescription"
ReportType.AUTO_UISI -> bugDescription
}
// build the multi part request
val builder = BugReporterMultipartBody.Builder()
.addFormDataPart("text", text)
.addFormDataPart("app", "riot-android")
.apply {
when (reportType) {
ReportType.AUTO_UISI_SENDER,
ReportType.AUTO_UISI -> {
addFormDataPart("app", "element-auto-uisi")
}
else -> {
addFormDataPart("app", "riot-android")
}
}
}
.addFormDataPart("user_agent", Matrix.getInstance(context).getUserAgent())
.addFormDataPart("user_id", userId)
.addFormDataPart("can_contact", canContact.toString())
@ -340,9 +350,15 @@ class BugReporter @Inject constructor(
}
ReportType.SUGGESTION -> builder.addFormDataPart("label", "[Suggestion]")
ReportType.SPACE_BETA_FEEDBACK -> builder.addFormDataPart("label", "spaces-feedback")
ReportType.AUTO_UISI,
ReportType.AUTO_UISI -> {
builder.addFormDataPart("label", "Z-UISI")
builder.addFormDataPart("label", "android")
builder.addFormDataPart("label", "uisi-recipient")
}
ReportType.AUTO_UISI_SENDER -> {
builder.addFormDataPart("label", "Z-UISI")
builder.addFormDataPart("label", "android")
builder.addFormDataPart("label", "uisi-sender")
}
}