diff --git a/app/src/main/java/org/thoughtcrime/securesms/SessionDialogBuilder.kt b/app/src/main/java/org/thoughtcrime/securesms/SessionDialogBuilder.kt
index 69d58411f3..3e9fb7bcfb 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/SessionDialogBuilder.kt
+++ b/app/src/main/java/org/thoughtcrime/securesms/SessionDialogBuilder.kt
@@ -62,7 +62,10 @@ class SessionDialogBuilder(val context: Context) {
// Main title entry point
fun title(text: String?) {
- text(text, R.style.TextAppearance_Session_Dialog_Title) { setPadding(dp20, 0, dp20, 0) }
+ text(
+ text = text,
+ qaTag = context.getString(R.string.AccessibilityId_modalTitle),
+ style = R.style.TextAppearance_Session_Dialog_Title) { setPadding(dp20, 0, dp20, 0) }
}
// Convenience assessor for title that takes a string resource
@@ -74,18 +77,24 @@ class SessionDialogBuilder(val context: Context) {
fun text(@StringRes id: Int, style: Int? = null) = text(context.getString(id), style)
fun text(text: CharSequence?, @StyleRes style: Int? = null) {
- text(text, style) {
+ text(text = text, style = style) {
layoutParams = LinearLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT)
.apply { updateMargins(dp40, 0, dp40, 0) }
}
}
- private fun text(text: CharSequence?, @StyleRes style: Int? = null, modify: TextView.() -> Unit) {
+ private fun text(
+ text: CharSequence?,
+ qaTag: String = context.getString(R.string.AccessibilityId_modalMessage),
+ @StyleRes style: Int? = null,
+ modify: TextView.() -> Unit
+ ) {
text ?: return
TextView(context, null, 0, style ?: R.style.TextAppearance_Session_Dialog_Message)
.apply {
setText(text)
textAlignment = View.TEXT_ALIGNMENT_CENTER
+ contentDescription = qaTag
modify()
}.let(topView::addView)
@@ -166,7 +175,7 @@ class SessionDialogBuilder(val context: Context) {
textColor?.let{
setTextColor(it)
}
- contentDescription = resources.getString(contentDescriptionRes)
+ contentDescription = resources.getString(text) // QA now wants the qa tag to mtch the button's text
layoutParams = LinearLayout.LayoutParams(WRAP_CONTENT, dp60, 1f)
setOnClickListener {
listener.invoke()
diff --git a/app/src/main/java/org/thoughtcrime/securesms/debugmenu/DebugMenu.kt b/app/src/main/java/org/thoughtcrime/securesms/debugmenu/DebugMenu.kt
index 38a01a9db4..3ae656fa60 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/debugmenu/DebugMenu.kt
+++ b/app/src/main/java/org/thoughtcrime/securesms/debugmenu/DebugMenu.kt
@@ -74,12 +74,10 @@ fun DebugMenu(
buttons = listOf(
DialogButtonModel(
text = GetString(R.string.cancel),
- contentDescription = GetString(R.string.cancel),
onClick = { sendCommand(HideEnvironmentWarningDialog) }
),
DialogButtonModel(
text = GetString(R.string.ok),
- contentDescription = GetString(R.string.ok),
onClick = { sendCommand(ChangeEnvironment) }
)
)
diff --git a/app/src/main/java/org/thoughtcrime/securesms/media/MediaOverviewScreen.kt b/app/src/main/java/org/thoughtcrime/securesms/media/MediaOverviewScreen.kt
index 34ccc1c1c6..c6c6ca2e41 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/media/MediaOverviewScreen.kt
+++ b/app/src/main/java/org/thoughtcrime/securesms/media/MediaOverviewScreen.kt
@@ -231,8 +231,8 @@ private fun SaveAttachmentWarningDialog(
title = context.getString(R.string.warning),
text = context.resources.getString(R.string.attachmentsWarning),
buttons = listOf(
- DialogButtonModel(GetString(R.string.save), GetString(R.string.AccessibilityId_saveAttachment), color = LocalColors.current.danger, onClick = onAccepted),
- DialogButtonModel(GetString(android.R.string.cancel), GetString(R.string.AccessibilityId_cancel), dismissOnClick = true)
+ DialogButtonModel(GetString(R.string.save), color = LocalColors.current.danger, onClick = onAccepted),
+ DialogButtonModel(GetString(android.R.string.cancel), dismissOnClick = true)
)
)
}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/onboarding/landing/Landing.kt b/app/src/main/java/org/thoughtcrime/securesms/onboarding/landing/Landing.kt
index aab1421185..14eb2dbe06 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/onboarding/landing/Landing.kt
+++ b/app/src/main/java/org/thoughtcrime/securesms/onboarding/landing/Landing.kt
@@ -85,12 +85,10 @@ internal fun LandingScreen(
buttons = listOf(
DialogButtonModel(
text = GetString(R.string.onboardingTos),
- contentDescription = GetString(R.string.AccessibilityId_onboardingTos),
onClick = openTerms
),
DialogButtonModel(
text = GetString(R.string.onboardingPrivacy),
- contentDescription = GetString(R.string.AccessibilityId_onboardingPrivacy),
onClick = openPrivacyPolicy
)
)
diff --git a/app/src/main/java/org/thoughtcrime/securesms/preferences/SettingsActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/preferences/SettingsActivity.kt
index 83fca7fe7a..bbf075ca7c 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/preferences/SettingsActivity.kt
+++ b/app/src/main/java/org/thoughtcrime/securesms/preferences/SettingsActivity.kt
@@ -573,13 +573,11 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
buttons = listOf(
DialogButtonModel(
text = GetString(R.string.save),
- contentDescription = GetString(R.string.AccessibilityId_save),
enabled = state is TempAvatar,
onClick = saveAvatar
),
DialogButtonModel(
text = GetString(R.string.remove),
- contentDescription = GetString(R.string.AccessibilityId_remove),
color = LocalColors.current.danger,
enabled = state is UserAvatar || // can remove is the user has an avatar set
(state is TempAvatar && state.hasAvatar),
diff --git a/app/src/main/java/org/thoughtcrime/securesms/ui/AlertDialog.kt b/app/src/main/java/org/thoughtcrime/securesms/ui/AlertDialog.kt
index c4770f2110..988220960e 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/ui/AlertDialog.kt
+++ b/app/src/main/java/org/thoughtcrime/securesms/ui/AlertDialog.kt
@@ -55,7 +55,6 @@ import org.thoughtcrime.securesms.ui.theme.bold
class DialogButtonModel(
val text: GetString,
- val contentDescription: GetString = text,
val color: Color = Color.Unspecified,
val dismissOnClick: Boolean = true,
val enabled: Boolean = true,
@@ -130,6 +129,7 @@ fun AlertDialog(
textAlign = TextAlign.Center,
style = LocalType.current.h7,
modifier = Modifier.padding(bottom = LocalDimensions.current.xxsSpacing)
+ .qaTag(stringResource(R.string.AccessibilityId_modalTitle))
)
}
text?.let {
@@ -152,6 +152,7 @@ fun AlertDialog(
textAlign = TextAlign.Center,
style = textStyle,
modifier = textModifier
+ .qaTag(stringResource(R.string.AccessibilityId_modalMessage))
)
}
content()
@@ -163,7 +164,7 @@ fun AlertDialog(
text = it.text(),
modifier = Modifier
.fillMaxHeight()
- .contentDescription(it.contentDescription())
+ .qaTag(it.text.string())
.weight(1f),
color = it.color,
enabled = it.enabled
@@ -201,13 +202,11 @@ fun OpenURLAlertDialog(
buttons = listOf(
DialogButtonModel(
text = GetString(R.string.open),
- contentDescription = GetString(R.string.AccessibilityId_urlOpenBrowser),
color = LocalColors.current.danger,
onClick = { context.openUrl(url) }
),
DialogButtonModel(
text = GetString(android.R.string.copyUrl),
- contentDescription = GetString(R.string.AccessibilityId_copy),
onClick = {
context.copyURLToClipboard(url)
Toast.makeText(context, R.string.copied, Toast.LENGTH_SHORT).show()
@@ -297,7 +296,8 @@ fun LoadingDialog(
title?.let {
Text(
it,
- modifier = Modifier.align(Alignment.CenterHorizontally),
+ modifier = Modifier.align(Alignment.CenterHorizontally)
+ .qaTag(stringResource(R.string.AccessibilityId_modalTitle)),
style = LocalType.current.large
)
}
@@ -340,12 +340,10 @@ fun PreviewXCloseDialog() {
buttons = listOf(
DialogButtonModel(
text = GetString(R.string.onboardingTos),
- contentDescription = GetString(R.string.AccessibilityId_onboardingTos),
onClick = {}
),
DialogButtonModel(
text = GetString(R.string.onboardingPrivacy),
- contentDescription = GetString(R.string.AccessibilityId_onboardingPrivacy),
onClick = {}
)
),
diff --git a/content-descriptions/src/main/res/values/strings.xml b/content-descriptions/src/main/res/values/strings.xml
index 5eaab10ae0..4474dc6c88 100644
--- a/content-descriptions/src/main/res/values/strings.xml
+++ b/content-descriptions/src/main/res/values/strings.xml
@@ -128,6 +128,9 @@
Voice message
Delivered
Message request has been accepted
+
+ Modal heading
+ Modal description
Cancel deletion
Delete for everyone