diff --git a/changelog.d/5021.bugfix b/changelog.d/5021.bugfix
new file mode 100644
index 0000000000..423df7b739
--- /dev/null
+++ b/changelog.d/5021.bugfix
@@ -0,0 +1 @@
+Improve auto rageshake lab feature
\ No newline at end of file
diff --git a/vector/src/main/java/im/vector/app/AutoRageShaker.kt b/vector/src/main/java/im/vector/app/AutoRageShaker.kt
index ca91f728cb..0238931e4c 100644
--- a/vector/src/main/java/im/vector/app/AutoRageShaker.kt
+++ b/vector/src/main/java/im/vector/app/AutoRageShaker.kt
@@ -67,6 +67,7 @@ class AutoRageShaker @Inject constructor(
fun initialize() {
observeActiveSession()
+ enable(vectorPreferences.labsAutoReportUISI())
// It's a singleton...
vectorPreferences.subscribeToChanges(this)
@@ -141,17 +142,19 @@ class AutoRageShaker @Inject constructor(
withCrashLogs = true,
withKeyRequestHistory = true,
withScreenshot = false,
- theBugDescription = "UISI detected",
+ theBugDescription = "Auto-reporting decryption error",
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
),
diff --git a/vector/src/main/java/im/vector/app/features/rageshake/BugReporter.kt b/vector/src/main/java/im/vector/app/features/rageshake/BugReporter.kt
index 26e9cabccb..b62a182fd8 100755
--- a/vector/src/main/java/im/vector/app/features/rageshake/BugReporter.kt
+++ b/vector/src/main/java/im/vector/app/features/rageshake/BugReporter.kt
@@ -259,13 +259,13 @@ 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")
+ .addFormDataPart("app", rageShakeAppNameForReport(context, reportType))
.addFormDataPart("user_agent", Matrix.getInstance(context).getUserAgent())
.addFormDataPart("user_id", userId)
.addFormDataPart("can_contact", canContact.toString())
@@ -340,9 +340,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")
}
}
@@ -481,6 +487,21 @@ class BugReporter @Inject constructor(
activity.startActivity(BugReportActivity.intent(activity, reportType))
}
+ private fun rageShakeAppNameForReport(context: Context, reportType: ReportType): String {
+ // As per https://github.com/matrix-org/rageshake
+ // app: Identifier for the application (eg 'riot-web').
+ // Should correspond to a mapping configured in the configuration file for github issue reporting to work.
+ // (see R.string.bug_report_url for configured RS server)
+ return when (reportType) {
+ ReportType.AUTO_UISI_SENDER,
+ ReportType.AUTO_UISI -> {
+ context.getString(R.string.bug_report_auto_uisi_app_name)
+ }
+ else -> {
+ context.getString(R.string.bug_report_app_name)
+ }
+ }
+ }
// ==============================================================================================================
// crash report management
// ==============================================================================================================
diff --git a/vector/src/main/res/values/config.xml b/vector/src/main/res/values/config.xml
index a8e80f82ed..8f23c2e1be 100755
--- a/vector/src/main/res/values/config.xml
+++ b/vector/src/main/res/values/config.xml
@@ -7,6 +7,8 @@
https://matrix.org
https://piwik.riot.im
https://riot.im/bugreports/submit
+ riot-android
+ element-auto-uisi