Allow shorter bug report messages for internal / debug builds

Change-Id: I0dd84bcca6d28ce9615ae40c06020a65d2401eea
This commit is contained in:
SpiritCroc 2022-05-17 10:11:50 +02:00
parent cc96b2e198
commit 1eed611f4e
1 changed files with 10 additions and 1 deletions

View File

@ -26,6 +26,7 @@ import androidx.core.widget.doOnTextChanged
import com.airbnb.mvrx.viewModel
import com.airbnb.mvrx.withState
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.BuildConfig
import im.vector.app.R
import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.databinding.ActivityBugReportBinding
@ -131,10 +132,18 @@ class BugReportActivity : VectorBaseActivity<ActivityBugReportBinding>() {
return super.onPrepareOptionsMenu(menu)
}
private fun minBugReportLength(): Int {
return if (BuildConfig.DEBUG || BuildConfig.GIT_BRANCH_NAME == "sm_fdroid") {
2
} else {
10
}
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.ic_action_send_bug_report -> {
if (views.bugReportEditText.text.toString().trim().length >= 10) {
if (views.bugReportEditText.text.toString().trim().length >= minBugReportLength()) {
sendBugReport()
} else {
views.bugReportTextInputLayout.error = getString(R.string.bug_report_error_too_short)