|
12 | 12 | // See the License for the specific language governing permissions and
|
13 | 13 | // limitations under the License.
|
14 | 14 |
|
| 15 | +import FirebaseCore |
15 | 16 | import FirebaseAuth
|
16 | 17 | import SwiftUI
|
17 | 18 |
|
@@ -109,8 +110,7 @@ public struct MFAResolutionView {
|
109 | 110 |
|
110 | 111 | extension MFAResolutionView: View {
|
111 | 112 | public var body: some View {
|
112 |
| - ScrollView { |
113 |
| - VStack(spacing: 24) { |
| 113 | + VStack(spacing: 24) { |
114 | 114 | // Header
|
115 | 115 | VStack(spacing: 12) {
|
116 | 116 | Image(systemName: "lock.shield")
|
@@ -180,9 +180,8 @@ extension MFAResolutionView: View {
|
180 | 180 | .accessibilityIdentifier("cancel-button")
|
181 | 181 | }
|
182 | 182 | .padding(.horizontal)
|
183 |
| - } |
184 |
| - .padding(.vertical, 20) |
185 | 183 | }
|
| 184 | + .padding(.vertical, 20) |
186 | 185 | }
|
187 | 186 |
|
188 | 187 | @ViewBuilder
|
@@ -377,7 +376,37 @@ private extension MFAHint {
|
377 | 376 | }
|
378 | 377 | }
|
379 | 378 |
|
380 |
| -#Preview { |
| 379 | +#Preview("Phone SMS Only") { |
| 380 | + FirebaseOptions.dummyConfigurationForPreview() |
| 381 | + let authService = AuthService() |
| 382 | + authService.currentMFARequired = MFARequired(hints: [ |
| 383 | + .phone(displayName: "Work Phone", uid: "phone-uid-1", phoneNumber: "+15551234567") |
| 384 | + ]) |
| 385 | + return MFAResolutionView().environment(authService) |
| 386 | +} |
| 387 | + |
| 388 | +#Preview("TOTP Only") { |
| 389 | + FirebaseOptions.dummyConfigurationForPreview() |
| 390 | + let authService = AuthService() |
| 391 | + authService.currentMFARequired = MFARequired(hints: [ |
| 392 | + .totp(displayName: "Authenticator App", uid: "totp-uid-1") |
| 393 | + ]) |
| 394 | + return MFAResolutionView().environment(authService) |
| 395 | +} |
| 396 | + |
| 397 | +#Preview("Multiple Methods") { |
| 398 | + FirebaseOptions.dummyConfigurationForPreview() |
| 399 | + let authService = AuthService() |
| 400 | + authService.currentMFARequired = MFARequired(hints: [ |
| 401 | + .phone(displayName: "Mobile", uid: "phone-uid-1", phoneNumber: "+15551234567"), |
| 402 | + .totp(displayName: "Google Authenticator", uid: "totp-uid-1") |
| 403 | + ]) |
| 404 | + return MFAResolutionView().environment(authService) |
| 405 | +} |
| 406 | + |
| 407 | +#Preview("No MFA Required") { |
| 408 | + FirebaseOptions.dummyConfigurationForPreview() |
381 | 409 | let authService = AuthService()
|
| 410 | + // currentMFARequired is nil by default |
382 | 411 | return MFAResolutionView().environment(authService)
|
383 | 412 | }
|
0 commit comments