mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
quick cleaning / code review
This commit is contained in:
parent
f0dfb1dc02
commit
553e55b4d1
@ -67,8 +67,8 @@ class AutoRageShaker @Inject constructor(
|
||||
|
||||
fun initialize() {
|
||||
observeActiveSession()
|
||||
// It's a singleton...
|
||||
enable(vectorPreferences.labsAutoReportUISI())
|
||||
// It's a singleton...
|
||||
vectorPreferences.subscribeToChanges(this)
|
||||
|
||||
// Simple rate limit, notice that order is not
|
||||
@ -142,7 +142,7 @@ class AutoRageShaker @Inject constructor(
|
||||
withCrashLogs = true,
|
||||
withKeyRequestHistory = true,
|
||||
withScreenshot = false,
|
||||
theBugDescription = "Auto-reporting decryption error (recipient)",
|
||||
theBugDescription = "Auto-reporting decryption error",
|
||||
serverVersion = "",
|
||||
canContact = false,
|
||||
customFields = mapOf("auto_uisi" to buildString {
|
||||
|
@ -265,17 +265,7 @@ class BugReporter @Inject constructor(
|
||||
// build the multi part request
|
||||
val builder = BugReporterMultipartBody.Builder()
|
||||
.addFormDataPart("text", text)
|
||||
.apply {
|
||||
when (reportType) {
|
||||
ReportType.AUTO_UISI_SENDER,
|
||||
ReportType.AUTO_UISI -> {
|
||||
addFormDataPart("app", "element-auto-uisi")
|
||||
}
|
||||
else -> {
|
||||
addFormDataPart("app", "riot-android")
|
||||
}
|
||||
}
|
||||
}
|
||||
.addFormDataPart("app", rageShakeAppNameForReport(reportType))
|
||||
.addFormDataPart("user_agent", Matrix.getInstance(context).getUserAgent())
|
||||
.addFormDataPart("user_id", userId)
|
||||
.addFormDataPart("can_contact", canContact.toString())
|
||||
@ -497,6 +487,21 @@ class BugReporter @Inject constructor(
|
||||
activity.startActivity(BugReportActivity.intent(activity, reportType))
|
||||
}
|
||||
|
||||
private fun rageShakeAppNameForReport(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 -> {
|
||||
"element-auto-uisi"
|
||||
}
|
||||
else -> {
|
||||
"riot-android"
|
||||
}
|
||||
}
|
||||
}
|
||||
// ==============================================================================================================
|
||||
// crash report management
|
||||
// ==============================================================================================================
|
||||
|
Loading…
Reference in New Issue
Block a user