Skip to content

Commit 6dc6574

Browse files
Merge pull request #1308 from firebase/small-tweaks
2 parents f51316b + c9a1f55 commit 6dc6574

File tree

7 files changed

+37
-34
lines changed

7 files changed

+37
-34
lines changed

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Strings/Localizable.xcstrings

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3053,6 +3053,10 @@
30533053
}
30543054
}
30553055
},
3056+
"Please tap on the link in your email to complete verification." : {
3057+
"comment" : "A message displayed in a sheet that appears after a user requests email verification. It instructs the user to tap on the link in their email to complete the verification process.",
3058+
"isCommentAutoGenerated" : true
3059+
},
30563060
"PrivacyPolicy" : {
30573061
"comment" : "Text linked to a web page with the Privacy Policy content.",
30583062
"extractionState" : "manual",
@@ -4963,5 +4967,5 @@
49634967

49644968
}
49654969
},
4966-
"version" : "1.0"
4970+
"version" : "1.1"
49674971
}

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Utils/StringUtils.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ public class StringUtils {
103103
return localizedString(for: "EnterYourPassword")
104104
}
105105

106+
/// Update password title
107+
/// found in:
108+
/// - UpdatePasswordView
109+
public var updatePasswordTitle: String {
110+
return localizedString(for: "UpdatePasswordTitle")
111+
}
112+
106113
/// Password recovery title
107114
/// found in:
108115
/// - PasswordRecoveryView

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/MFAManagementView.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ extension MFAManagementView: View {
134134
.onAppear {
135135
loadEnrolledFactors()
136136
}
137-
// Password prompt sheet now centralized in AuthPickerView
138137
}
139138

