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
|
// Main title entry point
|
||||||
fun title(text: String?) {
|
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
|
// 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(@StringRes id: Int, style: Int? = null) = text(context.getString(id), style)
|
||||||
|
|
||||||
fun text(text: CharSequence?, @StyleRes style: Int? = null) {
|
fun text(text: CharSequence?, @StyleRes style: Int? = null) {
|
||||||
text(text, style) {
|
text(text = text, style = style) {
|
||||||
layoutParams = LinearLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT)
|
layoutParams = LinearLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT)
|
||||||
.apply { updateMargins(dp40, 0, dp40, 0) }
|
.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
|
text ?: return
|
||||||
TextView(context, null, 0, style ?: R.style.TextAppearance_Session_Dialog_Message)
|
TextView(context, null, 0, style ?: R.style.TextAppearance_Session_Dialog_Message)
|
||||||
.apply {
|
.apply {
|
||||||
setText(text)
|
setText(text)
|
||||||
textAlignment = View.TEXT_ALIGNMENT_CENTER
|
textAlignment = View.TEXT_ALIGNMENT_CENTER
|
||||||
|
contentDescription = qaTag
|
||||||
modify()
|
modify()
|
||||||
}.let(topView::addView)
|
}.let(topView::addView)
|
||||||
|
|
||||||
@ -166,7 +175,7 @@ class SessionDialogBuilder(val context: Context) {
|
|||||||
textColor?.let{
|
textColor?.let{
|
||||||
setTextColor(it)
|
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)
|
layoutParams = LinearLayout.LayoutParams(WRAP_CONTENT, dp60, 1f)
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
listener.invoke()
|
listener.invoke()
|
||||||
|
@ -74,12 +74,10 @@ fun DebugMenu(
|
|||||||
buttons = listOf(
|
buttons = listOf(
|
||||||
DialogButtonModel(
|
DialogButtonModel(
|
||||||
text = GetString(R.string.cancel),
|
text = GetString(R.string.cancel),
|
||||||
contentDescription = GetString(R.string.cancel),
|
|
||||||
onClick = { sendCommand(HideEnvironmentWarningDialog) }
|
onClick = { sendCommand(HideEnvironmentWarningDialog) }
|
||||||
),
|
),
|
||||||
DialogButtonModel(
|
DialogButtonModel(
|
||||||
text = GetString(R.string.ok),
|
text = GetString(R.string.ok),
|
||||||
contentDescription = GetString(R.string.ok),
|
|
||||||
onClick = { sendCommand(ChangeEnvironment) }
|
onClick = { sendCommand(ChangeEnvironment) }
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -231,8 +231,8 @@ private fun SaveAttachmentWarningDialog(
|
|||||||
title = context.getString(R.string.warning),
|
title = context.getString(R.string.warning),
|
||||||
text = context.resources.getString(R.string.attachmentsWarning),
|
text = context.resources.getString(R.string.attachmentsWarning),
|
||||||
buttons = listOf(
|
buttons = listOf(
|
||||||
DialogButtonModel(GetString(R.string.save), GetString(R.string.AccessibilityId_saveAttachment), color = LocalColors.current.danger, onClick = onAccepted),
|
DialogButtonModel(GetString(R.string.save), color = LocalColors.current.danger, onClick = onAccepted),
|
||||||
DialogButtonModel(GetString(android.R.string.cancel), GetString(R.string.AccessibilityId_cancel), dismissOnClick = true)
|
DialogButtonModel(GetString(android.R.string.cancel), dismissOnClick = true)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -85,12 +85,10 @@ internal fun LandingScreen(
|
|||||||
buttons = listOf(
|
buttons = listOf(
|
||||||
DialogButtonModel(
|
DialogButtonModel(
|
||||||
text = GetString(R.string.onboardingTos),
|
text = GetString(R.string.onboardingTos),
|
||||||
contentDescription = GetString(R.string.AccessibilityId_onboardingTos),
|
|
||||||
onClick = openTerms
|
onClick = openTerms
|
||||||
),
|
),
|
||||||
DialogButtonModel(
|
DialogButtonModel(
|
||||||
text = GetString(R.string.onboardingPrivacy),
|
text = GetString(R.string.onboardingPrivacy),
|
||||||
contentDescription = GetString(R.string.AccessibilityId_onboardingPrivacy),
|
|
||||||
onClick = openPrivacyPolicy
|
onClick = openPrivacyPolicy
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -573,13 +573,11 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
buttons = listOf(
|
buttons = listOf(
|
||||||
DialogButtonModel(
|
DialogButtonModel(
|
||||||
text = GetString(R.string.save),
|
text = GetString(R.string.save),
|
||||||
contentDescription = GetString(R.string.AccessibilityId_save),
|
|
||||||
enabled = state is TempAvatar,
|
enabled = state is TempAvatar,
|
||||||
onClick = saveAvatar
|
onClick = saveAvatar
|
||||||
),
|
),
|
||||||
DialogButtonModel(
|
DialogButtonModel(
|
||||||
text = GetString(R.string.remove),
|
text = GetString(R.string.remove),
|
||||||
contentDescription = GetString(R.string.AccessibilityId_remove),
|
|
||||||
color = LocalColors.current.danger,
|
color = LocalColors.current.danger,
|
||||||
enabled = state is UserAvatar || // can remove is the user has an avatar set
|
enabled = state is UserAvatar || // can remove is the user has an avatar set
|
||||||
(state is TempAvatar && state.hasAvatar),
|
(state is TempAvatar && state.hasAvatar),
|
||||||
|
@ -55,7 +55,6 @@ import org.thoughtcrime.securesms.ui.theme.bold
|
|||||||
|
|
||||||
class DialogButtonModel(
|
class DialogButtonModel(
|
||||||
val text: GetString,
|
val text: GetString,
|
||||||
val contentDescription: GetString = text,
|
|
||||||
val color: Color = Color.Unspecified,
|
val color: Color = Color.Unspecified,
|
||||||
val dismissOnClick: Boolean = true,
|
val dismissOnClick: Boolean = true,
|
||||||
val enabled: Boolean = true,
|
val enabled: Boolean = true,
|
||||||
@ -130,6 +129,7 @@ fun AlertDialog(
|
|||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
style = LocalType.current.h7,
|
style = LocalType.current.h7,
|
||||||
modifier = Modifier.padding(bottom = LocalDimensions.current.xxsSpacing)
|
modifier = Modifier.padding(bottom = LocalDimensions.current.xxsSpacing)
|
||||||
|
.qaTag(stringResource(R.string.AccessibilityId_modalTitle))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
text?.let {
|
text?.let {
|
||||||
@ -152,6 +152,7 @@ fun AlertDialog(
|
|||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
style = textStyle,
|
style = textStyle,
|
||||||
modifier = textModifier
|
modifier = textModifier
|
||||||
|
.qaTag(stringResource(R.string.AccessibilityId_modalMessage))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
content()
|
content()
|
||||||
@ -163,7 +164,7 @@ fun AlertDialog(
|
|||||||
text = it.text(),
|
text = it.text(),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxHeight()
|
.fillMaxHeight()
|
||||||
.contentDescription(it.contentDescription())
|
.qaTag(it.text.string())
|
||||||
.weight(1f),
|
.weight(1f),
|
||||||
color = it.color,
|
color = it.color,
|
||||||
enabled = it.enabled
|
enabled = it.enabled
|
||||||
@ -201,13 +202,11 @@ fun OpenURLAlertDialog(
|
|||||||
buttons = listOf(
|
buttons = listOf(
|
||||||
DialogButtonModel(
|
DialogButtonModel(
|
||||||
text = GetString(R.string.open),
|
text = GetString(R.string.open),
|
||||||
contentDescription = GetString(R.string.AccessibilityId_urlOpenBrowser),
|
|
||||||
color = LocalColors.current.danger,
|
color = LocalColors.current.danger,
|
||||||
onClick = { context.openUrl(url) }
|
onClick = { context.openUrl(url) }
|
||||||
),
|
),
|
||||||
DialogButtonModel(
|
DialogButtonModel(
|
||||||
text = GetString(android.R.string.copyUrl),
|
text = GetString(android.R.string.copyUrl),
|
||||||
contentDescription = GetString(R.string.AccessibilityId_copy),
|
|
||||||
onClick = {
|
onClick = {
|
||||||
context.copyURLToClipboard(url)
|
context.copyURLToClipboard(url)
|
||||||
Toast.makeText(context, R.string.copied, Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, R.string.copied, Toast.LENGTH_SHORT).show()
|
||||||
@ -297,7 +296,8 @@ fun LoadingDialog(
|
|||||||
title?.let {
|
title?.let {
|
||||||
Text(
|
Text(
|
||||||
it,
|
it,
|
||||||
modifier = Modifier.align(Alignment.CenterHorizontally),
|
modifier = Modifier.align(Alignment.CenterHorizontally)
|
||||||
|
.qaTag(stringResource(R.string.AccessibilityId_modalTitle)),
|
||||||
style = LocalType.current.large
|
style = LocalType.current.large
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -340,12 +340,10 @@ fun PreviewXCloseDialog() {
|
|||||||
buttons = listOf(
|
buttons = listOf(
|
||||||
DialogButtonModel(
|
DialogButtonModel(
|
||||||
text = GetString(R.string.onboardingTos),
|
text = GetString(R.string.onboardingTos),
|
||||||
contentDescription = GetString(R.string.AccessibilityId_onboardingTos),
|
|
||||||
onClick = {}
|
onClick = {}
|
||||||
),
|
),
|
||||||
DialogButtonModel(
|
DialogButtonModel(
|
||||||
text = GetString(R.string.onboardingPrivacy),
|
text = GetString(R.string.onboardingPrivacy),
|
||||||
contentDescription = GetString(R.string.AccessibilityId_onboardingPrivacy),
|
|
||||||
onClick = {}
|
onClick = {}
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
@ -128,6 +128,9 @@
|
|||||||
<string name="AccessibilityId_messageVoice">Voice message</string>
|
<string name="AccessibilityId_messageVoice">Voice message</string>
|
||||||
<string name="AccessibilityId_deliveryIndicator">Delivered</string>
|
<string name="AccessibilityId_deliveryIndicator">Delivered</string>
|
||||||
<string name="AccessibilityId_message_request_config_message">Message request has been accepted</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-->
|
<!-- Delete message modal-->
|
||||||
<string name="AccessibilityId_deleteMessageCancel">Cancel deletion</string>
|
<string name="AccessibilityId_deleteMessageCancel">Cancel deletion</string>
|
||||||
<string name="AccessibilityId_deleteMessageEveryone">Delete for everyone</string> <!-- ACL: Perhaps should be "AccessibilityId_clearMessagesForEveryone"? -->
|
<string name="AccessibilityId_deleteMessageEveryone">Delete for everyone</string> <!-- ACL: Perhaps should be "AccessibilityId_clearMessagesForEveryone"? -->
|
||||||
|
Loading…
Reference in New Issue
Block a user