mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-12-17 04:36:39 +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 {
|
struct AddAccountView: View {
|
||||||
@Environment(\.dismiss) private var dismiss
|
@Environment(\.dismiss) private var dismiss
|
||||||
@Environment(\.scenePhase) private var scenePhase
|
@Environment(\.scenePhase) private var scenePhase
|
||||||
|
@Environment(\.openURL) private var openURL
|
||||||
|
|
||||||
@Environment(AppAccountsManager.self) private var appAccountsManager
|
@Environment(AppAccountsManager.self) private var appAccountsManager
|
||||||
@Environment(CurrentAccount.self) private var currentAccount
|
@Environment(CurrentAccount.self) private var currentAccount
|
||||||
|
@ -145,9 +146,11 @@ struct AddAccountView: View {
|
||||||
isSigninIn = false
|
isSigninIn = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if !targetEnvironment(macCatalyst)
|
||||||
.sheet(item: $oauthURL, content: { url in
|
.sheet(item: $oauthURL, content: { url in
|
||||||
SafariView(url: url)
|
SafariView(url: url)
|
||||||
})
|
})
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +233,11 @@ struct AddAccountView: View {
|
||||||
do {
|
do {
|
||||||
signInClient = .init(server: sanitizedName)
|
signInClient = .init(server: sanitizedName)
|
||||||
if let oauthURL = try await signInClient?.oauthURL() {
|
if let oauthURL = try await signInClient?.oauthURL() {
|
||||||
self.oauthURL = oauthURL
|
if ProcessInfo.processInfo.isMacCatalystApp {
|
||||||
|
openURL(oauthURL)
|
||||||
|
} else {
|
||||||
|
self.oauthURL = oauthURL
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
isSigninIn = false
|
isSigninIn = false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue