Skip to content

Commit

Permalink
Merge pull request #196 from Tiqr/feature/sync-servicedesk-locales
Browse files Browse the repository at this point in the history
Use servicedesk strings as on web
  • Loading branch information
dzolnai authored Feb 27, 2025
2 parents b6daabb + cc2a567 commit f52e951
Show file tree
Hide file tree
Showing 8 changed files with 268 additions and 229 deletions.
1 change: 1 addition & 0 deletions app/src/main/kotlin/nl/eduid/di/model/EduIdModels.kt
Original file line number Diff line number Diff line change
Expand Up @@ -276,4 +276,5 @@ data class ControlCode(
val lastName: String?,
val dayOfBirth: String?,
val code: String,
val createdAt: Long
) : Parcelable
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ fun VerifyWithIdCodeScreen(
firstName = viewModel.controlCode.firstName,
lastName = viewModel.controlCode.lastName,
dayOfBirth = viewModel.controlCode.dayOfBirth,
createdAt = viewModel.controlCode.createdAt,
editVerificationCode = {
editCode(viewModel.controlCode)
},
Expand All @@ -106,6 +107,7 @@ fun VerifyWithIdCodeScreenContent(
firstName: String?,
lastName: String?,
dayOfBirth: String?,
createdAt: Long,
editVerificationCode: () -> Unit,
deleteVerificationCode: () -> Unit,
openShowServiceDesksUrl: (String) -> Unit,
Expand All @@ -121,7 +123,7 @@ fun VerifyWithIdCodeScreenContent(
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(
text = stringResource(R.string.ConfirmIdentityWithIdCode_Title_COPY),
text = stringResource(R.string.ServiceDesk_ControlCode_YourControlCode_COPY),
style = MaterialTheme.typography.titleLarge.copy(
textAlign = TextAlign.Start, color = MaterialTheme.colorScheme.onSecondary
),
Expand All @@ -148,8 +150,10 @@ fun VerifyWithIdCodeScreenContent(
)
}
Spacer(Modifier.height(24.dp))
val oneDayInMs = 1000 * 60 * 60 * 24
val validForDays = 14 - (System.currentTimeMillis() - createdAt) / oneDayInMs
Text(
text = stringResource(R.string.ConfirmIdentityWithIdCode_Explanation_COPY),
text = stringResource(R.string.ServiceDesk_ControlCode_Info_COPY, validForDays),
style = MaterialTheme.typography.bodyLarge,
modifier = Modifier.fillMaxWidth()
)
Expand All @@ -173,7 +177,7 @@ fun VerifyWithIdCodeScreenContent(
.fillMaxWidth()
.align(Alignment.Start)
.padding(vertical = 8.dp),
text = stringResource(R.string.ConfirmIdentityWithIdInput_InputField_LastName_COPY),
text = stringResource(R.string.ServiceDesk_IdCard_LastName_COPY),
style = MaterialTheme.typography.bodyLarge.copy(
color = MaterialTheme.colorScheme.onPrimaryContainer,
fontWeight = FontWeight.SemiBold
Expand All @@ -193,7 +197,7 @@ fun VerifyWithIdCodeScreenContent(
.fillMaxWidth()
.align(Alignment.Start)
.padding(vertical = 8.dp),
text = stringResource(R.string.ConfirmIdentityWithIdInput_InputField_FirstNames_COPY),
text = stringResource(R.string.ServiceDesk_IdCard_FirstName_COPY),
style = MaterialTheme.typography.bodyLarge.copy(
color = MaterialTheme.colorScheme.onPrimaryContainer,
fontWeight = FontWeight.SemiBold
Expand All @@ -212,7 +216,7 @@ fun VerifyWithIdCodeScreenContent(
.fillMaxWidth()
.align(Alignment.Start)
.padding(vertical = 8.dp),
text = stringResource(R.string.ConfirmIdentityWithIdInput_InputField_DateOfBirth_COPY),
text = stringResource(R.string.ServiceDesk_IdCard_DayOfBirth_COPY),
style = MaterialTheme.typography.bodyLarge.copy(
color = MaterialTheme.colorScheme.onPrimaryContainer,
fontWeight = FontWeight.SemiBold
Expand All @@ -226,8 +230,8 @@ fun VerifyWithIdCodeScreenContent(
modifier = Modifier.fillMaxWidth()
)
Spacer(Modifier.height(24.dp))
val label = stringResource(R.string.ConfirmIdentityWithIdCode_MadeATypo_Label_COPY)
val linkedPart = stringResource(R.string.ConfirmIdentityWithIdCode_MadeATypo_Link_COPY)
val label = stringResource(R.string.ServiceDesk_ControlCode_TypoPrefix_COPY)
val linkedPart = stringResource(R.string.ServiceDesk_ControlCode_TypoLink_COPY)
val labelAndLink = buildAnnotatedString {
append(label)
append(" ")
Expand Down Expand Up @@ -258,22 +262,22 @@ fun VerifyWithIdCodeScreenContent(
}
Spacer(Modifier.height(32.dp))
Text(
text = stringResource(R.string.ConfirmIdentityWithIdCode_WhatsNext_COPY),
text = stringResource(R.string.ServiceDesk_ControlCode_Todo_COPY),
style = MaterialTheme.typography.bodyLarge.copy(fontWeight = FontWeight.Bold),
modifier = Modifier.fillMaxWidth()
)
Spacer(Modifier.height(16.dp))
Text(
text = stringResource(R.string.ConfirmIdentityWithIdCode_ScheduleAnAppointment_COPY),
text = stringResource(R.string.ServiceDesk_ControlCode_TodoDetails_COPY),
style = MaterialTheme.typography.bodyLarge,
modifier = Modifier.fillMaxWidth()
)
Spacer(Modifier.height(24.dp))
val serviceDeskUrl = stringResource(R.string.ConfirmIdentityWithIdCode_ServiceDeskUrl_COPY)
val serviceDeskUrl = stringResource(R.string.ServiceDesk_ControlCode_ServiceDesksLocations_COPY)
PrimaryButton(
enabled = !isLoading,
modifier = Modifier.fillMaxWidth(),
text = stringResource(R.string.ConfirmIdentityWithIdCode_ShowServiceDesksButton_COPY),
text = stringResource(R.string.ServiceDesk_ControlCode_ServiceDesks_COPY),
onClick = {
openShowServiceDesksUrl(serviceDeskUrl)
}
Expand All @@ -282,7 +286,7 @@ fun VerifyWithIdCodeScreenContent(
SecondaryButton(
enabled = !isLoading,
modifier = Modifier.fillMaxWidth(),
text = stringResource(R.string.ConfirmIdentityWithIdCode_GoToHomePageButton_COPY),
text = stringResource(R.string.ServiceDesk_ControlCode_Back_COPY),
onClick = goToPersonalInfo
)
Spacer(Modifier.height(20.dp))
Expand All @@ -293,7 +297,7 @@ fun VerifyWithIdCodeScreenContent(
)
Spacer(Modifier.height(20.dp))
Text(
text = stringResource(R.string.ConfirmIdentityWithIdCode_ProveIdentityOtherWay_COPY),
text = stringResource(R.string.ServiceDesk_ControlCode_Rethink_COPY),
style = MaterialTheme.typography.bodyLarge,
modifier = Modifier.fillMaxWidth()
)
Expand All @@ -317,7 +321,7 @@ fun VerifyWithIdCodeScreenContent(
.sizeIn(minHeight = 48.dp)
) {
Text(
text = stringResource(R.string.ConfirmIdentityWithIdCode_DeleteVerificationCodeButton_COPY),
text = stringResource(R.string.ServiceDesk_ControlCode_DeleteControlCode_COPY),
style = MaterialTheme.typography.bodyLarge.copy(
color = if (isLoading) ColorScale_Gray_400 else ColorAlertRed,
fontWeight = FontWeight.SemiBold
Expand All @@ -337,6 +341,7 @@ fun VerifyWithIdCodeScreenContent_Preview() {
firstName = "First name",
lastName = "Last name",
dayOfBirth = "1993-12-24",
createdAt = System.currentTimeMillis(),
editVerificationCode = {},
deleteVerificationCode = {},
openShowServiceDesksUrl = {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ fun VerifyWithIdInputScreenContent(
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(
text = stringResource(R.string.ConfirmIdentityWithIdInput_Title_FirstLine_COPY),
text = stringResource(R.string.ConfirmIdentityWithIdIntro_Title_FirstLine_COPY),
style = MaterialTheme.typography.titleLarge.copy(
textAlign = TextAlign.Start, color = MaterialTheme.colorScheme.onSecondary
),
Expand All @@ -112,7 +112,7 @@ fun VerifyWithIdInputScreenContent(
.padding(top = 16.dp)
)
Text(
text = stringResource(R.string.ConfirmIdentityWithIdInput_Title_SecondLine_COPY),
text = stringResource(R.string.ConfirmIdentityWithIdIntro_Title_SecondLine_COPY),
style = MaterialTheme.typography.titleLarge.copy(
textAlign = TextAlign.Start
),
Expand All @@ -133,7 +133,7 @@ fun VerifyWithIdInputScreenContent(
Spacer(Modifier.height(32.dp))

Text(
text = stringResource(R.string.ConfirmIdentityWithIdInput_Explanation_COPY),
text = stringResource(R.string.ServiceDesk_IdCard_Information_COPY),
style = MaterialTheme.typography.bodyLarge,
modifier = Modifier.fillMaxWidth()
)
Expand All @@ -146,7 +146,7 @@ fun VerifyWithIdInputScreenContent(
.fillMaxWidth()
.align(Alignment.Start)
.padding(vertical = 8.dp),
text = stringResource(R.string.ConfirmIdentityWithIdInput_InputField_LastName_COPY),
text = stringResource(R.string.ServiceDesk_IdCard_LastName_COPY),
style = MaterialTheme.typography.bodyLarge.copy(
color = MaterialTheme.colorScheme.onPrimaryContainer,
fontWeight = FontWeight.SemiBold
Expand Down Expand Up @@ -178,7 +178,7 @@ fun VerifyWithIdInputScreenContent(
.fillMaxWidth()
.align(Alignment.Start)
.padding(vertical = 8.dp),
text = stringResource(R.string.ConfirmIdentityWithIdInput_InputField_FirstNames_COPY),
text = stringResource(R.string.ServiceDesk_IdCard_FirstName_COPY),
style = MaterialTheme.typography.bodyLarge.copy(
color = MaterialTheme.colorScheme.onPrimaryContainer,
fontWeight = FontWeight.SemiBold
Expand Down Expand Up @@ -209,7 +209,7 @@ fun VerifyWithIdInputScreenContent(
.fillMaxWidth()
.align(Alignment.Start)
.padding(vertical = 8.dp),
text = stringResource(R.string.ConfirmIdentityWithIdInput_InputField_DateOfBirth_COPY),
text = stringResource(R.string.ServiceDesk_IdCard_DayOfBirth_COPY),
style = MaterialTheme.typography.bodyLarge.copy(
color = MaterialTheme.colorScheme.onPrimaryContainer,
fontWeight = FontWeight.SemiBold
Expand All @@ -236,7 +236,7 @@ fun VerifyWithIdInputScreenContent(
PrimaryButton(
enabled = !isLoading && firstName.isNotEmpty() && lastName.isNotEmpty() && dateOfBirth.isNotEmpty(),
modifier = Modifier.fillMaxWidth(),
text = stringResource(R.string.ConfirmIdentityWithIdInput_GenerateVerificationCodeButton_COPY),
text = stringResource(R.string.ServiceDesk_IdCard_GenerateControlCode_COPY),
onClick = {
val payload = ControlCodeRequest(
firstName = firstName,
Expand Down Expand Up @@ -265,7 +265,7 @@ fun VerifyWithIdInputScreenContent_Preview() {
EduidAppAndroidTheme {
VerifyWithIdInputScreenContent(
isLoading = false,
editCode = ControlCode(firstName = "First name", lastName = "Last name", dayOfBirth = "01-01-2000", code = "123456"),
editCode = ControlCode(firstName = "First name", lastName = "Last name", dayOfBirth = "01-01-2000", code = "123456", createdAt = System.currentTimeMillis()),
generateCode = { _ -> },
errorData = null,
dismissError = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class VerifyWithIdInputViewModel @Inject constructor(
uiState = uiState.copy(createdControlCode = response)
} catch (ex: Exception) {
uiState = uiState.copy(isLoading = false, errorData = ErrorData(
titleId = R.string.ConfirmIdentityWithIdInput_GenerateError_COPY,
titleId = R.string.ResponseErrors_GenerateControlCodeError_COPY,
message = ex.message ?: "Unknown error"
))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.constraintlayout.compose.ConstraintLayout
import androidx.constraintlayout.compose.Dimension
import androidx.core.text.parseAsHtml
import nl.eduid.R
import nl.eduid.ui.EduIdTopAppBar
import nl.eduid.ui.PrimaryButton
Expand Down Expand Up @@ -83,21 +84,21 @@ fun VerifyWithIdIntroScreenContent(
)
Spacer(Modifier.height(16.dp))
Text(
text = stringResource(R.string.ConfirmIdentityWithIdIntro_Description_ServiceDesk_COPY),
text = stringResource(R.string.ServiceDesk_ConfirmIdentity_COPY),
style = MaterialTheme.typography.bodyLarge,
modifier = Modifier.fillMaxWidth()
)
Spacer(Modifier.height(16.dp))
Text(
text = stringResource(R.string.ConfirmIdentityWithIdIntro_Description_Steps_Header_COPY),
text = stringResource(R.string.ServiceDesk_StepsHeader_COPY),
style = MaterialTheme.typography.bodyLarge.copy(fontWeight = FontWeight.Bold),
modifier = Modifier.fillMaxWidth()
)
Spacer(Modifier.height(16.dp))
val steps = listOf(
R.string.ConfirmIdentityWithIdIntro_Description_Steps_Step1_COPY,
R.string.ConfirmIdentityWithIdIntro_Description_Steps_Step2_COPY,
R.string.ConfirmIdentityWithIdIntro_Description_Steps_Step3_COPY
R.string.ServiceDesk_Step1_COPY,
R.string.ServiceDesk_Step2_COPY,
R.string.ServiceDesk_Step3_COPY
)
steps.forEachIndexed { index, step ->
Row {
Expand Down Expand Up @@ -130,9 +131,19 @@ fun VerifyWithIdIntroScreenContent(
start.linkTo(parent.start, margin = 12.dp)
}
)
val validDocumentsTextComponents = listOf(
stringResource(R.string.ServiceDesk_AcceptedIds_COPY),
"-" + stringResource(R.string.ServiceDesk_Passports_COPY),
"-" + stringResource(R.string.ServiceDesk_Eea_COPY).parseAsHtml(),
"-" + stringResource(R.string.ServiceDesk_DriverLicense_COPY),
"-" + stringResource(R.string.ServiceDesk_ResidencePermit_COPY),
"",
stringResource(R.string.ServiceDesk_Note_COPY),
""
).joinToString(separator = "\n")
Text(
style = MaterialTheme.typography.bodyLarge,
text = stringResource(R.string.ConfirmIdentityWithIdIntro_ValidDocumentsDisclaimer_List_COPY),
text = validDocumentsTextComponents,
modifier = Modifier
.constrainAs(topText) {
start.linkTo(image.end, margin = 12.dp)
Expand All @@ -141,9 +152,10 @@ fun VerifyWithIdIntroScreenContent(
width = Dimension.fillToConstraints
}
)

Text(
style = MaterialTheme.typography.bodySmall,
text = stringResource(R.string.ConfirmIdentityWithIdIntro_ValidDocumentsDisclaimer_Asterisk_COPY),
text = stringResource(R.string.ServiceDesk_EeaNote_COPY).parseAsHtml().toString(),
modifier = Modifier
.constrainAs(bottomText) {
start.linkTo(image.end, margin = 12.dp)
Expand All @@ -157,7 +169,7 @@ fun VerifyWithIdIntroScreenContent(
Spacer(Modifier.height(72.dp))
PrimaryButton(
modifier = Modifier.fillMaxWidth(),
text = stringResource(R.string.ConfirmIdentityWithIdIntro_EnterDetailsButton_COPY),
text = stringResource(R.string.ServiceDesk_Next_COPY),
onClick = goToEnterDetails
)
}
Expand Down
Loading

0 comments on commit f52e951

Please sign in to comment.