Skip to content

Commit

Permalink
Add email to success response
Browse files Browse the repository at this point in the history
  • Loading branch information
Rawa committed Sep 27, 2023
1 parent 56fe418 commit 5cccca3
Showing 1 changed file with 39 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package net.mullvad.mullvadvpn.compose.dialog
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.size
Expand All @@ -13,6 +14,7 @@ import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
Expand All @@ -23,6 +25,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.tooling.preview.Preview
Expand Down Expand Up @@ -124,21 +127,44 @@ fun ReportProblemSuccessDialog(email: String?, onConfirm: () -> Unit) {
}
},
text = {
Text(
text =
buildAnnotatedString {
withStyle(SpanStyle(color = colorResource(id = R.color.green))) {
append(stringResource(id = R.string.sent_thanks))
}
append(" ")
Column {
Text(
text =
buildAnnotatedString {
withStyle(SpanStyle(color = colorResource(id = R.color.green))) {
append(stringResource(id = R.string.sent_thanks))
}
append(" ")

withStyle(SpanStyle(color = colorResource(id = R.color.white))) {
append(stringResource(id = R.string.we_will_look_into_this))
}
},
fontSize = dimensionResource(id = R.dimen.text_small).value.sp,
modifier = Modifier.fillMaxWidth()
)

withStyle(SpanStyle(color = colorResource(id = R.color.white))) {
append(stringResource(id = R.string.we_will_look_into_this))
Spacer(modifier = Modifier.height(Dimens.smallPadding))
email?.let {
val emailTemplate = stringResource(R.string.sent_contact)
val annotatedEmailString =
remember(it) {
val emailStart = emailTemplate.indexOf('%')

buildAnnotatedString {
append(emailTemplate.substring(0, emailStart))
withStyle(SpanStyle(fontWeight = FontWeight.Bold)) { append(email) }
}
}
},
fontSize = dimensionResource(id = R.dimen.text_small).value.sp,
modifier = Modifier.fillMaxWidth()
)

Text(
text = annotatedEmailString,
fontSize = dimensionResource(id = R.dimen.text_small).value.sp,
color = Color.White,
modifier = Modifier.fillMaxWidth()
)
}
}
},
confirmButton = {
ActionButton(
Expand Down

0 comments on commit 5cccca3

Please sign in to comment.