Stabilize iOS/watchOS/tvOS apps and add cross-platform audit remediation
This commit is contained in:
@@ -12,7 +12,7 @@ struct LoginView: View {
|
||||
@State var password: String = ""
|
||||
@Environment(\.dismiss) var dismiss
|
||||
let completion: (() -> Void)
|
||||
@State var doingNetworkShit: Bool = false
|
||||
@State var isLoggingIn: Bool = false
|
||||
|
||||
@State var errorTitle = ""
|
||||
@State var errorMessage = ""
|
||||
@@ -23,13 +23,17 @@ struct LoginView: View {
|
||||
VStack {
|
||||
TextField("Email", text: $email)
|
||||
.textContentType(.username)
|
||||
.autocapitalization(.none)
|
||||
.textInputAutocapitalization(.never)
|
||||
.autocorrectionDisabled(true)
|
||||
.keyboardType(.emailAddress)
|
||||
.padding()
|
||||
.background(Color.white)
|
||||
.cornerRadius(8)
|
||||
.padding(.horizontal)
|
||||
.padding(.top, 25)
|
||||
.foregroundStyle(.black)
|
||||
.accessibilityLabel("Email")
|
||||
.submitLabel(.next)
|
||||
|
||||
SecureField("Password", text: $password)
|
||||
.textContentType(.password)
|
||||
@@ -37,10 +41,13 @@ struct LoginView: View {
|
||||
.background(Color.white)
|
||||
.cornerRadius(8)
|
||||
.padding(.horizontal)
|
||||
.autocapitalization(.none)
|
||||
.textInputAutocapitalization(.never)
|
||||
.autocorrectionDisabled(true)
|
||||
.foregroundStyle(.black)
|
||||
.accessibilityLabel("Password")
|
||||
.submitLabel(.go)
|
||||
|
||||
if doingNetworkShit {
|
||||
if isLoggingIn {
|
||||
ProgressView("Logging In")
|
||||
.padding()
|
||||
.foregroundColor(.white)
|
||||
@@ -58,6 +65,8 @@ struct LoginView: View {
|
||||
.padding()
|
||||
.frame(maxWidth: .infinity)
|
||||
.disabled(password.isEmpty || email.isEmpty)
|
||||
.accessibilityLabel("Log in")
|
||||
.accessibilityHint("Logs in using the entered email and password")
|
||||
}
|
||||
|
||||
Spacer()
|
||||
@@ -68,11 +77,12 @@ struct LoginView: View {
|
||||
.resizable()
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
.scaledToFill()
|
||||
.accessibilityHidden(true)
|
||||
)
|
||||
.alert(errorTitle, isPresented: $hasError, actions: {
|
||||
|
||||
}, message: {
|
||||
|
||||
Text(errorMessage)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -81,9 +91,9 @@ struct LoginView: View {
|
||||
"email": email,
|
||||
"password": password
|
||||
]
|
||||
doingNetworkShit = true
|
||||
isLoggingIn = true
|
||||
UserStore.shared.login(postData: postData, completion: { success in
|
||||
doingNetworkShit = false
|
||||
isLoggingIn = false
|
||||
if success {
|
||||
completion()
|
||||
dismiss()
|
||||
@@ -103,4 +113,3 @@ struct LoginView_Previews: PreviewProvider {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user