mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-04-25 14:47:38 +00:00
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:
commit
4ccb6e7f06
4 changed files with 145 additions and 1 deletions
|
|
@ -611,7 +611,11 @@ class AppState: ObservableObject {
|
||||||
self.installationPublishers[id] = nil
|
self.installationPublishers[id] = nil
|
||||||
if case let .failure(error) = completion {
|
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
|
// 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.error = error
|
||||||
self.presentedAlert = .generic(title: localizeString("Alert.Install.Error.Title"), message: error.legibleLocalizedDescription)
|
self.presentedAlert = .generic(title: localizeString("Alert.Install.Error.Title"), message: error.legibleLocalizedDescription)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ enum XcodesAlert: Identifiable {
|
||||||
case privilegedHelper
|
case privilegedHelper
|
||||||
case generic(title: String, message: String)
|
case generic(title: String, message: String)
|
||||||
case checkMinSupportedVersion(xcode: AvailableXcode, macOS: String)
|
case checkMinSupportedVersion(xcode: AvailableXcode, macOS: String)
|
||||||
|
case unauthenticated
|
||||||
|
|
||||||
var id: Int {
|
var id: Int {
|
||||||
switch self {
|
switch self {
|
||||||
|
|
@ -15,6 +16,7 @@ enum XcodesAlert: Identifiable {
|
||||||
case .generic: return 3
|
case .generic: return 3
|
||||||
case .checkMinSupportedVersion: return 4
|
case .checkMinSupportedVersion: return 4
|
||||||
case .cancelRuntimeInstall: return 5
|
case .cancelRuntimeInstall: return 5
|
||||||
|
case .unauthenticated: return 6
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -190,6 +190,20 @@ struct MainWindow: View {
|
||||||
action: { appState.presentedAlert = nil }
|
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):
|
case let .checkMinSupportedVersion(xcode, deviceVersion):
|
||||||
return Alert(
|
return Alert(
|
||||||
title: Text("Alert.MinSupported.Title"),
|
title: Text("Alert.MinSupported.Title"),
|
||||||
|
|
|
||||||
|
|
@ -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" : {
|
"Alert.Install.Error.Need.Xcode16.1" : {
|
||||||
"extractionState" : "manual",
|
"extractionState" : "manual",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue