Merge pull request #741 from r1b2ns/feat/redirect-new-user-to-login

feat: improve user experience with a redirect window to sign-in
This commit is contained in:
Matt Kiazyk 2025-08-27 08:37:19 -05:00 committed by GitHub
commit 4ccb6e7f06
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 145 additions and 1 deletions

View file

@ -611,7 +611,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

@ -190,6 +190,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,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" : {