mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-21 15:05:19 +00:00
Updating QA tags for dialogs as per the QA Team's instructions
This commit is contained in:
parent
8fec296c11
commit
390757fe50
@ -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()
|
||||
|
@ -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) }
|
||||
)
|
||||
)
|
||||
|
@ -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)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -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
|
||||
)
|
||||
)
|
||||
|
@ -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),
|
||||
|
@ -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 = {}
|
||||
)
|
||||
),
|
||||
|
@ -128,6 +128,9 @@
|
||||
<string name="AccessibilityId_messageVoice">Voice message</string>
|
||||
<string name="AccessibilityId_deliveryIndicator">Delivered</string>
|
||||
<string name="AccessibilityId_message_request_config_message">Message request has been accepted</string>
|
||||
<!-- Modals -->
|
||||
<string name="AccessibilityId_modalTitle">Modal heading</string>
|
||||
<string name="AccessibilityId_modalMessage">Modal description</string>
|
||||
<!-- Delete message modal-->
|
||||
<string name="AccessibilityId_deleteMessageCancel">Cancel deletion</string>
|
||||
<string name="AccessibilityId_deleteMessageEveryone">Delete for everyone</string> <!-- ACL: Perhaps should be "AccessibilityId_clearMessagesForEveryone"? -->
|
||||
|
Loading…
Reference in New Issue
Block a user