mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Adds Validation to NewsBlur and Feedbin Views
Disables add account button when username or password are empty.
This commit is contained in:
@@ -99,6 +99,7 @@ struct FeedbinAddAccountView: View {
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
.disabled(!validateCredentials())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,6 +111,13 @@ struct FeedbinAddAccountView: View {
|
||||
return Text("").multilineTextAlignment(.center)
|
||||
}
|
||||
|
||||
private func validateCredentials() -> Bool {
|
||||
if (accountEmail.trimmingWhitespace.count == 0) || (accountPassword.trimmingWhitespace.count == 0) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
private func retrieveCredentials() {
|
||||
if let account = account {
|
||||
do {
|
||||
|
||||
@@ -116,6 +116,7 @@ struct NewsBlurAddAccountView: View, Logging {
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
.disabled(!validateCredentials())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,6 +128,13 @@ struct NewsBlurAddAccountView: View, Logging {
|
||||
return Text("").multilineTextAlignment(.center)
|
||||
}
|
||||
|
||||
private func validateCredentials() -> Bool {
|
||||
if (accountUserName.trimmingWhitespace.count == 0) || (accountPassword.trimmingWhitespace.count == 0) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
private func executeAccountCredentials() async throws {
|
||||
let trimmedUsername = accountUserName.trimmingWhitespace
|
||||
|
||||
|
||||
Reference in New Issue
Block a user