From e77abf42c34c65c85f3c79769438040fb85c336f Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Tue, 28 Apr 2020 17:53:24 -0500 Subject: [PATCH] Revert "Removes AddAccountDismissDelegate" --- iOS/Account/FeedWranglerAccountViewController.swift | 6 +++++- iOS/Account/FeedbinAccountViewController.swift | 3 +++ iOS/Account/LocalAccountViewController.swift | 4 ++++ iOS/Settings/AddAccountViewController.swift | 12 +++++++++++- 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/iOS/Account/FeedWranglerAccountViewController.swift b/iOS/Account/FeedWranglerAccountViewController.swift index 5fa5d86e2..b6c297df8 100644 --- a/iOS/Account/FeedWranglerAccountViewController.swift +++ b/iOS/Account/FeedWranglerAccountViewController.swift @@ -20,6 +20,7 @@ class FeedWranglerAccountViewController: UITableViewController { @IBOutlet weak var actionButton: UIButton! weak var account: Account? + weak var delegate: AddAccountDismissDelegate? override func viewDidLoad() { super.viewDidLoad() @@ -58,6 +59,7 @@ class FeedWranglerAccountViewController: UITableViewController { @IBAction func cancel(_ sender: Any) { dismiss(animated: true, completion: nil) + delegate?.dismiss() } @IBAction func showHidePassword(_ sender: Any) { @@ -118,7 +120,9 @@ class FeedWranglerAccountViewController: UITableViewController { } } - self.dismiss(animated: true, completion: nil) + self.dismiss(animated: true, completion: nil) + self.delegate?.dismiss() + } catch { self.showError(NSLocalizedString("Keychain error while storing credentials.", comment: "Credentials Error")) } diff --git a/iOS/Account/FeedbinAccountViewController.swift b/iOS/Account/FeedbinAccountViewController.swift index d51350710..df6110b64 100644 --- a/iOS/Account/FeedbinAccountViewController.swift +++ b/iOS/Account/FeedbinAccountViewController.swift @@ -20,6 +20,7 @@ class FeedbinAccountViewController: UITableViewController { @IBOutlet weak var actionButton: UIButton! weak var account: Account? + weak var delegate: AddAccountDismissDelegate? override func viewDidLoad() { super.viewDidLoad() @@ -59,6 +60,7 @@ class FeedbinAccountViewController: UITableViewController { @IBAction func cancel(_ sender: Any) { dismiss(animated: true, completion: nil) + delegate?.dismiss() } @IBAction func showHidePassword(_ sender: Any) { @@ -116,6 +118,7 @@ class FeedbinAccountViewController: UITableViewController { } self.dismiss(animated: true, completion: nil) + self.delegate?.dismiss() } catch { self.showError(NSLocalizedString("Keychain error while storing credentials.", comment: "Credentials Error")) } diff --git a/iOS/Account/LocalAccountViewController.swift b/iOS/Account/LocalAccountViewController.swift index 85d338f13..be0c1596d 100644 --- a/iOS/Account/LocalAccountViewController.swift +++ b/iOS/Account/LocalAccountViewController.swift @@ -12,6 +12,8 @@ import Account class LocalAccountViewController: UITableViewController { @IBOutlet weak var nameTextField: UITextField! + + weak var delegate: AddAccountDismissDelegate? override func viewDidLoad() { super.viewDidLoad() @@ -23,12 +25,14 @@ class LocalAccountViewController: UITableViewController { @IBAction func cancel(_ sender: Any) { dismiss(animated: true, completion: nil) + delegate?.dismiss() } @IBAction func add(_ sender: Any) { let account = AccountManager.shared.createAccount(type: .onMyMac) account.name = nameTextField.text dismiss(animated: true, completion: nil) + delegate?.dismiss() } override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { diff --git a/iOS/Settings/AddAccountViewController.swift b/iOS/Settings/AddAccountViewController.swift index e2c171ed3..db94f78df 100644 --- a/iOS/Settings/AddAccountViewController.swift +++ b/iOS/Settings/AddAccountViewController.swift @@ -10,7 +10,11 @@ import Account import UIKit import RSCore -class AddAccountViewController: UITableViewController { +protocol AddAccountDismissDelegate: UIViewController { + func dismiss() +} + +class AddAccountViewController: UITableViewController, AddAccountDismissDelegate { @IBOutlet private weak var localAccountImageView: UIImageView! @IBOutlet private weak var localAccountNameLabel: UILabel! @@ -33,10 +37,14 @@ class AddAccountViewController: UITableViewController { case 0: let navController = UIStoryboard.account.instantiateViewController(withIdentifier: "AddLocalAccountNavigationViewController") as! UINavigationController navController.modalPresentationStyle = .currentContext + let addViewController = navController.topViewController as! LocalAccountViewController + addViewController.delegate = self present(navController, animated: true) case 1: let navController = UIStoryboard.account.instantiateViewController(withIdentifier: "FeedbinAccountNavigationViewController") as! UINavigationController navController.modalPresentationStyle = .currentContext + let addViewController = navController.topViewController as! FeedbinAccountViewController + addViewController.delegate = self present(navController, animated: true) case 2: let addAccount = OAuthAccountAuthorizationOperation(accountType: .feedly) @@ -46,6 +54,8 @@ class AddAccountViewController: UITableViewController { case 3: let navController = UIStoryboard.account.instantiateViewController(withIdentifier: "FeedWranglerAccountNavigationViewController") as! UINavigationController navController.modalPresentationStyle = .currentContext + let addViewController = navController.topViewController as! FeedWranglerAccountViewController + addViewController.delegate = self present(navController, animated: true) default: break