Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions FirebaseAuth/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
- [changed] **Breaking Change**: `TOTPSecret.openInOTPApp(withQRCodeURL:)` is
now labeled with `@MainActor` and requires the `await` keyword when called
off of the main actor or main thread.
- [fixed] Simplified completion handler memory management in Auth interop
(#14962).

# 11.15.0
- [fixed] Fixed `Sendable` warnings introduced in the Xcode 26 beta. (#14996)
Expand Down
11 changes: 6 additions & 5 deletions FirebaseAuth/Sources/Swift/Auth/Auth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,12 @@ extension Auth: AuthInterop {
}
// Call back with current user token.
currentUser
.internalGetToken(forceRefresh: forceRefresh, backend: strongSelf.backend) { token, error in
DispatchQueue.main.async {
callback(token, error)
}
}
.internalGetToken(
forceRefresh: forceRefresh,
backend: strongSelf.backend,
callback: callback,
callCallbackOnMain: true
)
}
}

Expand Down
15 changes: 12 additions & 3 deletions FirebaseAuth/Sources/Swift/User/User.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1591,13 +1591,22 @@ extension User: NSSecureCoding {}
/// on the global work thread in the future.
func internalGetToken(forceRefresh: Bool = false,
backend: AuthBackend,
callback: @escaping (String?, Error?) -> Void) {
callback: @escaping (String?, Error?) -> Void,
callCallbackOnMain: Bool = false) {
Task {
do {
let token = try await internalGetTokenAsync(forceRefresh: forceRefresh, backend: backend)
callback(token, nil)
if callCallbackOnMain {
Auth.wrapMainAsync(callback: callback, with: .success(token))
} else {
callback(token, nil)
}
} catch {
callback(nil, error)
if callCallbackOnMain {
Auth.wrapMainAsync(callback: callback, with: .failure(error))
} else {
callback(nil, error)
}
}
}
}
Expand Down
Loading