11package com.x8bit.bitwarden.ui.auth.feature.loginwithdevice
22
3- import androidx.compose.foundation.layout.Arrangement
43import androidx.compose.foundation.layout.Column
5- import androidx.compose.foundation.layout.PaddingValues
64import androidx.compose.foundation.layout.Spacer
7- import androidx.compose.foundation.layout.defaultMinSize
85import androidx.compose.foundation.layout.fillMaxSize
96import androidx.compose.foundation.layout.fillMaxWidth
107import androidx.compose.foundation.layout.height
118import androidx.compose.foundation.layout.navigationBarsPadding
12- import androidx.compose.foundation.layout.padding
13- import androidx.compose.foundation.layout.size
149import androidx.compose.foundation.rememberScrollState
1510import androidx.compose.foundation.verticalScroll
1611import androidx.compose.material3.ExperimentalMaterial3Api
@@ -20,7 +15,6 @@ import androidx.compose.material3.rememberTopAppBarState
2015import androidx.compose.runtime.Composable
2116import androidx.compose.runtime.getValue
2217import androidx.compose.runtime.remember
23- import androidx.compose.ui.Alignment
2418import androidx.compose.ui.Modifier
2519import androidx.compose.ui.input.nestedscroll.nestedScroll
2620import androidx.compose.ui.platform.testTag
@@ -30,13 +24,17 @@ import androidx.compose.ui.unit.dp
3024import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
3125import androidx.lifecycle.compose.collectAsStateWithLifecycle
3226import com.bitwarden.ui.platform.base.util.EventsEffect
27+ import com.bitwarden.ui.platform.base.util.standardHorizontalMargin
3328import com.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar
29+ import com.bitwarden.ui.platform.components.button.BitwardenOutlinedButton
3430import com.bitwarden.ui.platform.components.content.BitwardenLoadingContent
3531import com.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog
3632import com.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog
37- import com.bitwarden.ui.platform.components.indicator.BitwardenCircularProgressIndicator
33+ import com.bitwarden.ui.platform.components.field.BitwardenTextField
34+ import com.bitwarden.ui.platform.components.field.model.TextToolbarType
35+ import com.bitwarden.ui.platform.components.model.CardStyle
3836import com.bitwarden.ui.platform.components.scaffold.BitwardenScaffold
39- import com.bitwarden.ui.platform.components.text.BitwardenClickableText
37+ import com.bitwarden.ui.platform.components.text.BitwardenHyperTextLink
4038import com.bitwarden.ui.platform.components.util.rememberVectorPainter
4139import com.bitwarden.ui.platform.resource.BitwardenDrawable
4240import com.bitwarden.ui.platform.resource.BitwardenString
@@ -120,111 +118,99 @@ private fun LoginWithDeviceScreenContent(
120118 modifier = modifier
121119 .verticalScroll(rememberScrollState()),
122120 ) {
121+ Spacer (modifier = Modifier .height(height = 24 .dp))
122+
123123 Text (
124124 text = state.title(),
125- textAlign = TextAlign .Start ,
126- style = BitwardenTheme .typography.headlineMedium ,
125+ textAlign = TextAlign .Center ,
126+ style = BitwardenTheme .typography.titleMedium ,
127127 color = BitwardenTheme .colorScheme.text.primary,
128128 modifier = Modifier
129- .padding(horizontal = 16 .dp )
129+ .standardHorizontalMargin( )
130130 .fillMaxWidth(),
131131 )
132132
133- Spacer (modifier = Modifier .height(24 .dp))
133+ Spacer (modifier = Modifier .height(height = 12 .dp))
134134
135135 Text (
136136 text = state.subtitle(),
137- textAlign = TextAlign .Start ,
137+ textAlign = TextAlign .Center ,
138138 style = BitwardenTheme .typography.bodyMedium,
139139 color = BitwardenTheme .colorScheme.text.primary,
140140 modifier = Modifier
141- .padding(horizontal = 16 .dp )
141+ .standardHorizontalMargin( )
142142 .fillMaxWidth(),
143143 )
144144
145- Spacer (modifier = Modifier .height(16 .dp))
145+ Spacer (modifier = Modifier .height(height = 12 .dp))
146146
147147 Text (
148148 text = state.description(),
149- textAlign = TextAlign .Start ,
149+ textAlign = TextAlign .Center ,
150150 style = BitwardenTheme .typography.bodyMedium,
151151 color = BitwardenTheme .colorScheme.text.primary,
152152 modifier = Modifier
153- .padding(horizontal = 16 .dp )
153+ .standardHorizontalMargin( )
154154 .fillMaxWidth(),
155155 )
156156
157157 Spacer (modifier = Modifier .height(24 .dp))
158158
159- Text (
160- text = stringResource(id = BitwardenString .fingerprint_phrase),
161- textAlign = TextAlign .Start ,
162- style = BitwardenTheme .typography.titleLarge,
163- color = BitwardenTheme .colorScheme.text.primary,
159+ BitwardenTextField (
160+ label = stringResource(id = BitwardenString .fingerprint_phrase),
161+ value = state.fingerprintPhrase,
162+ textFieldTestTag = " FingerprintPhraseValue" ,
163+ onValueChange = { },
164+ readOnly = true ,
165+ singleLine = false ,
166+ textToolbarType = TextToolbarType .NONE ,
167+ textStyle = BitwardenTheme .typography.sensitiveInfoSmall,
168+ textColor = BitwardenTheme .colorScheme.text.codePink,
169+ cardStyle = CardStyle .Full ,
164170 modifier = Modifier
165- .padding(horizontal = 16 .dp)
166- .fillMaxWidth(),
167- )
168-
169- Spacer (modifier = Modifier .height(12 .dp))
170-
171- Text (
172- text = state.fingerprintPhrase,
173- textAlign = TextAlign .Start ,
174- color = BitwardenTheme .colorScheme.text.codePink,
175- style = BitwardenTheme .typography.sensitiveInfoSmall,
176- minLines = 2 ,
177- modifier = Modifier
178- .testTag(" FingerprintPhraseValue" )
179- .padding(horizontal = 16 .dp)
171+ .standardHorizontalMargin()
180172 .fillMaxWidth(),
181173 )
182174
183175 if (state.allowsResend) {
184- Column (
185- verticalArrangement = Arrangement .Center ,
176+ Spacer (modifier = Modifier .height(height = 24 .dp))
177+ BitwardenOutlinedButton (
178+ label = stringResource(id = BitwardenString .resend_notification),
179+ onClick = onResendNotificationClick,
186180 modifier = Modifier
187- .defaultMinSize(minHeight = 40 .dp)
188- .align(Alignment .Start ),
189- ) {
190- if (state.isResendNotificationLoading) {
191- BitwardenCircularProgressIndicator (
192- modifier = Modifier
193- .padding(horizontal = 64 .dp)
194- .size(size = 16 .dp),
195- )
196- } else {
197- BitwardenClickableText (
198- modifier = Modifier .testTag(" ResendNotificationButton" ),
199- label = stringResource(id = BitwardenString .resend_notification),
200- style = BitwardenTheme .typography.labelLarge,
201- innerPadding = PaddingValues (vertical = 8 .dp, horizontal = 16 .dp),
202- onClick = onResendNotificationClick,
203- )
204- }
205- }
181+ .testTag(tag = " ResendNotificationButton" )
182+ .standardHorizontalMargin()
183+ .fillMaxWidth(),
184+ )
206185 }
207186
208- Spacer (modifier = Modifier .height(28 .dp))
187+ Spacer (modifier = Modifier .height(height = 24 .dp))
209188
210189 Text (
211190 text = state.otherOptions(),
212- textAlign = TextAlign .Start ,
213- style = BitwardenTheme .typography.bodyMedium ,
214- color = BitwardenTheme .colorScheme.text.primary ,
191+ textAlign = TextAlign .Center ,
192+ style = BitwardenTheme .typography.bodySmall ,
193+ color = BitwardenTheme .colorScheme.text.secondary ,
215194 modifier = Modifier
216- .padding(horizontal = 16 .dp )
195+ .standardHorizontalMargin( )
217196 .fillMaxWidth(),
218197 )
219198
220- BitwardenClickableText (
221- modifier = Modifier .testTag(" ViewAllLoginOptionsButton" ),
222- label = stringResource(id = BitwardenString .view_all_login_options),
223- innerPadding = PaddingValues (vertical = 8 .dp, horizontal = 16 .dp),
224- style = BitwardenTheme .typography.labelLarge,
199+ Spacer (modifier = Modifier .height(height = 12 .dp))
200+
201+ BitwardenHyperTextLink (
202+ annotatedResId = BitwardenString .need_another_option_view_all_login_options,
203+ annotationKey = " viewAll" ,
204+ accessibilityString = stringResource(id = BitwardenString .view_all_login_options),
225205 onClick = onViewAllLogInOptionsClick,
206+ style = BitwardenTheme .typography.bodySmall,
207+ modifier = Modifier
208+ .testTag(tag = " ViewAllLoginOptionsButton" )
209+ .standardHorizontalMargin()
210+ .fillMaxWidth(),
226211 )
227212
213+ Spacer (modifier = Modifier .height(height = 12 .dp))
228214 Spacer (modifier = Modifier .navigationBarsPadding())
229215 }
230216}
0 commit comments