mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-03-25 08:55:46 +00:00
feat: add button to redirect user when this try to install a xcode version without signed
This commit is contained in:
parent
a434d26921
commit
bbec397613
4 changed files with 31 additions and 1 deletions
|
|
@ -610,7 +610,11 @@ class AppState: ObservableObject {
|
|||
self.installationPublishers[id] = nil
|
||||
if case let .failure(error) = completion {
|
||||
// Prevent setting the app state error if it is an invalid session, we will present the sign in view instead
|
||||
if error as? AuthenticationError != .invalidSession {
|
||||
if let error = error as? AuthenticationError, case .notAuthorized = error {
|
||||
self.error = error
|
||||
self.presentedAlert = .unauthenticated
|
||||
|
||||
} else if error as? AuthenticationError != .invalidSession {
|
||||
self.error = error
|
||||
self.presentedAlert = .generic(title: localizeString("Alert.Install.Error.Title"), message: error.legibleLocalizedDescription)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ enum XcodesAlert: Identifiable {
|
|||
case privilegedHelper
|
||||
case generic(title: String, message: String)
|
||||
case checkMinSupportedVersion(xcode: AvailableXcode, macOS: String)
|
||||
case unauthenticated
|
||||
|
||||
var id: Int {
|
||||
switch self {
|
||||
|
|
@ -15,6 +16,7 @@ enum XcodesAlert: Identifiable {
|
|||
case .generic: return 3
|
||||
case .checkMinSupportedVersion: return 4
|
||||
case .cancelRuntimeInstall: return 5
|
||||
case .unauthenticated: return 6
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,6 +188,20 @@ struct MainWindow: View {
|
|||
action: { appState.presentedAlert = nil }
|
||||
)
|
||||
)
|
||||
case .unauthenticated:
|
||||
return Alert(
|
||||
title: Text("Alert.Install.Error.Title"),
|
||||
message: Text("Alert.Install.AuthError.Message"),
|
||||
primaryButton: .default(
|
||||
Text("OK"),
|
||||
action: {
|
||||
appState.presentedSheet = .signIn
|
||||
}
|
||||
),
|
||||
secondaryButton: .cancel(
|
||||
Text("Cancel")
|
||||
)
|
||||
)
|
||||
case let .checkMinSupportedVersion(xcode, deviceVersion):
|
||||
return Alert(
|
||||
title: Text("Alert.MinSupported.Title"),
|
||||
|
|
|
|||
|
|
@ -1958,6 +1958,16 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"Alert.Install.AuthError.Message" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "You are not authorized. Please Sign in with your Apple ID first."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Alert.Install.Error.Need.Xcode16.1" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
|
|
|
|||
Loading…
Reference in a new issue