mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-03-25 08:55:46 +00:00
Add missing error alerts to the SignIn views (this does not fix the error formatting from AppState for fear of merge issues)
This commit is contained in:
parent
c9c31ff6f5
commit
74cb2198f5
5 changed files with 25 additions and 3 deletions
|
|
@ -14,6 +14,7 @@ class AppState: ObservableObject {
|
|||
@Published var authenticationState: AuthenticationState = .unauthenticated
|
||||
@Published var allVersions: [XcodeVersion] = []
|
||||
@Published var error: AlertContent?
|
||||
@Published var authError: AlertContent?
|
||||
@Published var presentingSignInAlert = false
|
||||
@Published var isProcessingRequest = false
|
||||
@Published var secondFactorData: SecondFactorData?
|
||||
|
|
@ -134,8 +135,9 @@ class AppState: ObservableObject {
|
|||
// remove any keychain password if we fail to log with an invalid username or password so it doesn't try again.
|
||||
try? Current.keychain.remove(username)
|
||||
}
|
||||
|
||||
self.error = AlertContent(title: "Error signing in", message: error.legibleLocalizedDescription)
|
||||
|
||||
// This error message is not user friendly... need to extract some meaningful data in the different cases
|
||||
self.authError = AlertContent(title: "Error signing in", message: error.legibleLocalizedDescription)
|
||||
case .finished:
|
||||
switch self.authenticationState {
|
||||
case .authenticated, .unauthenticated:
|
||||
|
|
|
|||
|
|
@ -38,6 +38,11 @@ struct SignIn2FAView: View {
|
|||
.frame(height: 25)
|
||||
}
|
||||
.padding()
|
||||
.alert(item: $appState.authError) { error in
|
||||
Alert(title: Text(error.title),
|
||||
message: Text(verbatim: error.message),
|
||||
dismissButton: .default(Text("OK")))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,11 @@ struct SignInCredentialsView: View {
|
|||
.frame(height: 25)
|
||||
}
|
||||
.padding()
|
||||
.alert(item: $appState.authError) { error in
|
||||
Alert(title: Text(error.title),
|
||||
message: Text(verbatim: error.message),
|
||||
dismissButton: .default(Text("OK")))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,8 +42,13 @@ struct SignInPhoneListView: View {
|
|||
}
|
||||
.frame(height: 25)
|
||||
}
|
||||
.frame(width: 400, height: 200)
|
||||
.padding()
|
||||
.frame(width: 400, height: 200)
|
||||
.alert(item: $appState.authError) { error in
|
||||
Alert(title: Text(error.title),
|
||||
message: Text(verbatim: error.message),
|
||||
dismissButton: .default(Text("OK")))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,11 @@ struct SignInSMSView: View {
|
|||
.frame(height: 25)
|
||||
}
|
||||
.padding()
|
||||
.alert(item: $appState.authError) { error in
|
||||
Alert(title: Text(error.title),
|
||||
message: Text(verbatim: error.message),
|
||||
dismissButton: .default(Text("OK")))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue