feat: add button to redirect user when this try to install a xcode version without signed

This commit is contained in:
Rubens 2025-08-20 08:38:16 -03:00
parent a434d26921
commit bbec397613
No known key found for this signature in database
GPG key ID: 5A74CD11B5A5D72B
4 changed files with 31 additions and 1 deletions

View file

@ -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)
}

View file

@ -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
}
}
}

View file

@ -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"),

View file

@ -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" : {