Skip to content

Commit cf5a6cc

Browse files
fix: ensure everything can fit on the page
1 parent ad4a0f6 commit cf5a6cc

1 file changed

Lines changed: 22 additions & 18 deletions

File tree

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/MFAEnrolmentView.swift

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -187,17 +187,19 @@ public struct MFAEnrolmentView {
187187
extension MFAEnrolmentView: View {
188188
public var body: some View {
189189
VStack(spacing: 24) {
190-
// Header
191-
VStack(spacing: 8) {
192-
Text("Set Up Two-Factor Authentication")
193-
.font(.largeTitle)
194-
.fontWeight(.bold)
195-
.multilineTextAlignment(.center)
190+
// Header (only shown when no session is active)
191+
if currentSession == nil {
192+
VStack(spacing: 8) {
193+
Text("Set Up Two-Factor Authentication")
194+
.font(.largeTitle)
195+
.fontWeight(.bold)
196+
.multilineTextAlignment(.center)
196197

197-
Text("Add an extra layer of security to your account")
198-
.font(.subheadline)
199-
.foregroundColor(.secondary)
200-
.multilineTextAlignment(.center)
198+
Text("Add an extra layer of security to your account")
199+
.font(.subheadline)
200+
.foregroundColor(.secondary)
201+
.multilineTextAlignment(.center)
202+
}
201203
}
202204

203205
// Factor Type Selection (only if no session started)
@@ -478,12 +480,12 @@ extension MFAEnrolmentView: View {
478480

479481
@ViewBuilder
480482
private func totpEnrollmentContent(session: EnrollmentSession) -> some View {
481-
VStack(spacing: 24) {
483+
VStack(spacing: 16) {
482484
if let totpInfo = session.totpInfo {
483-
VStack(spacing: 24) {
484-
VStack(spacing: 8) {
485+
VStack(spacing: 16) {
486+
VStack(spacing: 6) {
485487
Image(systemName: "qrcode")
486-
.font(.system(size: 48))
488+
.font(.system(size: 40))
487489
.foregroundColor(.green)
488490

489491
Text("Scan QR Code")
@@ -494,6 +496,8 @@ extension MFAEnrolmentView: View {
494496
.font(.body)
495497
.foregroundColor(.secondary)
496498
.multilineTextAlignment(.center)
499+
.lineLimit(nil)
500+
.padding(.horizontal)
497501
}
498502

499503
// QR Code generated from the otpauth:// URI
@@ -502,12 +506,12 @@ extension MFAEnrolmentView: View {
502506
Button(action: {
503507
UIApplication.shared.open(qrURL)
504508
}) {
505-
VStack(spacing: 12) {
509+
VStack(spacing: 8) {
506510
Image(uiImage: qrImage)
507511
.interpolation(.none)
508512
.resizable()
509513
.aspectRatio(contentMode: .fit)
510-
.frame(width: 200, height: 200)
514+
.frame(width: 180, height: 180)
511515
.accessibilityIdentifier("qr-code-image")
512516

513517
HStack(spacing: 6) {
@@ -525,7 +529,7 @@ extension MFAEnrolmentView: View {
525529
} else {
526530
RoundedRectangle(cornerRadius: 8)
527531
.fill(Color.gray.opacity(0.3))
528-
.frame(width: 200, height: 200)
532+
.frame(width: 180, height: 180)
529533
.overlay(
530534
VStack {
531535
Image(systemName: "exclamationmark.triangle")
@@ -537,7 +541,7 @@ extension MFAEnrolmentView: View {
537541
)
538542
}
539543

540-
VStack(spacing: 8) {
544+
VStack(spacing: 6) {
541545
Text("Manual Entry Key:")
542546
.font(.headline)
543547

0 commit comments

Comments
 (0)