@@ -108,76 +108,96 @@ extension PhoneReauthView: View {
108108 if verificationID == nil {
109109 // Initial state - sending SMS
110110 VStack ( spacing: 16 ) {
111- if isLoading {
112- ProgressView ( )
113- . scaleEffect ( 1.5 )
114- . padding ( )
115-
116- Text ( " Sending verification code... " )
117- . font ( . body)
118- . foregroundColor ( . secondary)
119-
120- Text ( phoneNumber)
121- . font ( . headline)
122- } else {
123- Text ( " We'll send a verification code to: " )
124- . font ( . body)
125- . foregroundColor ( . secondary)
126-
127- Text ( phoneNumber)
128- . font ( . headline)
129- . padding ( . bottom, 8 )
130-
131- Button ( " Send Verification Code " ) {
132- sendSMS ( )
111+ Text ( " We'll send a verification code to: " )
112+ . font ( . subheadline)
113+ . foregroundStyle ( . secondary)
114+ . frame ( maxWidth: . infinity, alignment: . leading)
115+
116+ Text ( phoneNumber)
117+ . font ( . headline)
118+ . frame ( maxWidth: . infinity, alignment: . leading)
119+ . padding ( . bottom, 8 )
120+
121+ Button ( action: {
122+ sendSMS ( )
123+ } ) {
124+ if isLoading {
125+ ProgressView ( )
126+ . frame ( height: 32 )
127+ . frame ( maxWidth: . infinity)
128+ } else {
129+ Text ( " Send Verification Code " )
130+ . frame ( height: 32 )
131+ . frame ( maxWidth: . infinity)
133132 }
134- . buttonStyle ( . borderedProminent)
135- . accessibilityIdentifier ( " send-verification-code-button " )
136133 }
134+ . buttonStyle ( . borderedProminent)
135+ . disabled ( isLoading)
136+ . accessibilityIdentifier ( " send-verification-code-button " )
137137 }
138- . padding ( )
138+ . padding ( . horizontal )
139139 } else {
140140 // Enter verification code
141- AuthTextField (
142- text: $verificationCode,
143- label: " Verification Code " ,
144- prompt: " Enter 6-digit code " ,
145- keyboardType: . numberPad,
146- contentType: . oneTimeCode,
147- leading: {
148- Image ( systemName: " number " )
141+ VStack ( spacing: 16 ) {
142+ Text ( " Enter the 6-digit code sent to: " )
143+ . font ( . subheadline)
144+ . foregroundStyle ( . secondary)
145+ . frame ( maxWidth: . infinity, alignment: . leading)
146+
147+ Text ( phoneNumber)
148+ . font ( . caption)
149+ . frame ( maxWidth: . infinity, alignment: . leading)
150+ . padding ( . bottom, 8 )
151+
152+ VerificationCodeInputField (
153+ code: $verificationCode,
154+ validations: [
155+ FormValidators . verificationCode,
156+ ] ,
157+ maintainsValidationMessage: true
158+ )
159+ . accessibilityIdentifier ( " verification-code-field " )
160+
161+ Button ( action: {
162+ verifyCode ( )
163+ } ) {
164+ if isLoading {
165+ ProgressView ( )
166+ . frame ( height: 32 )
167+ . frame ( maxWidth: . infinity)
168+ } else {
169+ Text ( " Verify " )
170+ . frame ( height: 32 )
171+ . frame ( maxWidth: . infinity)
172+ }
149173 }
150- )
151- . padding ( . horizontal )
152- . accessibilityIdentifier ( " verification-code-field " )
153-
154- Button ( " Verify " ) {
155- verifyCode ( )
156- }
157- . buttonStyle ( . borderedProminent )
158- . disabled ( verificationCode . isEmpty || isLoading )
159- . padding ( )
160- . accessibilityIdentifier ( " verify-button " )
161-
162- Button ( " Resend Code " ) {
163- sendSMS ( )
174+ . buttonStyle ( . borderedProminent )
175+ . disabled ( verificationCode . count != 6 || isLoading )
176+ . accessibilityIdentifier ( " verify-button " )
177+
178+ Button ( action : {
179+ sendSMS ( )
180+ } ) {
181+ Text ( " Resend Code " )
182+ . frame ( height : 32 )
183+ . frame ( maxWidth : . infinity )
184+ }
185+ . buttonStyle ( . bordered )
186+ . disabled ( isLoading )
187+ . accessibilityIdentifier ( " resend-code-button " )
164188 }
165- . buttonStyle ( . bordered)
166- . disabled ( isLoading)
167- . accessibilityIdentifier ( " resend-code-button " )
189+ . padding ( . horizontal)
168190 }
169191
170192 Spacer ( )
193+
194+ Button ( authService. string. cancelButtonLabel) {
195+ coordinator. reauthCancelled ( )
196+ }
197+ . padding ( . horizontal)
171198 }
172199 . frame ( maxWidth: . infinity, maxHeight: . infinity, alignment: . top)
173200 . navigationBarTitleDisplayMode ( . inline)
174- . toolbar {
175- ToolbarItem ( placement: . cancellationAction) {
176- Button ( " Cancel " ) {
177- coordinator. reauthCancelled ( )
178- }
179- }
180- }
181201 }
182202 . errorAlert ( error: $error, okButtonLabel: authService. string. okButtonLabel)
183203 }
0 commit comments