|
13 | 13 | // limitations under the License.
|
14 | 14 |
|
15 | 15 | import FirebaseAuth
|
| 16 | +import FirebaseCore |
16 | 17 | import SwiftUI
|
17 | 18 |
|
18 | 19 | private enum FocusableField: Hashable {
|
@@ -583,7 +584,57 @@ extension MFAEnrolmentView: View {
|
583 | 584 | }
|
584 | 585 | }
|
585 | 586 |
|
586 |
| -#Preview { |
587 |
| - MFAEnrolmentView() |
588 |
| - .environment(AuthService()) |
| 587 | +#Preview("MFA Enabled - Both Methods") { |
| 588 | + FirebaseOptions.dummyConfigurationForPreview() |
| 589 | + let config = AuthConfiguration( |
| 590 | + mfaEnabled: true, |
| 591 | + allowedSecondFactors: [.sms, .totp] |
| 592 | + ) |
| 593 | + let authService = AuthService(configuration: config) |
| 594 | + return MFAEnrolmentView() |
| 595 | + .environment(authService) |
| 596 | +} |
| 597 | + |
| 598 | +#Preview("MFA Disabled") { |
| 599 | + FirebaseOptions.dummyConfigurationForPreview() |
| 600 | + let config = AuthConfiguration( |
| 601 | + mfaEnabled: false, |
| 602 | + allowedSecondFactors: [] |
| 603 | + ) |
| 604 | + let authService = AuthService(configuration: config) |
| 605 | + return MFAEnrolmentView() |
| 606 | + .environment(authService) |
| 607 | +} |
| 608 | + |
| 609 | +#Preview("No Allowed Factors") { |
| 610 | + FirebaseOptions.dummyConfigurationForPreview() |
| 611 | + let config = AuthConfiguration( |
| 612 | + mfaEnabled: true, |
| 613 | + allowedSecondFactors: [] |
| 614 | + ) |
| 615 | + let authService = AuthService(configuration: config) |
| 616 | + return MFAEnrolmentView() |
| 617 | + .environment(authService) |
| 618 | +} |
| 619 | + |
| 620 | +#Preview("SMS Only") { |
| 621 | + FirebaseOptions.dummyConfigurationForPreview() |
| 622 | + let config = AuthConfiguration( |
| 623 | + mfaEnabled: true, |
| 624 | + allowedSecondFactors: [.sms] |
| 625 | + ) |
| 626 | + let authService = AuthService(configuration: config) |
| 627 | + return MFAEnrolmentView() |
| 628 | + .environment(authService) |
| 629 | +} |
| 630 | + |
| 631 | +#Preview("TOTP Only") { |
| 632 | + FirebaseOptions.dummyConfigurationForPreview() |
| 633 | + let config = AuthConfiguration( |
| 634 | + mfaEnabled: true, |
| 635 | + allowedSecondFactors: [.totp] |
| 636 | + ) |
| 637 | + let authService = AuthService(configuration: config) |
| 638 | + return MFAEnrolmentView() |
| 639 | + .environment(authService) |
589 | 640 | }
|
0 commit comments