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 10
10
- [ changed] ** Breaking Change** : ` TOTPSecret.openInOTPApp(withQRCodeURL:) ` is
11
11
now labeled with ` @MainActor ` and requires the ` await ` keyword when called
12
12
off of the main actor or main thread.
13
+ - [ fixed] Simplified completion handler memory management in Auth interop
14
+ (#14962 ).
13
15
14
16
# 11.15.0
15
17
- [ 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 {
124
124
}
125
125
// Call back with current user token.
126
126
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
+ )
132
133
}
133
134
}
134
135
Original file line number Diff line number Diff line change @@ -1591,13 +1591,22 @@ extension User: NSSecureCoding {}
1591
1591
/// on the global work thread in the future.
1592
1592
func internalGetToken( forceRefresh: Bool = false ,
1593
1593
backend: AuthBackend ,
1594
- callback: @escaping ( String ? , Error ? ) -> Void ) {
1594
+ callback: @escaping ( String ? , Error ? ) -> Void ,
1595
+ callCallbackOnMain: Bool = false ) {
1595
1596
Task {
1596
1597
do {
1597
1598
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
+ }
1599
1604
} catch {
1600
- callback ( nil , error)
1605
+ if callCallbackOnMain {
1606
+ Auth . wrapMainAsync ( callback: callback, with: . failure( error) )
1607
+ } else {
1608
+ callback ( nil , error)
1609
+ }
1601
1610
}
1602
1611
}
1603
1612
}
You can’t perform that action at this time.
0 commit comments