diff --git a/iOS/Settings/AddAccountViewController.swift b/iOS/Settings/AddAccountViewController.swift
index 04e7eda5e..eb78d8174 100644
--- a/iOS/Settings/AddAccountViewController.swift
+++ b/iOS/Settings/AddAccountViewController.swift
@@ -10,7 +10,7 @@ import Account
import UIKit
protocol AddAccountDismissDelegate: UIViewController {
- func dismiss()
+ func dismiss(_ viewController: UIViewController)
}
class AddAccountViewController: UITableViewController, AddAccountDismissDelegate {
@@ -24,23 +24,24 @@ class AddAccountViewController: UITableViewController, AddAccountDismissDelegate
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
- let storyboard = UIStoryboard.settings
switch indexPath.row {
case 0:
- let addViewController = storyboard.instantiateViewController(withIdentifier: "AddLocalAccountViewController") as! AddLocalAccountViewController
+ let navController = UIStoryboard.settings.instantiateViewController(withIdentifier: "AddLocalAccountNavigationViewController") as! UINavigationController
+ let addViewController = navController.topViewController as! AddLocalAccountViewController
addViewController.delegate = self
- navigationController?.pushViewController(addViewController, animated: true)
+ present(navController, animated: true)
case 1:
- let addViewController = storyboard.instantiateViewController(withIdentifier: "FeedbinAccountViewController") as! FeedbinAccountViewController
+ let navController = UIStoryboard.settings.instantiateViewController(withIdentifier: "FeedbinAccountNavigationViewController") as! UINavigationController
+ let addViewController = navController.topViewController as! FeedbinAccountViewController
addViewController.delegate = self
- navigationController?.pushViewController(addViewController, animated: true)
+ present(navController, animated: true)
default:
break
}
}
- func dismiss() {
- navigationController?.popToRootViewController(animated: true)
+ func dismiss(_ viewController: UIViewController) {
+ viewController.dismiss(animated: true, completion: nil)
}
}
diff --git a/iOS/Settings/AddLocalAccountViewController.swift b/iOS/Settings/AddLocalAccountViewController.swift
index 1ace24fb4..efa58085d 100644
--- a/iOS/Settings/AddLocalAccountViewController.swift
+++ b/iOS/Settings/AddLocalAccountViewController.swift
@@ -11,6 +11,7 @@ import Account
class AddLocalAccountViewController: UIViewController {
+ @IBOutlet weak var cancelBarButtonItem: UIBarButtonItem!
@IBOutlet private weak var localAccountNameLabel: UILabel!
@IBOutlet weak var nameTextField: UITextField!
@@ -23,10 +24,14 @@ class AddLocalAccountViewController: UIViewController {
nameTextField.delegate = self
}
+ @IBAction func cancel(_ sender: Any) {
+ delegate?.dismiss(self)
+ }
+
@IBAction func addAccountTapped(_ sender: Any) {
let account = AccountManager.shared.createAccount(type: .onMyMac)
account.name = nameTextField.text
- delegate?.dismiss()
+ delegate?.dismiss(self)
}
}
diff --git a/iOS/Settings/FeedbinAccountViewController.swift b/iOS/Settings/FeedbinAccountViewController.swift
index cc5d2fdab..69c19c43e 100644
--- a/iOS/Settings/FeedbinAccountViewController.swift
+++ b/iOS/Settings/FeedbinAccountViewController.swift
@@ -13,7 +13,7 @@ import RSWeb
class FeedbinAccountViewController: UIViewController {
@IBOutlet weak var activityIndicator: UIActivityIndicatorView!
-
+ @IBOutlet weak var cancelBarButtonItem: UIBarButtonItem!
@IBOutlet weak var emailTextField: UITextField!
@IBOutlet weak var passwordTextField: UITextField!
@IBOutlet weak var addAccountButton: UIButton!
@@ -38,6 +38,10 @@ class FeedbinAccountViewController: UIViewController {
}
}
+ @IBAction func cancel(_ sender: Any) {
+ delegate?.dismiss(self)
+ }
+
@IBAction func addAccountTapped(_ sender: Any) {
self.errorMessageLabel.text = nil
@@ -74,7 +78,7 @@ class FeedbinAccountViewController: UIViewController {
self.account?.refreshAll()
}
- self.delegate?.dismiss()
+ self.delegate?.dismiss(self)
} catch {
self.errorMessageLabel.text = NSLocalizedString("Keychain error while storing credentials.", comment: "Credentials Error")
}
@@ -89,13 +93,12 @@ class FeedbinAccountViewController: UIViewController {
}
private func enableNavigation() {
- self.navigationItem.backBarButtonItem?.isEnabled = true
+ self.cancelBarButtonItem.isEnabled = true
self.addAccountButton.isEnabled = true
- self.activityIndicator.isHidden = true
}
private func disableNavigation() {
- navigationItem.backBarButtonItem?.isEnabled = false
+ cancelBarButtonItem.isEnabled = false
addAccountButton.isEnabled = false
}
@@ -108,7 +111,7 @@ class FeedbinAccountViewController: UIViewController {
self.activityIndicator.isHidden = true
self.activityIndicator.stopAnimating()
}
-
+
}
extension FeedbinAccountViewController: UITextFieldDelegate {
diff --git a/iOS/Settings/Settings.storyboard b/iOS/Settings/Settings.storyboard
index 6ad64c7f2..5d478eaa6 100644
--- a/iOS/Settings/Settings.storyboard
+++ b/iOS/Settings/Settings.storyboard
@@ -508,6 +508,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -517,10 +549,10 @@
-
+
-
+
@@ -536,7 +568,7 @@
-
+
@@ -545,7 +577,7 @@
-
+
@@ -591,7 +630,7 @@
-
+
@@ -610,7 +649,7 @@
-
+
@@ -619,7 +658,7 @@
-
+
@@ -628,7 +667,7 @@