Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update feedback form note #21489

Merged
merged 5 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ class FeedbackFormActivity : LocaleAwareActivity() {
},
onRemoveMediaClick = {
viewModel.onRemoveMediaClick(it)
}
},
onSupportClick = {
// This will return to the Help screen, where the user can see the contact support link
finish()
},
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,15 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.LinkAnnotation
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.TextLinkStyles
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.input.KeyboardCapitalization
import androidx.compose.ui.text.withLink
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import kotlinx.coroutines.flow.MutableStateFlow
Expand All @@ -59,6 +65,7 @@ fun FeedbackFormScreen(
onCloseClick: (context: Context) -> Unit,
onChooseMediaClick: () -> Unit,
onRemoveMediaClick: (uri: Uri) -> Unit,
onSupportClick: () -> Unit,
) {
val context = LocalContext.current
val message = messageText?.value ?: ""
Expand All @@ -68,6 +75,7 @@ fun FeedbackFormScreen(
onMessageChanged = {
onMessageChanged(it)
},
onSupportClick = onSupportClick
)
MediaUriPager(
mediaUris = attachments.value.map { it.uri },
Expand Down Expand Up @@ -101,7 +109,18 @@ fun FeedbackFormScreen(
private fun MessageSection(
messageText: String?,
onMessageChanged: (String) -> Unit,
onSupportClick: () -> Unit
) {
val linkText = stringResource(id = R.string.feedback_form_note_link)
val linkAnnotation = LinkAnnotation.Url(
url = "support",
styles = TextLinkStyles(
style = SpanStyle(color = colorResource(id = R.color.primary))
)
) {
onSupportClick()
}

val focusRequester = remember { FocusRequester() }
LaunchedEffect(Unit) {
focusRequester.requestFocus()
Expand All @@ -114,6 +133,17 @@ private fun MessageSection(
horizontal = H_PADDING.dp
)
) {
Text(
text = buildAnnotatedString {
append(stringResource(id = R.string.feedback_form_note_text))
withLink(
linkAnnotation
) {
append(linkText)
}
},
modifier = Modifier.padding(bottom = V_PADDING.dp)
)
OutlinedTextField(
value = messageText ?: "",
placeholder = {
Expand All @@ -129,15 +159,8 @@ private fun MessageSection(
modifier = Modifier
.fillMaxWidth()
.defaultMinSize(minHeight = 180.dp)
.focusRequester(focusRequester),
)
Text(
text = stringResource(id = R.string.feedback_form_note),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier
.focusRequester(focusRequester)
.padding(top = V_PADDING.dp)

)
}
}
Expand Down Expand Up @@ -276,7 +299,8 @@ private fun FeedbackFormScreenPreview() {
onSubmitClick = {},
onCloseClick = {},
onChooseMediaClick = {},
onRemoveMediaClick = {}
onRemoveMediaClick = {},
onSupportClick = {},
)
}

Expand Down
3 changes: 2 additions & 1 deletion WordPress/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,8 @@
<string name="feedback_form_attachment_already_added">Attachment already added</string>
<string name="feedback_form_unable_to_create_tempfile">Unable to create temporary file</string>
<string name="feedback_form_add_attachments">Add attachments</string>
<string name="feedback_form_note">If you need support, please get in touch using the \"Contact Support\" screen</string>
<string name="feedback_form_note_text">Please note this is not a support form, and we will not be able to reply. If you need support, please use our "</string>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the trailing " for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a trailing space, because feedback_form_note_link ("Contact Support screen") is appended to this string as a link.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2024-11-25 at 5 39 05 PM

<string name="feedback_form_note_link">Contact Support screen.</string>
<string name="media_pager_remove_item_content_description">Remove item %1$d</string>

<!-- activity log -->
Expand Down