140139
@ViewBuilder

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/SignedInView.swift

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -143,25 +143,15 @@ extension SignedInView: View {
143143
)
144144
.presentationDetents([.medium])
145145
}
146-
// Password prompt sheet now centralized in AuthPickerView
147-
.sheet(isPresented: $showEmailVerificationSent) {
148-
VStack(spacing: 24) {
149-
Text(authService.string.verifyEmailSheetMessage)
150-
.font(.headline)
151-
Button {
152-
showEmailVerificationSent = false
153-
} label: {
154-
Text(authService.string.okButtonLabel)
155-
.padding(.vertical, 8)
156-
.frame(maxWidth: .infinity)
157-
}
158-
.buttonStyle(.borderedProminent)
159-
.padding([.top, .bottom], 8)
160-
.frame(maxWidth: .infinity)
146+
.alert(
147+
authService.string.verifyEmailSheetMessage,
148+
isPresented: $showEmailVerificationSent
149+
) {
150+
Button(authService.string.okButtonLabel) {
151+
showEmailVerificationSent = false
161152
}
162-
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
163-
.safeAreaPadding()
164-
.presentationDetents([.medium])
153+
} message: {
154+
Text("Please tap on the link in your email to complete verification.")
165155
}
166156
}
167157
}

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/UpdatePasswordView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ extension UpdatePasswordView: View {
103103
}
104104
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
105105
.safeAreaPadding()
106-
.navigationTitle(authService.string.passwordRecoveryTitle)
106+
.navigationTitle(authService.string.updatePasswordTitle)
107107
.alert(
108108
"Password Updated",
109109
isPresented: $showAlert

e2eTest/FirebaseSwiftUIExample/FirebaseSwiftUIExampleUITests/MFAEnrolmentUITests.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,21 @@ import XCTest
2323

2424
final class MFAEnrollmentUITests: XCTestCase {
2525
var app: XCUIApplication!
26-
26+
2727
override func setUpWithError() throws {
2828
continueAfterFailure = false
2929
}
30-
30+
3131
override func tearDownWithError() throws {
3232
// Clean up: Terminate app
3333
if let app = app {
3434
app.terminate()
3535
}
3636
app = nil
37-
37+
3838
// Small delay between tests to allow emulator to settle
3939
Thread.sleep(forTimeInterval: 0.5)
40-
40+
4141
try super.tearDownWithError()
4242
}
4343

@@ -226,7 +226,7 @@ final class MFAEnrollmentUITests: XCTestCase {
226226
let phoneField = app.textFields["phone-number-field"]
227227
XCTAssertTrue(phoneField.waitForExistence(timeout: 10))
228228
// Generate unique phone number using timestamp to avoid conflicts between tests
229-
let uniqueId = Int(Date().timeIntervalSince1970 * 1000) % 1000000
229+
let uniqueId = Int(Date().timeIntervalSince1970 * 1000) % 1_000_000
230230
let phoneNumberWithoutDialCode = "7\(String(format: "%09d", uniqueId))"
231231
UIPasteboard.general.string = phoneNumberWithoutDialCode
232232
phoneField.tap()
@@ -258,9 +258,9 @@ final class MFAEnrollmentUITests: XCTestCase {
258258

259259
// Paste each digit into the corresponding text field
260260
let codeDigits = Array(code)
261-
let fields = [verificationCodeField1, verificationCodeField2, verificationCodeField3,
261+
let fields = [verificationCodeField1, verificationCodeField2, verificationCodeField3,
262262
verificationCodeField4, verificationCodeField5, verificationCodeField6]
263-
263+
264264
for (index, digit) in codeDigits.enumerated() where index < fields.count {
265265
let field = fields[index]
266266
UIPasteboard.general.string = String(digit)

e2eTest/FirebaseSwiftUIExample/FirebaseSwiftUIExampleUITests/TestUtils.swift

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,9 @@ func createEmail() -> String {
139139
guard let http = sendResp as? HTTPURLResponse, http.statusCode == 200 else {
140140
let errorBody = String(data: sendData, encoding: .utf8) ?? "Unknown error"
141141
throw NSError(domain: "EmulatorError", code: 1,
142-
userInfo: [NSLocalizedDescriptionKey: "Failed to send verification email: \(errorBody)"])
142+
userInfo: [
143+
NSLocalizedDescriptionKey: "Failed to send verification email: \(errorBody)",
144+
])
143145
}
144146

145147
// Add a small delay to ensure the OOB code is registered in the emulator
@@ -156,12 +158,12 @@ func createEmail() -> String {
156158

157159
// Step 2: Fetch OOB codes from emulator with retry logic
158160
let oobURL = URL(string: "\(base)/emulator/v1/projects/\(projectID)/oobCodes")!
159-
161+
160162
var codeItem: OobItem?
161163
var attempts = 0
162164
let maxAttempts = 5
163-
164-
while codeItem == nil && attempts < maxAttempts {
165+
166+
while codeItem == nil, attempts < maxAttempts {
165167
let (oobData, oobResp) = try await URLSession.shared.data(from: oobURL)
166168
guard (oobResp as? HTTPURLResponse)?.statusCode == 200 else {
167169
throw NSError(domain: "EmulatorError", code: 2,
@@ -182,15 +184,16 @@ func createEmail() -> String {
182184
return d0 > d1
183185
}
184186
.first
185-
187+
186188
if codeItem == nil {
187189
attempts += 1
188190
if attempts < maxAttempts {
189191
// Wait before retrying
190192
try await Task.sleep(nanoseconds: 500_000_000) // 0.5 seconds
191193
} else {
192194
// Log available codes for debugging
193-
let availableCodes = envelope.oobCodes.map { "Email: \($0.email), Type: \($0.requestType)" }.joined(separator: "; ")
195+
let availableCodes = envelope.oobCodes.map { "Email: \($0.email), Type: \($0.requestType)" }
196+
.joined(separator: "; ")
194197
throw NSError(domain: "EmulatorError", code: 3,
195198
userInfo: [
196199
NSLocalizedDescriptionKey: "No VERIFY_EMAIL OOB code found for \(email) after \(maxAttempts) attempts. Available codes: \(availableCodes)",

0 commit comments

Comments
 (0)