Skip to content

Commit

Permalink
fix: update 2FA code and E2EI enrollment screens UI [WPB-6772] (#2828)
Browse files Browse the repository at this point in the history
  • Loading branch information
saleniuk authored Mar 28, 2024
1 parent fec0ad9 commit 7d5208b
Show file tree
Hide file tree
Showing 31 changed files with 72 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,28 @@ package com.wire.android.ui.authentication.login.email
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.constraintlayout.compose.ConstraintLayout
import androidx.constraintlayout.compose.Dimension
import androidx.hilt.navigation.compose.hiltViewModel
import com.wire.android.R
import com.wire.android.ui.authentication.verificationcode.VerificationCode
import com.wire.android.ui.authentication.verificationcode.VerificationCodeState
import com.wire.android.ui.common.Logo
import com.wire.android.ui.common.colorsScheme
import com.wire.android.ui.common.dimensions
import com.wire.android.ui.common.spacers.VerticalSpace
import com.wire.android.ui.common.scaffold.WireScaffold
import com.wire.android.ui.common.textfield.CodeFieldValue
import com.wire.android.ui.common.topappbar.WireCenterAlignedTopAppBar
import com.wire.android.ui.common.typography
import com.wire.android.ui.theme.WireTheme
import com.wire.android.util.ui.PreviewMultipleThemes
import com.wire.android.util.ui.UIText

Expand All @@ -65,36 +65,26 @@ private fun LoginEmailVerificationCodeContent(
onCodeChange: (CodeFieldValue) -> Unit,
onCodeResend: () -> Unit,
onBackPressed: () -> Unit,
modifier: Modifier = Modifier,
) {
BackHandler { onBackPressed() }
ConstraintLayout(
modifier = modifier
.fillMaxSize()
.padding(dimensions().spacing32x)
) {
val (main, logo) = createRefs()
Logo(
modifier = Modifier
.height(dimensions().spacing24x)
.constrainAs(logo) {
start.linkTo(parent.start)
end.linkTo(parent.end)
bottom.linkTo(parent.bottom)
}
)
WireScaffold(
topBar = {
WireCenterAlignedTopAppBar(
elevation = dimensions().spacing0x,
title = stringResource(id = R.string.second_factor_authentication_title),
navigationIconType = null,
)
}
) { internalPadding ->
MainContent(
codeState = verificationCodeState,
isLoading = isLoading,
onCodeChange = onCodeChange,
onResendCode = onCodeResend,
modifier = Modifier.constrainAs(main) {
top.linkTo(parent.top)
bottom.linkTo(logo.top)
start.linkTo(parent.start)
end.linkTo(parent.end)
height = Dimension.fillToConstraints
}
modifier = Modifier
.fillMaxSize()
.padding(internalPadding)
.padding(dimensions().spacing16x)
)
}
}
Expand All @@ -107,17 +97,10 @@ private fun MainContent(
onResendCode: () -> Unit,
modifier: Modifier = Modifier
) = Column(
horizontalAlignment = Alignment.Start,
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
modifier = modifier
) {
Text(
text = UIText.StringResource(R.string.second_factor_authentication_title).asString(),
color = colorsScheme().onBackground,
style = typography().title01,
textAlign = TextAlign.Start
)
VerticalSpace.x24()
Text(
text = UIText.StringResource(
R.string.second_factor_authentication_instructions_label,
Expand All @@ -127,7 +110,9 @@ private fun MainContent(
style = typography().body01,
textAlign = TextAlign.Start
)
VerticalSpace.x32()
Spacer(modifier = Modifier
.height(dimensions().spacing8x)
.weight(1f))
VerificationCode(
codeLength = codeState.codeLength,
currentCode = codeState.codeInput.text,
Expand All @@ -136,20 +121,24 @@ private fun MainContent(
onCodeChange = onCodeChange,
onResendCode = onResendCode,
)
Spacer(modifier = Modifier
.height(dimensions().spacing8x)
.weight(1f))
}

@Preview(showBackground = true)
@PreviewMultipleThemes
@Composable
internal fun LoginEmailVerificationCodeScreenPreview() = LoginEmailVerificationCodeContent(
VerificationCodeState(
codeLength = 6,
codeInput = CodeFieldValue(TextFieldValue("12"), false),
isCurrentCodeInvalid = false,
emailUsed = ""
),
false,
{},
{},
{},
)
internal fun LoginEmailVerificationCodeScreenPreview() = WireTheme {
LoginEmailVerificationCodeContent(
VerificationCodeState(
codeLength = 6,
codeInput = CodeFieldValue(TextFieldValue("12"), false),
isCurrentCodeInvalid = false,
emailUsed = ""
),
false,
{},
{},
{},
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ package com.wire.android.ui.e2eiEnrollment
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.material3.MaterialTheme
Expand All @@ -34,7 +31,6 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import com.ramcosta.composedestinations.annotation.Destination
import com.ramcosta.composedestinations.annotation.RootNavGraph
Expand Down Expand Up @@ -133,7 +129,7 @@ private fun E2EIEnrollmentScreenContent(
WireScaffold(
topBar = {
WireCenterAlignedTopAppBar(
elevation = 0.dp,
elevation = dimensions().spacing0x,
title = stringResource(id = R.string.end_to_end_identity_required_dialog_title),
navigationIconType = NavigationIconType.Close,
onNavigationPressed = onBackButtonClicked
Expand Down Expand Up @@ -162,9 +158,10 @@ private fun E2EIEnrollmentScreenContent(
Column(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Top,
modifier = Modifier.padding(PaddingValues(MaterialTheme.wireDimensions.dialogContentPadding))
modifier = Modifier
.padding(internalPadding)
.padding(MaterialTheme.wireDimensions.spacing16x)
) {
Spacer(modifier = Modifier.height(internalPadding.calculateTopPadding()))
val text = buildAnnotatedString {
val style = SpanStyle(
color = colorsScheme().onBackground,
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-af/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
settings, your conversation history has also been deleted.</string>
<!-- Second Factor Authentication -->
<string name="second_factor_authentication_title">Verify your account</string>
<string name="second_factor_authentication_instructions_label">Enter the verification code sent to the email %1$s</string>
<string name="second_factor_authentication_instructions_label">Please, check your email %1$s for the verification code and enter it below.</string>
<string name="second_factor_code_error">Invalid code, or maximum attempts exceeded. Please retry, or request another code</string>
<!-- Remove Device -->
<string name="remove_device_title">Remove a Device</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
settings, your conversation history has also been deleted.</string>
<!-- Second Factor Authentication -->
<string name="second_factor_authentication_title">Verify your account</string>
<string name="second_factor_authentication_instructions_label">Enter the verification code sent to the email %1$s</string>
<string name="second_factor_authentication_instructions_label">Please, check your email %1$s for the verification code and enter it below.</string>
<string name="second_factor_code_error">Invalid code, or maximum attempts exceeded. Please retry, or request another code</string>
<!-- Remove Device -->
<string name="remove_device_title">Remove a Device</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-bn/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
settings, your conversation history has also been deleted.</string>
<!-- Second Factor Authentication -->
<string name="second_factor_authentication_title">Verify your account</string>
<string name="second_factor_authentication_instructions_label">Enter the verification code sent to the email %1$s</string>
<string name="second_factor_authentication_instructions_label">Please, check your email %1$s for the verification code and enter it below.</string>
<string name="second_factor_code_error">Invalid code, or maximum attempts exceeded. Please retry, or request another code</string>
<!-- Remove Device -->
<string name="remove_device_title">Remove a Device</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-ca/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
settings, your conversation history has also been deleted.</string>
<!-- Second Factor Authentication -->
<string name="second_factor_authentication_title">Verify your account</string>
<string name="second_factor_authentication_instructions_label">Enter the verification code sent to the email %1$s</string>
<string name="second_factor_authentication_instructions_label">Please, check your email %1$s for the verification code and enter it below.</string>
<string name="second_factor_code_error">Invalid code, or maximum attempts exceeded. Please retry, or request another code</string>
<!-- Remove Device -->
<string name="remove_device_title">Remove a Device</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@
settings, your conversation history has also been deleted.</string>
<!-- Second Factor Authentication -->
<string name="second_factor_authentication_title">Verify your account</string>
<string name="second_factor_authentication_instructions_label">Enter the verification code sent to the email %1$s</string>
<string name="second_factor_authentication_instructions_label">Please, check your email %1$s for the verification code and enter it below.</string>
<string name="second_factor_code_error">Invalid code, or maximum attempts exceeded. Please retry, or request another code</string>
<!-- Remove Device -->
<string name="remove_device_title">Remove a Device</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-da/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
settings, your conversation history has also been deleted.</string>
<!-- Second Factor Authentication -->
<string name="second_factor_authentication_title">Verify your account</string>
<string name="second_factor_authentication_instructions_label">Enter the verification code sent to the email %1$s</string>
<string name="second_factor_authentication_instructions_label">Please, check your email %1$s for the verification code and enter it below.</string>
<string name="second_factor_code_error">Invalid code, or maximum attempts exceeded. Please retry, or request another code</string>
<!-- Remove Device -->
<string name="remove_device_title">Remove a Device</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-el/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
settings, your conversation history has also been deleted.</string>
<!-- Second Factor Authentication -->
<string name="second_factor_authentication_title">Verify your account</string>
<string name="second_factor_authentication_instructions_label">Enter the verification code sent to the email %1$s</string>
<string name="second_factor_authentication_instructions_label">Please, check your email %1$s for the verification code and enter it below.</string>
<string name="second_factor_code_error">Invalid code, or maximum attempts exceeded. Please retry, or request another code</string>
<!-- Remove Device -->
<string name="remove_device_title">Remove a Device</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-et/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
settings, your conversation history has also been deleted.</string>
<!-- Second Factor Authentication -->
<string name="second_factor_authentication_title">Kinnita oma konto</string>
<string name="second_factor_authentication_instructions_label">Enter the verification code sent to the email %1$s</string>
<string name="second_factor_authentication_instructions_label">Please, check your email %1$s for the verification code and enter it below.</string>
<string name="second_factor_code_error">Invalid code, or maximum attempts exceeded. Please retry, or request another code</string>
<!-- Remove Device -->
<string name="remove_device_title">Remove a Device</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-fa/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
settings, your conversation history has also been deleted.</string>
<!-- Second Factor Authentication -->
<string name="second_factor_authentication_title">Verify your account</string>
<string name="second_factor_authentication_instructions_label">Enter the verification code sent to the email %1$s</string>
<string name="second_factor_authentication_instructions_label">Please, check your email %1$s for the verification code and enter it below.</string>
<string name="second_factor_code_error">Invalid code, or maximum attempts exceeded. Please retry, or request another code</string>
<!-- Remove Device -->
<string name="remove_device_title">Remove a Device</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-fi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
settings, your conversation history has also been deleted.</string>
<!-- Second Factor Authentication -->
<string name="second_factor_authentication_title">Verify your account</string>
<string name="second_factor_authentication_instructions_label">Enter the verification code sent to the email %1$s</string>
<string name="second_factor_authentication_instructions_label">Please, check your email %1$s for the verification code and enter it below.</string>
<string name="second_factor_code_error">Invalid code, or maximum attempts exceeded. Please retry, or request another code</string>
<!-- Remove Device -->
<string name="remove_device_title">Remove a Device</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-he/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@
settings, your conversation history has also been deleted.</string>
<!-- Second Factor Authentication -->
<string name="second_factor_authentication_title">Verify your account</string>
<string name="second_factor_authentication_instructions_label">Enter the verification code sent to the email %1$s</string>
<string name="second_factor_authentication_instructions_label">Please, check your email %1$s for the verification code and enter it below.</string>
<string name="second_factor_code_error">Invalid code, or maximum attempts exceeded. Please retry, or request another code</string>
<!-- Remove Device -->
<string name="remove_device_title">Remove a Device</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-hi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
settings, your conversation history has also been deleted.</string>
<!-- Second Factor Authentication -->
<string name="second_factor_authentication_title">Verify your account</string>
<string name="second_factor_authentication_instructions_label">Enter the verification code sent to the email %1$s</string>
<string name="second_factor_authentication_instructions_label">Please, check your email %1$s for the verification code and enter it below.</string>
<string name="second_factor_code_error">Invalid code, or maximum attempts exceeded. Please retry, or request another code</string>
<!-- Remove Device -->
<string name="remove_device_title">Remove a Device</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-id/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@
settings, your conversation history has also been deleted.</string>
<!-- Second Factor Authentication -->
<string name="second_factor_authentication_title">Verify your account</string>
<string name="second_factor_authentication_instructions_label">Enter the verification code sent to the email %1$s</string>
<string name="second_factor_authentication_instructions_label">Please, check your email %1$s for the verification code and enter it below.</string>
<string name="second_factor_code_error">Invalid code, or maximum attempts exceeded. Please retry, or request another code</string>
<!-- Remove Device -->
<string name="remove_device_title">Remove a Device</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@
settings, your conversation history has also been deleted.</string>
<!-- Second Factor Authentication -->
<string name="second_factor_authentication_title">Verify your account</string>
<string name="second_factor_authentication_instructions_label">Enter the verification code sent to the email %1$s</string>
<string name="second_factor_authentication_instructions_label">Please, check your email %1$s for the verification code and enter it below.</string>
<string name="second_factor_code_error">Invalid code, or maximum attempts exceeded. Please retry, or request another code</string>
<!-- Remove Device -->
<string name="remove_device_title">Remove a Device</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-ko/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@
settings, your conversation history has also been deleted.</string>
<!-- Second Factor Authentication -->
<string name="second_factor_authentication_title">Verify your account</string>
<string name="second_factor_authentication_instructions_label">Enter the verification code sent to the email %1$s</string>
<string name="second_factor_authentication_instructions_label">Please, check your email %1$s for the verification code and enter it below.</string>
<string name="second_factor_code_error">Invalid code, or maximum attempts exceeded. Please retry, or request another code</string>
<!-- Remove Device -->
<string name="remove_device_title">Remove a Device</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-lt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@
settings, your conversation history has also been deleted.</string>
<!-- Second Factor Authentication -->
<string name="second_factor_authentication_title">Verify your account</string>
<string name="second_factor_authentication_instructions_label">Enter the verification code sent to the email %1$s</string>
<string name="second_factor_authentication_instructions_label">Please, check your email %1$s for the verification code and enter it below.</string>
<string name="second_factor_code_error">Invalid code, or maximum attempts exceeded. Please retry, or request another code</string>
<!-- Remove Device -->
<string name="remove_device_title">Remove a Device</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-mk/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
settings, your conversation history has also been deleted.</string>
<!-- Second Factor Authentication -->
<string name="second_factor_authentication_title">Verify your account</string>
<string name="second_factor_authentication_instructions_label">Enter the verification code sent to the email %1$s</string>
<string name="second_factor_authentication_instructions_label">Please, check your email %1$s for the verification code and enter it below.</string>
<string name="second_factor_code_error">Invalid code, or maximum attempts exceeded. Please retry, or request another code</string>
<!-- Remove Device -->
<string name="remove_device_title">Remove a Device</string>
Expand Down
Loading

0 comments on commit 7d5208b

Please sign in to comment.