diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index 1a326e674..4102a510f 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -84,6 +84,8 @@ 516A093723609A3600EAE89B /* SettingsAccountTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 516A091D23609A3600EAE89B /* SettingsAccountTableViewCell.xib */; }; 516A09392360A2AE00EAE89B /* SettingsAccountTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 516A09382360A2AE00EAE89B /* SettingsAccountTableViewCell.swift */; }; 516A093B2360A4A000EAE89B /* SettingsTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 516A093A2360A4A000EAE89B /* SettingsTableViewCell.xib */; }; + 516A09402361240900EAE89B /* Account.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 516A093F2361240900EAE89B /* Account.storyboard */; }; + 516A09422361248000EAE89B /* Inspector.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 516A09412361248000EAE89B /* Inspector.storyboard */; }; 51707439232AA97100A461A3 /* ShareFolderPickerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51707438232AA97100A461A3 /* ShareFolderPickerController.swift */; }; 5170743A232AABFC00A461A3 /* FlattenedAccountFolderPickerData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51C452812265093600C03939 /* FlattenedAccountFolderPickerData.swift */; }; 517630042336215100E15FFF /* main.js in Resources */ = {isa = PBXBuildFile; fileRef = 517630032336215100E15FFF /* main.js */; }; @@ -109,9 +111,9 @@ 519D740623243CC0008BB345 /* RefreshInterval-Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 519D740523243CC0008BB345 /* RefreshInterval-Extensions.swift */; }; 519E743D22C663F900A78E47 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 519E743422C663F900A78E47 /* SceneDelegate.swift */; }; 51A16997235E10D700EB091F /* RefreshIntervalViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A1698D235E10D600EB091F /* RefreshIntervalViewController.swift */; }; - 51A16999235E10D700EB091F /* AddLocalAccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A1698F235E10D600EB091F /* AddLocalAccountViewController.swift */; }; + 51A16999235E10D700EB091F /* LocalAccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A1698F235E10D600EB091F /* LocalAccountViewController.swift */; }; 51A1699A235E10D700EB091F /* Settings.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 51A16990235E10D600EB091F /* Settings.storyboard */; }; - 51A1699B235E10D700EB091F /* DetailAccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A16991235E10D600EB091F /* DetailAccountViewController.swift */; }; + 51A1699B235E10D700EB091F /* AccountInspectorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A16991235E10D600EB091F /* AccountInspectorViewController.swift */; }; 51A1699C235E10D700EB091F /* AddAccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A16992235E10D600EB091F /* AddAccountViewController.swift */; }; 51A1699D235E10D700EB091F /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A16993235E10D600EB091F /* SettingsViewController.swift */; }; 51A1699F235E10D700EB091F /* AboutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A16995235E10D600EB091F /* AboutViewController.swift */; }; @@ -1242,6 +1244,8 @@ 516A091D23609A3600EAE89B /* SettingsAccountTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SettingsAccountTableViewCell.xib; sourceTree = ""; }; 516A09382360A2AE00EAE89B /* SettingsAccountTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsAccountTableViewCell.swift; sourceTree = ""; }; 516A093A2360A4A000EAE89B /* SettingsTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SettingsTableViewCell.xib; sourceTree = ""; }; + 516A093F2361240900EAE89B /* Account.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Account.storyboard; sourceTree = ""; }; + 516A09412361248000EAE89B /* Inspector.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Inspector.storyboard; sourceTree = ""; }; 51707438232AA97100A461A3 /* ShareFolderPickerController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareFolderPickerController.swift; sourceTree = ""; }; 517630032336215100E15FFF /* main.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = main.js; sourceTree = ""; }; 517630222336657E00E15FFF /* ArticleViewControllerWebViewProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleViewControllerWebViewProvider.swift; sourceTree = ""; }; @@ -1263,9 +1267,9 @@ 519D740523243CC0008BB345 /* RefreshInterval-Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RefreshInterval-Extensions.swift"; sourceTree = ""; }; 519E743422C663F900A78E47 /* SceneDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 51A1698D235E10D600EB091F /* RefreshIntervalViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RefreshIntervalViewController.swift; sourceTree = ""; }; - 51A1698F235E10D600EB091F /* AddLocalAccountViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddLocalAccountViewController.swift; sourceTree = ""; }; + 51A1698F235E10D600EB091F /* LocalAccountViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LocalAccountViewController.swift; sourceTree = ""; }; 51A16990235E10D600EB091F /* Settings.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Settings.storyboard; sourceTree = ""; }; - 51A16991235E10D600EB091F /* DetailAccountViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DetailAccountViewController.swift; sourceTree = ""; }; + 51A16991235E10D600EB091F /* AccountInspectorViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountInspectorViewController.swift; sourceTree = ""; }; 51A16992235E10D600EB091F /* AddAccountViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddAccountViewController.swift; sourceTree = ""; }; 51A16993235E10D600EB091F /* SettingsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = ""; }; 51A16995235E10D600EB091F /* AboutViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AboutViewController.swift; sourceTree = ""; }; @@ -1668,6 +1672,8 @@ 5123DB95233EC69300282CC9 /* Inspector */ = { isa = PBXGroup; children = ( + 516A09412361248000EAE89B /* Inspector.storyboard */, + 51A16991235E10D600EB091F /* AccountInspectorViewController.swift */, 5123DB9E233EC6FD00282CC9 /* FeedInspectorView.swift */, ); path = Inspector; @@ -1750,6 +1756,16 @@ name = Products; sourceTree = ""; }; + 516A093E236123A800EAE89B /* Account */ = { + isa = PBXGroup; + children = ( + 516A093F2361240900EAE89B /* Account.storyboard */, + 51A1698F235E10D600EB091F /* LocalAccountViewController.swift */, + 51A16996235E10D700EB091F /* FeedbinAccountViewController.swift */, + ); + path = Account; + sourceTree = ""; + }; 5183CCDB226F1EEB0010922C /* Progress */ = { isa = PBXGroup; children = ( @@ -1775,9 +1791,6 @@ 51A16990235E10D600EB091F /* Settings.storyboard */, 51A16995235E10D600EB091F /* AboutViewController.swift */, 51A16992235E10D600EB091F /* AddAccountViewController.swift */, - 51A1698F235E10D600EB091F /* AddLocalAccountViewController.swift */, - 51A16991235E10D600EB091F /* DetailAccountViewController.swift */, - 51A16996235E10D700EB091F /* FeedbinAccountViewController.swift */, 51A1698D235E10D600EB091F /* RefreshIntervalViewController.swift */, 516A09382360A2AE00EAE89B /* SettingsAccountTableViewCell.swift */, 516A091D23609A3600EAE89B /* SettingsAccountTableViewCell.xib */, @@ -2521,6 +2534,7 @@ 51C4525D226508F600C03939 /* MasterFeed */, 51C4526D2265091600C03939 /* MasterTimeline */, 51C4527D2265092C00C03939 /* Article */, + 516A093E236123A800EAE89B /* Account */, 51C452802265093600C03939 /* Add */, 5123DB95233EC69300282CC9 /* Inspector */, 513145F9235A55A700387FDC /* Intents */, @@ -3375,11 +3389,13 @@ 51BB7C312335ACDE008E8144 /* page.html in Resources */, 516A093723609A3600EAE89B /* SettingsAccountTableViewCell.xib in Resources */, 51F85BF32272531500C787DC /* Dedication.rtf in Resources */, + 516A09422361248000EAE89B /* Inspector.storyboard in Resources */, 84C9FCA42262A1B800D921D6 /* LaunchScreenPhone.storyboard in Resources */, 51F85BEB22724CB600C787DC /* About.rtf in Resources */, 51F85BED227251DF00C787DC /* Acknowledgments.rtf in Resources */, 516A093B2360A4A000EAE89B /* SettingsTableViewCell.xib in Resources */, 511D43D1231FA62800FB1562 /* SidebarKeyboardShortcuts.plist in Resources */, + 516A09402361240900EAE89B /* Account.storyboard in Resources */, 51C452AB22650DC600C03939 /* template.html in Resources */, 51F85BF12272524100C787DC /* Credits.rtf in Resources */, 84A3EE61223B667F00557320 /* DefaultFeeds.opml in Resources */, @@ -3880,7 +3896,7 @@ 516A09392360A2AE00EAE89B /* SettingsAccountTableViewCell.swift in Sources */, 51D5948722668EFA00DFC836 /* MarkStatusCommand.swift in Sources */, 51A1699C235E10D700EB091F /* AddAccountViewController.swift in Sources */, - 51A16999235E10D700EB091F /* AddLocalAccountViewController.swift in Sources */, + 51A16999235E10D700EB091F /* LocalAccountViewController.swift in Sources */, 514B7C8323205EFB00BAC947 /* RootSplitViewController.swift in Sources */, 51FA73A52332BE110090D516 /* ArticleExtractor.swift in Sources */, 51314704235C41FC00387FDC /* Intents.intentdefinition in Sources */, @@ -3940,7 +3956,7 @@ 51F85BFB2275D85000C787DC /* Array-Extensions.swift in Sources */, 51C452AC22650FD200C03939 /* AppNotifications.swift in Sources */, 51EF0F7E2277A57D0050506E /* MasterTimelineAccessibilityCellLayout.swift in Sources */, - 51A1699B235E10D700EB091F /* DetailAccountViewController.swift in Sources */, + 51A1699B235E10D700EB091F /* AccountInspectorViewController.swift in Sources */, 51C452762265091600C03939 /* MasterTimelineViewController.swift in Sources */, 5183CCE9226F68D90010922C /* AccountRefreshTimer.swift in Sources */, 51C452882265093600C03939 /* AddFeedViewController.swift in Sources */, diff --git a/iOS/Account/Account.storyboard b/iOS/Account/Account.storyboard new file mode 100644 index 000000000..b5f05cc65 --- /dev/null +++ b/iOS/Account/Account.storyboard @@ -0,0 +1,260 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iOS/Settings/FeedbinAccountViewController.swift b/iOS/Account/FeedbinAccountViewController.swift similarity index 100% rename from iOS/Settings/FeedbinAccountViewController.swift rename to iOS/Account/FeedbinAccountViewController.swift diff --git a/iOS/Settings/AddLocalAccountViewController.swift b/iOS/Account/LocalAccountViewController.swift similarity index 83% rename from iOS/Settings/AddLocalAccountViewController.swift rename to iOS/Account/LocalAccountViewController.swift index b9c092336..5abf1f436 100644 --- a/iOS/Settings/AddLocalAccountViewController.swift +++ b/iOS/Account/LocalAccountViewController.swift @@ -1,5 +1,5 @@ // -// AddLocalAccountViewController.swift +// LocalAccountViewController.swift // NetNewsWire-iOS // // Created by Maurice Parker on 5/19/19. @@ -9,7 +9,7 @@ import UIKit import Account -class AddLocalAccountViewController: UITableViewController { +class LocalAccountViewController: UITableViewController { @IBOutlet weak var nameTextField: UITextField! @@ -35,7 +35,7 @@ class AddLocalAccountViewController: UITableViewController { } -extension AddLocalAccountViewController: UITextFieldDelegate { +extension LocalAccountViewController: UITextFieldDelegate { func textFieldShouldReturn(_ textField: UITextField) -> Bool { textField.resignFirstResponder() diff --git a/iOS/Settings/DetailAccountViewController.swift b/iOS/Inspector/AccountInspectorViewController.swift similarity index 81% rename from iOS/Settings/DetailAccountViewController.swift rename to iOS/Inspector/AccountInspectorViewController.swift index 40dd698ee..c08beb28c 100644 --- a/iOS/Settings/DetailAccountViewController.swift +++ b/iOS/Inspector/AccountInspectorViewController.swift @@ -1,5 +1,5 @@ // -// DetailAccountViewController.swift +// AccountInspectorViewController.swift // NetNewsWire-iOS // // Created by Maurice Parker on 5/17/19. @@ -9,11 +9,14 @@ import UIKit import Account -class DetailAccountViewController: UITableViewController { +class AccountInspectorViewController: UITableViewController { + + static let preferredContentSizeForFormSheetDisplay = CGSize(width: 460.0, height: 400.0) @IBOutlet weak var nameTextField: UITextField! @IBOutlet weak var activeSwitch: UISwitch! + var isModal = false weak var account: Account? override func viewDidLoad() { @@ -25,18 +28,28 @@ class DetailAccountViewController: UITableViewController { nameTextField.text = account.name nameTextField.delegate = self activeSwitch.isOn = account.isActive - } - + + if isModal { + let doneBarButtonItem = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(done)) + navigationItem.leftBarButtonItem = doneBarButtonItem + } + + } + override func viewWillDisappear(_ animated: Bool) { account?.name = nameTextField.text account?.isActive = activeSwitch.isOn } + + @objc func done() { + dismiss(animated: true) + } @IBAction func credentials(_ sender: Any) { guard let account = account else { return } switch account.type { case .feedbin: - let navController = UIStoryboard.settings.instantiateViewController(withIdentifier: "FeedbinAccountNavigationViewController") as! UINavigationController + let navController = UIStoryboard.account.instantiateViewController(withIdentifier: "FeedbinAccountNavigationViewController") as! UINavigationController let addViewController = navController.topViewController as! FeedbinAccountViewController addViewController.account = account navController.modalPresentationStyle = .currentContext @@ -68,7 +81,7 @@ class DetailAccountViewController: UITableViewController { } -extension DetailAccountViewController { +extension AccountInspectorViewController { override func numberOfSections(in tableView: UITableView) -> Int { guard let account = account else { return 0 } @@ -107,7 +120,7 @@ extension DetailAccountViewController { } -extension DetailAccountViewController: UITextFieldDelegate { +extension AccountInspectorViewController: UITextFieldDelegate { func textFieldShouldReturn(_ textField: UITextField) -> Bool { textField.resignFirstResponder() diff --git a/iOS/Inspector/Inspector.storyboard b/iOS/Inspector/Inspector.storyboard new file mode 100644 index 000000000..e87fb1179 --- /dev/null +++ b/iOS/Inspector/Inspector.storyboard @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index 039e5b036..e9c0d4d65 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -182,6 +182,10 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner { let tap = UITapGestureRecognizer(target: self, action:#selector(self.toggleSectionHeader(_:))) headerView.addGestureRecognizer(tap) + if section != 0 { + headerView.addInteraction(UIContextMenuInteraction(delegate: self)) + } + return headerView } @@ -531,6 +535,26 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner { } +// MARK: UIContextMenuInteractionDelegate + +extension MasterFeedViewController: UIContextMenuInteractionDelegate { + func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configurationForMenuAtLocation location: CGPoint) -> UIContextMenuConfiguration? { + + guard let sectionIndex = interaction.view?.tag, + let sectionNode = coordinator.rootNode.childAtIndex(sectionIndex), + let account = sectionNode.representedObject as? Account, + let headerView = interaction.view as? MasterFeedTableViewSectionHeader + else { + return nil + } + + return UIContextMenuConfiguration(identifier: nil, previewProvider: nil) { suggestedActions in + let accountInfoAction = self.getAccountInfoAction(account: account) + return UIMenu(title: "", children: [accountInfoAction]) + } + } +} + // MARK: MasterTableViewCellDelegate extension MasterFeedViewController: MasterFeedTableViewCellDelegate { @@ -846,6 +870,14 @@ private extension MasterFeedViewController { return action } + func getAccountInfoAction(account: Account) -> UIAction { + let title = NSLocalizedString("Get Info", comment: "Get Info") + let action = UIAction(title: title, image: AppAssets.infoImage) { [weak self] action in + self?.coordinator.showAccountInspector(for: account) + } + return action + } + func getInfoAlertAction(indexPath: IndexPath, completionHandler: @escaping (Bool) -> Void) -> UIAlertAction? { guard let node = dataSource.itemIdentifier(for: indexPath), let feed = node.representedObject as? Feed else { return nil diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index e97a63e19..bfd636ccd 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -793,6 +793,17 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider { rootSplitViewController.present(settingsNavController, animated: true) } + func showAccountInspector(for account: Account) { + let accountInspectorNavController = + UIStoryboard.inspector.instantiateViewController(identifier: "AccountInspectorNavigationViewController") as! UINavigationController + let accountInspectorController = accountInspectorNavController.topViewController as! AccountInspectorViewController + accountInspectorNavController.modalPresentationStyle = .formSheet + accountInspectorNavController.preferredContentSize = AccountInspectorViewController.preferredContentSizeForFormSheetDisplay + accountInspectorController.isModal = true + accountInspectorController.account = account + rootSplitViewController.present(accountInspectorNavController, animated: true) + } + func showFeedInspector() { guard let feed = timelineFetcher as? Feed else { return diff --git a/iOS/Settings/AddAccountViewController.swift b/iOS/Settings/AddAccountViewController.swift index e0a18a590..f53d46a55 100644 --- a/iOS/Settings/AddAccountViewController.swift +++ b/iOS/Settings/AddAccountViewController.swift @@ -27,13 +27,13 @@ class AddAccountViewController: UITableViewController, AddAccountDismissDelegate override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { switch indexPath.row { case 0: - let navController = UIStoryboard.settings.instantiateViewController(withIdentifier: "AddLocalAccountNavigationViewController") as! UINavigationController + let navController = UIStoryboard.account.instantiateViewController(withIdentifier: "AddLocalAccountNavigationViewController") as! UINavigationController navController.modalPresentationStyle = .currentContext - let addViewController = navController.topViewController as! AddLocalAccountViewController + let addViewController = navController.topViewController as! LocalAccountViewController addViewController.delegate = self present(navController, animated: true) case 1: - let navController = UIStoryboard.settings.instantiateViewController(withIdentifier: "FeedbinAccountNavigationViewController") as! UINavigationController + let navController = UIStoryboard.account.instantiateViewController(withIdentifier: "FeedbinAccountNavigationViewController") as! UINavigationController navController.modalPresentationStyle = .currentContext let addViewController = navController.topViewController as! FeedbinAccountViewController addViewController.delegate = self diff --git a/iOS/Settings/Settings.storyboard b/iOS/Settings/Settings.storyboard index 5aa060786..3afc9391c 100644 --- a/iOS/Settings/Settings.storyboard +++ b/iOS/Settings/Settings.storyboard @@ -359,155 +359,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -601,257 +453,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -881,7 +483,7 @@ - + @@ -1061,7 +663,7 @@ - + @@ -1082,6 +684,6 @@ - + diff --git a/iOS/Settings/SettingsViewController.swift b/iOS/Settings/SettingsViewController.swift index be8f7683c..cab947682 100644 --- a/iOS/Settings/SettingsViewController.swift +++ b/iOS/Settings/SettingsViewController.swift @@ -32,6 +32,7 @@ class SettingsViewController: UITableViewController { NotificationCenter.default.addObserver(self, selector: #selector(accountsDidChange), name: .UserDidAddAccount, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(accountsDidChange), name: .UserDidDeleteAccount, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(displayNameDidChange), name: .DisplayNameDidChange, object: nil) tableView.register(UINib(nibName: "SettingsAccountTableViewCell", bundle: nil), forCellReuseIdentifier: "SettingsAccountTableViewCell") tableView.register(UINib(nibName: "SettingsTableViewCell", bundle: nil), forCellReuseIdentifier: "SettingsTableViewCell") @@ -130,7 +131,7 @@ class SettingsViewController: UITableViewController { let controller = UIStoryboard.settings.instantiateController(ofType: AddAccountViewController.self) self.navigationController?.pushViewController(controller, animated: true) } else { - let controller = UIStoryboard.settings.instantiateController(ofType: DetailAccountViewController.self) + let controller = UIStoryboard.inspector.instantiateController(ofType: AccountInspectorViewController.self) controller.account = sortedAccounts[indexPath.row] self.navigationController?.pushViewController(controller, animated: true) } @@ -251,6 +252,10 @@ class SettingsViewController: UITableViewController { tableView.reloadData() } + @objc func displayNameDidChange() { + tableView.reloadData() + } + } // MARK: OPML Document Picker diff --git a/iOS/UIKit Extensions/UIStoryboard-Extensions.swift b/iOS/UIKit Extensions/UIStoryboard-Extensions.swift index 4d309a729..ef48e061d 100644 --- a/iOS/UIKit Extensions/UIStoryboard-Extensions.swift +++ b/iOS/UIKit Extensions/UIStoryboard-Extensions.swift @@ -24,6 +24,14 @@ extension UIStoryboard { return UIStoryboard(name: "Settings", bundle: nil) } + static var inspector: UIStoryboard { + return UIStoryboard(name: "Inspector", bundle: nil) + } + + static var account: UIStoryboard { + return UIStoryboard(name: "Account", bundle: nil) + } + func instantiateController(ofType type: T.Type = T.self) -> T where T: UIViewController { let storyboardId = String(describing: type)