Removes AddAccountDismissDelegate

Delegate which was responsible to dismiss AddAccountViewController
whenever presented view controller dismissed is not needed. So removing
it simply will go to previous screen from where user comes.
This commit is contained in:
Rizwan Mohamed Ibrahim 2020-04-24 18:49:49 +05:30
parent c55d8c540e
commit 43f175d71a
No known key found for this signature in database
GPG Key ID: D5BEE468D448BCC5
4 changed files with 2 additions and 23 deletions

View File

@ -20,7 +20,6 @@ class FeedWranglerAccountViewController: UITableViewController {
@IBOutlet weak var actionButton: UIButton! @IBOutlet weak var actionButton: UIButton!
weak var account: Account? weak var account: Account?
weak var delegate: AddAccountDismissDelegate?
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
@ -59,7 +58,6 @@ class FeedWranglerAccountViewController: UITableViewController {
@IBAction func cancel(_ sender: Any) { @IBAction func cancel(_ sender: Any) {
dismiss(animated: true, completion: nil) dismiss(animated: true, completion: nil)
delegate?.dismiss()
} }
@IBAction func showHidePassword(_ sender: Any) { @IBAction func showHidePassword(_ sender: Any) {
@ -120,9 +118,7 @@ class FeedWranglerAccountViewController: UITableViewController {
} }
} }
self.dismiss(animated: true, completion: nil) self.dismiss(animated: true, completion: nil)
self.delegate?.dismiss()
} catch { } catch {
self.showError(NSLocalizedString("Keychain error while storing credentials.", comment: "Credentials Error")) self.showError(NSLocalizedString("Keychain error while storing credentials.", comment: "Credentials Error"))
} }

View File

@ -20,7 +20,6 @@ class FeedbinAccountViewController: UITableViewController {
@IBOutlet weak var actionButton: UIButton! @IBOutlet weak var actionButton: UIButton!
weak var account: Account? weak var account: Account?
weak var delegate: AddAccountDismissDelegate?
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
@ -60,7 +59,6 @@ class FeedbinAccountViewController: UITableViewController {
@IBAction func cancel(_ sender: Any) { @IBAction func cancel(_ sender: Any) {
dismiss(animated: true, completion: nil) dismiss(animated: true, completion: nil)
delegate?.dismiss()
} }
@IBAction func showHidePassword(_ sender: Any) { @IBAction func showHidePassword(_ sender: Any) {
@ -118,7 +116,6 @@ class FeedbinAccountViewController: UITableViewController {
} }
self.dismiss(animated: true, completion: nil) self.dismiss(animated: true, completion: nil)
self.delegate?.dismiss()
} catch { } catch {
self.showError(NSLocalizedString("Keychain error while storing credentials.", comment: "Credentials Error")) self.showError(NSLocalizedString("Keychain error while storing credentials.", comment: "Credentials Error"))
} }

View File

@ -12,8 +12,6 @@ import Account
class LocalAccountViewController: UITableViewController { class LocalAccountViewController: UITableViewController {
@IBOutlet weak var nameTextField: UITextField! @IBOutlet weak var nameTextField: UITextField!
weak var delegate: AddAccountDismissDelegate?
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
@ -25,14 +23,12 @@ class LocalAccountViewController: UITableViewController {
@IBAction func cancel(_ sender: Any) { @IBAction func cancel(_ sender: Any) {
dismiss(animated: true, completion: nil) dismiss(animated: true, completion: nil)
delegate?.dismiss()
} }
@IBAction func add(_ sender: Any) { @IBAction func add(_ sender: Any) {
let account = AccountManager.shared.createAccount(type: .onMyMac) let account = AccountManager.shared.createAccount(type: .onMyMac)
account.name = nameTextField.text account.name = nameTextField.text
dismiss(animated: true, completion: nil) dismiss(animated: true, completion: nil)
delegate?.dismiss()
} }
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {

View File

@ -10,11 +10,7 @@ import Account
import UIKit import UIKit
import RSCore import RSCore
protocol AddAccountDismissDelegate: UIViewController { class AddAccountViewController: UITableViewController {
func dismiss()
}
class AddAccountViewController: UITableViewController, AddAccountDismissDelegate {
@IBOutlet private weak var localAccountImageView: UIImageView! @IBOutlet private weak var localAccountImageView: UIImageView!
@IBOutlet private weak var localAccountNameLabel: UILabel! @IBOutlet private weak var localAccountNameLabel: UILabel!
@ -36,14 +32,10 @@ class AddAccountViewController: UITableViewController, AddAccountDismissDelegate
case 0: case 0:
let navController = UIStoryboard.account.instantiateViewController(withIdentifier: "AddLocalAccountNavigationViewController") as! UINavigationController let navController = UIStoryboard.account.instantiateViewController(withIdentifier: "AddLocalAccountNavigationViewController") as! UINavigationController
navController.modalPresentationStyle = .currentContext navController.modalPresentationStyle = .currentContext
let addViewController = navController.topViewController as! LocalAccountViewController
addViewController.delegate = self
present(navController, animated: true) present(navController, animated: true)
case 1: case 1:
let navController = UIStoryboard.account.instantiateViewController(withIdentifier: "FeedbinAccountNavigationViewController") as! UINavigationController let navController = UIStoryboard.account.instantiateViewController(withIdentifier: "FeedbinAccountNavigationViewController") as! UINavigationController
navController.modalPresentationStyle = .currentContext navController.modalPresentationStyle = .currentContext
let addViewController = navController.topViewController as! FeedbinAccountViewController
addViewController.delegate = self
present(navController, animated: true) present(navController, animated: true)
case 2: case 2:
let addAccount = OAuthAccountAuthorizationOperation(accountType: .feedly) let addAccount = OAuthAccountAuthorizationOperation(accountType: .feedly)
@ -53,8 +45,6 @@ class AddAccountViewController: UITableViewController, AddAccountDismissDelegate
case 3: case 3:
let navController = UIStoryboard.account.instantiateViewController(withIdentifier: "FeedWranglerAccountNavigationViewController") as! UINavigationController let navController = UIStoryboard.account.instantiateViewController(withIdentifier: "FeedWranglerAccountNavigationViewController") as! UINavigationController
navController.modalPresentationStyle = .currentContext navController.modalPresentationStyle = .currentContext
let addViewController = navController.topViewController as! FeedWranglerAccountViewController
addViewController.delegate = self
present(navController, animated: true) present(navController, animated: true)
default: default:
break break