Skip to content

Commit 01cf975

Browse files
committed
revert breaking change
1 parent e03746a commit 01cf975

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

FirebaseAuth/Sources/Swift/MultiFactor/TOTP/TOTPSecret.swift

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,28 +54,30 @@ import Foundation
5454
///
5555
/// See more details
5656
/// [here](https://developer.apple.com/documentation/authenticationservices/securing_logins_with_icloud_keychain_verification_codes)
57-
@MainActor @objc(openInOTPAppWithQRCodeURL:)
57+
@objc(openInOTPAppWithQRCodeURL:)
5858
open func openInOTPApp(withQRCodeURL qrCodeURL: String) {
59-
if GULAppEnvironmentUtil.isAppExtension() {
60-
// iOS App extensions should not call [UIApplication sharedApplication], even if
61-
// UIApplication responds to it.
62-
return
63-
}
59+
DispatchQueue.main.async {
60+
if GULAppEnvironmentUtil.isAppExtension() {
61+
// iOS App extensions should not call [UIApplication sharedApplication], even if
62+
// UIApplication responds to it.
63+
return
64+
}
6465

65-
// Using reflection here to avoid build errors in extensions.
66-
// The `UIApplication.sharedApplication` requires main actor
67-
// synchronization.
68-
let sel = NSSelectorFromString("sharedApplication")
69-
guard UIApplication.responds(to: sel),
70-
let rawApplication = UIApplication.perform(sel),
71-
let application = rawApplication.takeUnretainedValue() as? UIApplication else {
72-
return
73-
}
74-
if let url = URL(string: qrCodeURL), application.canOpenURL(url) {
75-
application.open(url, options: [:], completionHandler: nil)
76-
} else {
77-
AuthLog.logError(code: "I-AUT000019",
78-
message: "URL: \(qrCodeURL) cannot be opened")
66+
// Using reflection here to avoid build errors in extensions.
67+
// The `UIApplication.sharedApplication` requires main actor
68+
// synchronization.
69+
let sel = NSSelectorFromString("sharedApplication")
70+
guard UIApplication.responds(to: sel),
71+
let rawApplication = UIApplication.perform(sel),
72+
let application = rawApplication.takeUnretainedValue() as? UIApplication else {
73+
return
74+
}
75+
if let url = URL(string: qrCodeURL), application.canOpenURL(url) {
76+
application.open(url, options: [:], completionHandler: nil)
77+
} else {
78+
AuthLog.logError(code: "I-AUT000019",
79+
message: "URL: \(qrCodeURL) cannot be opened")
80+
}
7981
}
8082
}
8183

0 commit comments

Comments
 (0)