From bbec397613ceb472f57f3a47032dc4f391ba2d48 Mon Sep 17 00:00:00 2001 From: Rubens Date: Wed, 20 Aug 2025 08:38:16 -0300 Subject: [PATCH 1/2] feat: add button to redirect user when this try to install a xcode version without signed --- Xcodes/Backend/AppState.swift | 6 +++++- Xcodes/Frontend/Common/XcodesAlert.swift | 2 ++ Xcodes/Frontend/MainWindow.swift | 14 ++++++++++++++ Xcodes/Resources/Localizable.xcstrings | 10 ++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/Xcodes/Backend/AppState.swift b/Xcodes/Backend/AppState.swift index 359c249b..27e516f5 100644 --- a/Xcodes/Backend/AppState.swift +++ b/Xcodes/Backend/AppState.swift @@ -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) } diff --git a/Xcodes/Frontend/Common/XcodesAlert.swift b/Xcodes/Frontend/Common/XcodesAlert.swift index 2d5e66f1..710668f9 100644 --- a/Xcodes/Frontend/Common/XcodesAlert.swift +++ b/Xcodes/Frontend/Common/XcodesAlert.swift @@ -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 } } } diff --git a/Xcodes/Frontend/MainWindow.swift b/Xcodes/Frontend/MainWindow.swift index 698ba965..4bf490fe 100644 --- a/Xcodes/Frontend/MainWindow.swift +++ b/Xcodes/Frontend/MainWindow.swift @@ -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"), diff --git a/Xcodes/Resources/Localizable.xcstrings b/Xcodes/Resources/Localizable.xcstrings index daac9c0a..c59937cc 100644 --- a/Xcodes/Resources/Localizable.xcstrings +++ b/Xcodes/Resources/Localizable.xcstrings @@ -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" : { From 22e4991f9a0e744522738c5e5ea85ea463968db8 Mon Sep 17 00:00:00 2001 From: Rubens Date: Wed, 27 Aug 2025 10:32:20 -0300 Subject: [PATCH 2/2] chore: add new localized string in all languages --- Xcodes/Resources/Localizable.xcstrings | 114 +++++++++++++++++++++++++ 1 file changed, 114 insertions(+) diff --git a/Xcodes/Resources/Localizable.xcstrings b/Xcodes/Resources/Localizable.xcstrings index c59937cc..d05ed67e 100644 --- a/Xcodes/Resources/Localizable.xcstrings +++ b/Xcodes/Resources/Localizable.xcstrings @@ -1960,11 +1960,125 @@ }, "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." + } } } },