File tree Expand file tree Collapse file tree 3 files changed +20
-8
lines changed
Expand file tree Collapse file tree 3 files changed +20
-8
lines changed Original file line number Diff line number Diff line change 1010- [ changed] ** Breaking Change** : ` TOTPSecret.openInOTPApp(withQRCodeURL:) ` is
1111 now labeled with ` @MainActor ` and requires the ` await ` keyword when called
1212 off of the main actor or main thread.
13+ - [ fixed] Simplified completion handler memory management in Auth interop
14+ (#14962 ).
1315
1416# 11.15.0
1517- [ fixed] Fixed ` Sendable ` warnings introduced in the Xcode 26 beta. (#14996 )
Original file line number Diff line number Diff line change @@ -124,11 +124,12 @@ extension Auth: AuthInterop {
124124 }
125125 // Call back with current user token.
126126 currentUser
127- . internalGetToken ( forceRefresh: forceRefresh, backend: strongSelf. backend) { token, error in
128- DispatchQueue . main. async {
129- callback ( token, error)
130- }
131- }
127+ . internalGetToken (
128+ forceRefresh: forceRefresh,
129+ backend: strongSelf. backend,
130+ callback: callback,
131+ callCallbackOnMain: true
132+ )
132133 }
133134 }
134135
Original file line number Diff line number Diff line change @@ -1591,13 +1591,22 @@ extension User: NSSecureCoding {}
15911591 /// on the global work thread in the future.
15921592 func internalGetToken( forceRefresh: Bool = false ,
15931593 backend: AuthBackend ,
1594- callback: @escaping ( String ? , Error ? ) -> Void ) {
1594+ callback: @escaping ( String ? , Error ? ) -> Void ,
1595+ callCallbackOnMain: Bool = false ) {
15951596 Task {
15961597 do {
15971598 let token = try await internalGetTokenAsync ( forceRefresh: forceRefresh, backend: backend)
1598- callback ( token, nil )
1599+ if callCallbackOnMain {
1600+ Auth . wrapMainAsync ( callback: callback, with: . success( token) )
1601+ } else {
1602+ callback ( token, nil )
1603+ }
15991604 } catch {
1600- callback ( nil , error)
1605+ if callCallbackOnMain {
1606+ Auth . wrapMainAsync ( callback: callback, with: . failure( error) )
1607+ } else {
1608+ callback ( nil , error)
1609+ }
16011610 }
16021611 }
16031612 }
You can’t perform that action at this time.
0 commit comments