Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Xcodes/Backend/AppState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 2 additions & 0 deletions Xcodes/Frontend/Common/XcodesAlert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -15,6 +16,7 @@ enum XcodesAlert: Identifiable {
case .generic: return 3
case .checkMinSupportedVersion: return 4
case .cancelRuntimeInstall: return 5
case .unauthenticated: return 6
}
}
}
Expand Down
14 changes: 14 additions & 0 deletions Xcodes/Frontend/MainWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
124 changes: 124 additions & 0 deletions Xcodes/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -1958,6 +1958,130 @@
}
}
},
"Alert.Install.AuthError.Message" : {
"localizations" : {
"ar" : {
"stringUnit" : {
"state" : "translated",
"value" : "You are not authorized. Please Sign in with your Apple ID first."
}
},
"ca" : {
"stringUnit" : {
"state" : "translated",
"value" : "You are not authorized. Please Sign in with your Apple ID first."
}
},
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "You are not authorized. Please Sign in with your Apple ID first."
}
},
"el" : {
"stringUnit" : {
"state" : "translated",
"value" : "You are not authorized. Please Sign in with your Apple ID first."
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "You are not authorized. Please Sign in with your Apple ID first."
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "You are not authorized. Please Sign in with your Apple ID first."
}
},
"fi" : {
"stringUnit" : {
"state" : "translated",
"value" : "You are not authorized. Please Sign in with your Apple ID first."
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "You are not authorized. Please Sign in with your Apple ID first."
}
},
"hi" : {
"stringUnit" : {
"state" : "translated",
"value" : "You are not authorized. Please Sign in with your Apple ID first."
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"value" : "You are not authorized. Please Sign in with your Apple ID first."
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "You are not authorized. Please Sign in with your Apple ID first."
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
"value" : "You are not authorized. Please Sign in with your Apple ID first."
}
},
"nl" : {
"stringUnit" : {
"state" : "translated",
"value" : "You are not authorized. Please Sign in with your Apple ID first."
}
},
"pl" : {
"stringUnit" : {
"state" : "translated",
"value" : "You are not authorized. Please Sign in with your Apple ID first."
}
},
"pt-BR" : {
"stringUnit" : {
"state" : "translated",
"value" : "Você não está autorizado. Por favor, entre com o seu ID Apple primeiro."
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"value" : "You are not authorized. Please Sign in with your Apple ID first."
}
},
"tr" : {
"stringUnit" : {
"state" : "translated",
"value" : "You are not authorized. Please Sign in with your Apple ID first."
}
},
"uk" : {
"stringUnit" : {
"state" : "translated",
"value" : "You are not authorized. Please Sign in with your Apple ID first."
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "You are not authorized. Please Sign in with your Apple ID first."
}
},
"zh-Hant" : {
"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" : {
Expand Down