mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-12-16 20:26:37 +00:00
Fix login on Catalyst
This commit is contained in:
parent
2a936adca0
commit
5a52eb50e9
1 changed files with 8 additions and 1 deletions
|
@ -13,6 +13,7 @@ import SwiftUI
|
|||
struct AddAccountView: View {
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
@Environment(\.scenePhase) private var scenePhase
|
||||
@Environment(\.openURL) private var openURL
|
||||
|
||||
@Environment(AppAccountsManager.self) private var appAccountsManager
|
||||
@Environment(CurrentAccount.self) private var currentAccount
|
||||
|
@ -145,9 +146,11 @@ struct AddAccountView: View {
|
|||
isSigninIn = false
|
||||
}
|
||||
}
|
||||
#if !targetEnvironment(macCatalyst)
|
||||
.sheet(item: $oauthURL, content: { url in
|
||||
SafariView(url: url)
|
||||
})
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,7 +233,11 @@ struct AddAccountView: View {
|
|||
do {
|
||||
signInClient = .init(server: sanitizedName)
|
||||
if let oauthURL = try await signInClient?.oauthURL() {
|
||||
self.oauthURL = oauthURL
|
||||
if ProcessInfo.processInfo.isMacCatalystApp {
|
||||
openURL(oauthURL)
|
||||
} else {
|
||||
self.oauthURL = oauthURL
|
||||
}
|
||||
} else {
|
||||
isSigninIn = false
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue