From baa90700164c2893ae3aedffae257b6a08546ecc Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Tue, 22 Oct 2019 09:06:35 -0500 Subject: [PATCH] Disable Feedbin add account button until fields are filled --- .../FeedbinAccountViewController.swift | 7 +++++ iOS/Settings/Settings.storyboard | 26 ++++++------------- iOS/UIKit Extensions/VibrantButton.swift | 1 + 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/iOS/Settings/FeedbinAccountViewController.swift b/iOS/Settings/FeedbinAccountViewController.swift index 89264bb1c..3196b5880 100644 --- a/iOS/Settings/FeedbinAccountViewController.swift +++ b/iOS/Settings/FeedbinAccountViewController.swift @@ -36,6 +36,9 @@ class FeedbinAccountViewController: UITableViewController { } else { actionButton.setTitle(NSLocalizedString("Add Account", comment: "Update Credentials"), for: .normal) } + + NotificationCenter.default.addObserver(self, selector: #selector(textDidChange(_:)), name: UITextField.textDidChangeNotification, object: emailTextField) + NotificationCenter.default.addObserver(self, selector: #selector(textDidChange(_:)), name: UITextField.textDidChangeNotification, object: passwordTextField) } @IBAction func cancel(_ sender: Any) { @@ -113,6 +116,10 @@ class FeedbinAccountViewController: UITableViewController { } } + @objc func textDidChange(_ note: Notification) { + actionButton.isEnabled = !(emailTextField.text?.isEmpty ?? false) && !(passwordTextField.text?.isEmpty ?? false) + } + private func showError(_ message: String) { presentError(title: "Error", message: message) } diff --git a/iOS/Settings/Settings.storyboard b/iOS/Settings/Settings.storyboard index dbf3d88a5..5079063cf 100644 --- a/iOS/Settings/Settings.storyboard +++ b/iOS/Settings/Settings.storyboard @@ -3,7 +3,6 @@ - @@ -440,15 +439,13 @@ -