BIT-544: Apply reskin to LandingScreen (#71)

This commit is contained in:
Brian Yencho 2023-09-28 09:29:32 -05:00 committed by Álison Fernandes
parent a1096d21ec
commit a223e2fed5
7 changed files with 326 additions and 72 deletions

View file

@ -2,29 +2,39 @@ package com.x8bit.bitwarden.ui.auth.feature.landing
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.material3.Button import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Switch
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.x8bit.bitwarden.R import com.x8bit.bitwarden.R
import com.x8bit.bitwarden.ui.platform.base.util.EventsEffect import com.x8bit.bitwarden.ui.platform.base.util.EventsEffect
import com.x8bit.bitwarden.ui.platform.components.BitwardenFilledButton
import com.x8bit.bitwarden.ui.platform.components.BitwardenSwitch
import com.x8bit.bitwarden.ui.platform.components.BitwardenTextButton
import com.x8bit.bitwarden.ui.platform.components.BitwardenTextField import com.x8bit.bitwarden.ui.platform.components.BitwardenTextField
/** /**
@ -45,103 +55,109 @@ fun LandingScreen(
} }
} }
val scrollState = rememberScrollState()
Column( Column(
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(24.dp),
modifier = Modifier modifier = Modifier
.background(MaterialTheme.colorScheme.background) .background(MaterialTheme.colorScheme.background)
.padding(horizontal = 16.dp), .fillMaxHeight()
.padding(horizontal = 16.dp)
.verticalScroll(scrollState),
) { ) {
Image( Image(
painter = painterResource(id = R.drawable.logo_legacy), painter = painterResource(id = R.drawable.logo),
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.primary),
contentDescription = null, contentDescription = null,
modifier = Modifier modifier = Modifier
.padding(start = 48.dp, top = 48.dp, end = 48.dp) .padding(top = 40.dp, bottom = 8.dp)
.width(220.dp)
.height(74.dp)
.fillMaxWidth(), .fillMaxWidth(),
) )
Spacer(modifier = Modifier.weight(1f))
Text( Text(
text = stringResource(id = R.string.login_or_create_new_account), text = stringResource(id = R.string.login_or_create_new_account),
color = MaterialTheme.colorScheme.primary, textAlign = TextAlign.Center,
style = MaterialTheme.typography.headlineSmall, style = MaterialTheme.typography.headlineSmall,
color = MaterialTheme.colorScheme.onSurface,
modifier = Modifier modifier = Modifier
.align(alignment = Alignment.CenterHorizontally) .padding(8.dp)
.padding(horizontal = 24.dp), .wrapContentHeight(),
) )
Spacer(modifier = Modifier.weight(1f))
BitwardenTextField( BitwardenTextField(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .padding(
.testTag("Email address"), top = 32.dp,
bottom = 10.dp,
)
.fillMaxWidth(),
value = state.emailInput, value = state.emailInput,
onValueChange = { viewModel.trySendAction(LandingAction.EmailInputChanged(it)) }, onValueChange = remember(viewModel) {
{ viewModel.trySendAction(LandingAction.EmailInputChanged(it)) }
},
label = stringResource(id = R.string.email_address), label = stringResource(id = R.string.email_address),
) )
Row( BitwardenSwitch(
horizontalArrangement = Arrangement.SpaceBetween, label = stringResource(id = R.string.remember_me),
verticalAlignment = Alignment.CenterVertically, isChecked = state.isRememberMeEnabled,
modifier = Modifier onCheckedChange = remember(viewModel) {
.fillMaxWidth() { viewModel.trySendAction(LandingAction.RememberMeToggle(it)) }
.wrapContentHeight()
.padding(horizontal = 16.dp),
) {
Text(
text = stringResource(id = R.string.remember_me),
color = MaterialTheme.colorScheme.primary,
style = MaterialTheme.typography.bodySmall,
)
Switch(
modifier = Modifier.testTag("Remember me"),
checked = state.isRememberMeEnabled,
onCheckedChange = {
viewModel.trySendAction(LandingAction.RememberMeToggle(it))
},
)
}
Button(
onClick = {
viewModel.trySendAction(LandingAction.ContinueButtonClick)
}, },
modifier = Modifier modifier = Modifier
.fillMaxWidth() .padding(top = 8.dp)
.padding(horizontal = 16.dp) .fillMaxWidth(),
.testTag("Continue button"), )
enabled = state.isContinueButtonEnabled,
) { BitwardenFilledButton(
Text( label = stringResource(id = R.string.continue_text),
text = stringResource(id = R.string.continue_text), onClick = remember(viewModel) {
color = MaterialTheme.colorScheme.onPrimary, { viewModel.trySendAction(LandingAction.ContinueButtonClick) }
style = MaterialTheme.typography.bodyMedium, },
) isEnabled = state.isContinueButtonEnabled,
} modifier = Modifier
.padding(top = 32.dp)
.fillMaxWidth(),
)
Row( Row(
horizontalArrangement = Arrangement.Start, horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
modifier = Modifier modifier = Modifier
.padding(
top = 8.dp,
bottom = 58.dp,
)
.fillMaxWidth() .fillMaxWidth()
.wrapContentHeight() .wrapContentHeight(),
.padding(horizontal = 16.dp),
) { ) {
Text( Text(
text = stringResource(id = R.string.new_around_here), text = stringResource(id = R.string.new_around_here),
color = MaterialTheme.colorScheme.primary, style = MaterialTheme.typography.bodyMedium,
style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurface,
) )
Text( BitwardenTextButton(
modifier = Modifier label = stringResource(id = R.string.create_account),
.clickable { onClick = remember(viewModel) {
viewModel.trySendAction(LandingAction.CreateAccountClick) { viewModel.trySendAction(LandingAction.CreateAccountClick) }
} },
.padding(start = 2.dp),
text = stringResource(id = R.string.create_account),
color = MaterialTheme.colorScheme.primary,
style = MaterialTheme.typography.bodySmall,
) )
} }
} }
} }
@Preview
@Composable
private fun LandingScreen_preview() {
LandingScreen(
onNavigateToCreateAccount = {},
onNavigateToLogin = {},
viewModel = LandingViewModel(SavedStateHandle()),
)
}

View file

@ -0,0 +1,62 @@
package com.x8bit.bitwarden.ui.platform.components
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
/**
* Represents a Bitwarden-styled filled [Button].
*
* @param label The label for the button.
* @param onClick The callback when the button is clicked.
* @param modifier The [Modifier] to be applied to the button.
* @param isEnabled Whether or not the button is enabled.
*/
@Composable
fun BitwardenFilledButton(
label: String,
onClick: () -> Unit,
modifier: Modifier = Modifier,
isEnabled: Boolean = true,
) {
Button(
onClick = onClick,
modifier = modifier,
enabled = isEnabled,
) {
Text(
text = label,
color = MaterialTheme.colorScheme.onPrimary,
style = MaterialTheme.typography.bodyMedium,
modifier = Modifier.padding(
vertical = 10.dp,
horizontal = 24.dp,
),
)
}
}
@Preview
@Composable
private fun BitwardenFilledButton_preview_isEnabled() {
BitwardenFilledButton(
label = "Label",
onClick = {},
isEnabled = true,
)
}
@Preview
@Composable
private fun BitwardenFilledButton_preview_isNotEnabled() {
BitwardenFilledButton(
label = "Label",
onClick = {},
isEnabled = false,
)
}

View file

@ -0,0 +1,76 @@
package com.x8bit.bitwarden.ui.platform.components
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
/**
* Represents a Bitwarden-styled [Switch].
*
* @param label The label for the switch.
* @param isChecked Whether or not the switch is currently checked.
* @param onCheckedChange A callback for when the checked state changes.
* @param modifier The [Modifier] to be applied to the button.
*/
@Composable
fun BitwardenSwitch(
label: String,
isChecked: Boolean,
onCheckedChange: ((Boolean) -> Unit)?,
modifier: Modifier = Modifier,
) {
Row(
horizontalArrangement = Arrangement.Start,
verticalAlignment = Alignment.CenterVertically,
modifier = modifier
.semantics(mergeDescendants = true) { }
.wrapContentHeight(),
) {
Switch(
modifier = Modifier
.height(32.dp)
.width(52.dp),
checked = isChecked,
onCheckedChange = onCheckedChange,
)
Text(
text = label,
style = MaterialTheme.typography.bodyLarge,
color = MaterialTheme.colorScheme.onSurface,
modifier = Modifier.padding(start = 16.dp),
)
}
}
@Preview
@Composable
private fun BitwardenSwitch_preview_isChecked() {
BitwardenSwitch(
label = "Label",
isChecked = true,
onCheckedChange = {},
)
}
@Preview
@Composable
private fun BitwardenSwitch_preview_isNotChecked() {
BitwardenSwitch(
label = "Label",
isChecked = false,
onCheckedChange = {},
)
}

View file

@ -0,0 +1,49 @@
package com.x8bit.bitwarden.ui.platform.components
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
/**
* Represents a Bitwarden-styled [TextButton].
*
* @param label The label for the button.
* @param onClick The callback when the button is clicked.
* @param modifier The [Modifier] to be applied to the button.
*/
@Composable
fun BitwardenTextButton(
label: String,
onClick: () -> Unit,
modifier: Modifier = Modifier,
) {
TextButton(
onClick = onClick,
modifier = modifier,
) {
Text(
text = label,
color = MaterialTheme.colorScheme.primary,
style = MaterialTheme.typography.labelLarge,
modifier = Modifier
.padding(
vertical = 10.dp,
horizontal = 12.dp,
),
)
}
}
@Preview
@Composable
private fun BitwardenTextButton_preview() {
BitwardenTextButton(
label = "Label",
onClick = {},
)
}

View file

@ -46,8 +46,8 @@ fun BitwardenTheme(
if (!view.isInEditMode) { if (!view.isInEditMode) {
SideEffect { SideEffect {
val window = (view.context as Activity).window val window = (view.context as Activity).window
window.statusBarColor = colorScheme.primary.toArgb() window.statusBarColor = colorScheme.surface.toArgb()
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = !darkTheme
} }
} }

View file

@ -0,0 +1,44 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="220dp"
android:height="74dp"
android:viewportWidth="220"
android:viewportHeight="74">
<path
android:pathData="M69.38,31.56C68.23,29.97 66.68,29.21 64.68,29.21C62.58,29.21 60.96,30.07 59.91,31.72H59.72C59.85,30.2 59.91,29.09 59.91,28.39V23.5C59.91,23.19 59.66,22.93 59.34,22.93H55.91C55.59,22.93 55.34,23.19 55.34,23.5V45.8C55.34,46.12 55.59,46.37 55.91,46.37H58.45C58.67,46.37 58.9,46.24 58.99,46.02L59.6,44.53H59.91C61.06,45.99 62.58,46.69 64.58,46.69C66.58,46.69 68.17,45.96 69.35,44.41C70.52,42.88 71.09,40.73 71.09,37.94C71.09,35.24 70.52,33.11 69.38,31.56ZM60.71,33.97C61.25,33.27 62.1,32.92 63.22,32.92C64.17,32.92 64.96,33.34 65.53,34.16C66.07,34.99 66.36,36.22 66.36,37.87C66.36,39.49 66.07,40.79 65.53,41.65C64.99,42.53 64.2,42.98 63.28,42.98C62.1,42.98 61.25,42.57 60.71,41.8C60.17,41.04 59.91,39.74 59.91,37.94V37.43C59.91,35.84 60.2,34.67 60.71,33.97Z"
android:fillColor="#175DDC"
android:fillType="evenOdd"/>
<path
android:pathData="M75.22,46.4H78.65C78.97,46.4 79.25,46.09 79.22,45.8V30.13C79.22,29.82 78.97,29.56 78.65,29.56H75.22C74.9,29.56 74.65,29.82 74.65,30.13V45.83C74.65,46.15 74.9,46.4 75.22,46.4Z"
android:fillColor="#175DDC"/>
<path
android:pathData="M93.61,42.63C92.65,42.88 91.86,43.01 91.19,43.01C90.62,43.01 90.11,42.85 89.8,42.5C89.45,42.22 89.26,41.71 89.26,41.08V33.02H93.58C93.8,33.02 93.96,32.86 93.96,32.64V29.78C93.96,29.69 93.86,29.59 93.77,29.59H89.22V26.39C89.22,26.17 89.07,26.01 88.84,26.01H86.56C86.4,26.01 86.27,26.11 86.21,26.26L84.97,29.56L82.46,31.05C82.46,31.07 82.45,31.08 82.44,31.1C82.44,31.12 82.43,31.13 82.43,31.15V32.64C82.43,32.86 82.59,33.02 82.81,33.02H84.62V41.11C84.62,42.95 85.06,44.34 85.89,45.26C86.72,46.21 88.05,46.66 89.89,46.66C91.42,46.66 92.78,46.44 93.86,45.99C93.99,45.93 94.08,45.8 94.08,45.64V43.01C94.08,42.76 93.86,42.57 93.61,42.63Z"
android:fillColor="#175DDC"/>
<path
android:pathData="M111.58,45.71C111.77,46.12 112.12,46.4 112.57,46.4H112.69C113.17,46.4 113.55,46.12 113.68,45.67L117.68,30.93C117.81,30.45 117.46,30.01 116.98,30.01C116.66,30.01 116.38,30.23 116.28,30.55L113.9,39.39C113.17,42.25 112.79,44.02 112.69,44.66H112.6C112.44,43.87 112,42.34 111.26,39.97L108.28,30.64C108.15,30.26 107.8,30.01 107.39,30.01C106.94,30.01 106.6,30.26 106.47,30.64L103.26,40.03C102.98,40.82 102.53,42.38 101.96,44.72H101.86C101.67,43.58 101.26,41.87 100.66,39.52L98.18,30.55C98.09,30.23 97.8,30.01 97.48,30.01H97.39C96.88,30.01 96.53,30.48 96.66,30.93L100.88,45.67C101.01,46.12 101.39,46.4 101.83,46.4C102.28,46.4 102.66,46.15 102.79,45.74L106.25,35.49L106.91,33.34L107.23,32.19H107.33C107.41,32.52 107.5,32.83 107.57,33.13C107.83,34.11 108.04,34.9 108.22,35.46L111.58,45.71Z"
android:fillColor="#175DDC"/>
<path
android:pathData="M130.86,45.9C130.89,46.18 131.14,46.4 131.43,46.4C131.75,46.4 132.03,46.09 132.07,45.9V35.59C132.07,33.65 131.62,32.16 130.73,31.24C129.81,30.29 128.48,29.82 126.67,29.82C125.08,29.82 123.52,30.17 121.93,30.8C121.58,30.93 121.43,31.34 121.58,31.69C121.74,32.04 122.16,32.19 122.51,32.04C123.9,31.37 125.24,31.05 126.57,31.05C127.97,31.05 128.95,31.43 129.62,32.23C130.29,33.02 130.6,34.16 130.6,35.75V36.83L127.49,36.92C124.92,36.92 123.01,37.46 121.65,38.35C120.32,39.27 119.62,40.85 119.74,42.5C119.81,43.74 120.25,44.72 121.04,45.45C121.93,46.28 123.17,46.69 124.79,46.69C125.97,46.69 127.02,46.5 127.87,46.05C128.76,45.61 129.59,44.85 130.41,43.8H130.57L130.86,45.9ZM128.99,43.83C128,44.82 126.64,45.32 124.86,45.32C123.71,45.32 122.82,45.04 122.13,44.56C121.52,43.99 121.2,43.17 121.2,42.15C121.2,40.88 121.71,39.9 122.7,39.3C123.71,38.7 125.33,38.32 127.65,38.22L130.51,38.09V39.68C130.51,41.42 130,42.85 128.99,43.83Z"
android:fillColor="#175DDC"
android:fillType="evenOdd"/>
<path
android:pathData="M145.15,29.78C144.61,29.72 144.13,29.69 143.66,29.69C142.58,29.69 141.66,29.94 140.93,30.45C140.16,30.93 139.43,31.78 138.77,32.99H138.67L138.54,30.64C138.54,30.29 138.26,30.04 137.91,30.04C137.56,30.04 137.27,30.32 137.27,30.67V45.58C137.27,45.99 137.59,46.31 138,46.31C138.42,46.31 138.73,45.99 138.73,45.58V37.27C138.73,35.49 139.18,33.97 140.07,32.8C140.96,31.62 142.1,31.02 143.5,31.02C143.97,31.02 144.45,31.08 144.93,31.15C145.31,31.21 145.69,30.99 145.75,30.61C145.82,30.23 145.56,29.85 145.15,29.78Z"
android:fillColor="#175DDC"/>
<path
android:pathData="M157.91,30.32C157.06,29.91 156.01,29.69 154.84,29.69C152.55,29.69 150.83,30.45 149.63,31.81C148.42,33.34 147.85,35.49 147.85,38.32C147.85,41.01 148.48,43.04 149.66,44.47C150.9,45.9 152.58,46.59 154.87,46.59C157.18,46.59 158.99,45.67 160.23,43.8H160.36L160.68,45.86C160.71,46.15 160.93,46.34 161.19,46.34C161.47,46.34 161.69,46.12 161.69,45.83V23.66C161.69,23.25 161.38,22.93 160.96,22.93C160.55,22.93 160.23,23.25 160.23,23.66V28.83C160.23,30.04 160.26,31.24 160.33,32.54H160.23C159.57,31.5 158.8,30.74 157.91,30.32ZM150.77,32.96C151.69,31.69 153.02,31.05 154.84,31.05C156.74,31.05 158.11,31.59 158.93,32.73C159.82,33.81 160.23,35.62 160.23,38.16V38.41C160.23,40.88 159.82,42.66 158.93,43.74C158.07,44.82 156.74,45.36 154.87,45.36C151.25,45.36 149.44,43.04 149.44,38.41C149.44,36 149.88,34.19 150.77,32.96Z"
android:fillColor="#175DDC"
android:fillType="evenOdd"/>
<path
android:pathData="M168.27,44.47C169.63,45.96 171.48,46.69 173.86,46.69C174.81,46.69 175.67,46.63 176.46,46.4C177.13,46.28 177.86,46.09 178.62,45.77C178.88,45.67 179.03,45.42 179.03,45.17C179.03,44.72 178.59,44.41 178.18,44.56C177.45,44.82 176.84,44.98 176.33,45.07C175.64,45.2 174.78,45.26 173.86,45.26C171.92,45.26 170.46,44.72 169.41,43.52C168.36,42.31 167.85,40.6 167.82,38.35H179.64V37.14C179.64,34.83 179.1,32.99 177.95,31.66C176.87,30.32 175.32,29.66 173.41,29.66C171.22,29.66 169.51,30.45 168.21,32.04C166.9,33.59 166.27,35.68 166.27,38.32C166.27,40.95 166.93,43.01 168.27,44.47ZM169.6,32.58C170.55,31.53 171.82,31.02 173.41,31.02C174.87,31.02 176.02,31.56 176.84,32.61C177.67,33.65 178.08,35.18 178.08,37.05H167.92C168.11,35.11 168.65,33.59 169.6,32.58Z"
android:fillColor="#175DDC"
android:fillType="evenOdd"/>
<path
android:pathData="M195.67,45.67C195.67,46.09 195.99,46.4 196.4,46.4C196.79,46.4 197.13,46.05 197.17,45.61V35.65C197.17,31.66 195.29,29.66 191.58,29.66C188.85,29.66 186.97,30.51 185.89,32.23H185.8L185.61,30.58C185.54,30.26 185.29,30.01 184.94,30.01C184.56,30.01 184.27,30.29 184.27,30.67V45.61C184.27,46.02 184.59,46.34 185,46.34C185.42,46.34 185.73,46.02 185.73,45.61V37.3C185.73,35.11 186.24,33.5 187.13,32.51C188.02,31.5 189.45,31.02 191.42,31.02C192.88,31.02 193.93,31.43 194.66,32.16C195.32,32.89 195.67,34.1 195.67,35.75V45.67Z"
android:fillColor="#175DDC"/>
<path
android:pathData="M74.27,25.25C74.27,23.82 75.47,22.68 76.97,22.68C78.43,22.68 79.67,23.82 79.67,25.28V25.5C79.67,26.9 78.43,28.07 76.97,28.07C75.51,28.07 74.27,26.9 74.27,25.5V25.25Z"
android:fillColor="#175DDC"/>
<path
android:pathData="M45.36,37.65V24.04C45.36,23.73 45.25,23.47 45.02,23.24C44.8,23.02 44.53,22.91 44.23,22.91H23.81C23.51,22.91 23.24,23.02 23.02,23.24C22.79,23.47 22.68,23.73 22.68,24.04V37.65C22.68,38.67 22.88,39.67 23.27,40.67C23.67,41.67 24.16,42.55 24.74,43.33C25.33,44.1 26.03,44.86 26.84,45.59C27.64,46.32 28.39,46.93 29.08,47.41C29.76,47.9 30.48,48.35 31.22,48.79C31.97,49.22 32.49,49.51 32.81,49.66C33.12,49.82 33.37,49.93 33.56,50.02C33.7,50.09 33.86,50.12 34.02,50.12C34.19,50.12 34.34,50.09 34.48,50.02C34.67,49.93 34.92,49.82 35.23,49.66C35.55,49.51 36.08,49.22 36.82,48.79C37.56,48.35 38.28,47.9 38.96,47.41C39.65,46.93 40.4,46.32 41.21,45.59C42.01,44.86 42.71,44.1 43.3,43.33C43.88,42.55 44.37,41.67 44.77,40.67C45.16,39.67 45.36,38.67 45.36,37.65ZM41.96,26.31V37.65C41.96,39.73 40.57,41.85 37.79,44.03C36.68,44.9 35.43,45.71 34.02,46.46V26.31H41.96Z"
android:fillColor="#175DDC"
android:fillType="evenOdd"/>
</vector>

View file

@ -1,8 +1,11 @@
package com.x8bit.bitwarden.ui.auth.feature.landing package com.x8bit.bitwarden.ui.auth.feature.landing
import androidx.compose.ui.test.onNodeWithTag import androidx.compose.ui.test.filterToOne
import androidx.compose.ui.test.hasClickAction
import androidx.compose.ui.test.onChildren
import androidx.compose.ui.test.onNodeWithText import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.performScrollTo
import androidx.compose.ui.test.performTextInput import androidx.compose.ui.test.performTextInput
import com.x8bit.bitwarden.ui.platform.base.BaseComposeTest import com.x8bit.bitwarden.ui.platform.base.BaseComposeTest
import io.mockk.every import io.mockk.every
@ -35,7 +38,7 @@ class LandingScreenTest : BaseComposeTest() {
viewModel = viewModel, viewModel = viewModel,
) )
} }
composeTestRule.onNodeWithTag("Continue button").performClick() composeTestRule.onNodeWithText("Continue").performClick()
verify { verify {
viewModel.trySendAction(LandingAction.ContinueButtonClick) viewModel.trySendAction(LandingAction.ContinueButtonClick)
} }
@ -60,7 +63,11 @@ class LandingScreenTest : BaseComposeTest() {
viewModel = viewModel, viewModel = viewModel,
) )
} }
composeTestRule.onNodeWithTag("Remember me").performClick() composeTestRule
.onNodeWithText("Remember me")
.onChildren()
.filterToOne(hasClickAction())
.performClick()
verify { verify {
viewModel.trySendAction(LandingAction.RememberMeToggle(true)) viewModel.trySendAction(LandingAction.RememberMeToggle(true))
} }
@ -85,7 +92,7 @@ class LandingScreenTest : BaseComposeTest() {
viewModel = viewModel, viewModel = viewModel,
) )
} }
composeTestRule.onNodeWithText("Create account").performClick() composeTestRule.onNodeWithText("Create account").performScrollTo().performClick()
verify { verify {
viewModel.trySendAction(LandingAction.CreateAccountClick) viewModel.trySendAction(LandingAction.CreateAccountClick)
} }
@ -111,7 +118,7 @@ class LandingScreenTest : BaseComposeTest() {
viewModel = viewModel, viewModel = viewModel,
) )
} }
composeTestRule.onNodeWithTag("Email address").performTextInput(input) composeTestRule.onNodeWithText("Email address").performTextInput(input)
verify { verify {
viewModel.trySendAction(LandingAction.EmailInputChanged(input)) viewModel.trySendAction(LandingAction.EmailInputChanged(input))
} }