From f36b5a7970a0cdba2f60c57f596e860eb8ad645f Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Fri, 17 May 2019 17:25:47 -0500 Subject: [PATCH] Add account detail so that we can edit account name and account active on iOS. --- NetNewsWire.xcodeproj/project.pbxproj | 6 +- iOS/NavigationStateController.swift | 11 ++- .../DetailAccountViewController.swift | 33 +++++++ iOS/Settings/Settings.storyboard | 95 ++++++++++++++++++- iOS/Settings/SettingsViewController.swift | 10 +- 5 files changed, 148 insertions(+), 7 deletions(-) create mode 100644 iOS/Settings/DetailAccountViewController.swift diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index 34be8dd24..8c5e32a98 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -26,6 +26,7 @@ 5144EA43227A380F00D19003 /* ExportOPMLWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5144EA42227A380F00D19003 /* ExportOPMLWindowController.swift */; }; 5144EA51227B8E4500D19003 /* AccountsFeedbinWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5144EA4F227B8E4500D19003 /* AccountsFeedbinWindowController.swift */; }; 5144EA52227B8E4500D19003 /* AccountsFeedbin.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5144EA50227B8E4500D19003 /* AccountsFeedbin.xib */; }; + 51543685228F6753005E1CDF /* DetailAccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51543684228F6753005E1CDF /* DetailAccountViewController.swift */; }; 51554C24228B71910055115A /* SyncDatabase.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 51554C01228B6EB50055115A /* SyncDatabase.framework */; }; 51554C25228B71910055115A /* SyncDatabase.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 51554C01228B6EB50055115A /* SyncDatabase.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 51554C30228B71A10055115A /* SyncDatabase.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 51554C01228B6EB50055115A /* SyncDatabase.framework */; }; @@ -673,6 +674,7 @@ 5144EA42227A380F00D19003 /* ExportOPMLWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExportOPMLWindowController.swift; sourceTree = ""; }; 5144EA4F227B8E4500D19003 /* AccountsFeedbinWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountsFeedbinWindowController.swift; sourceTree = ""; }; 5144EA50227B8E4500D19003 /* AccountsFeedbin.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AccountsFeedbin.xib; sourceTree = ""; }; + 51543684228F6753005E1CDF /* DetailAccountViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailAccountViewController.swift; sourceTree = ""; }; 51554BFC228B6EB50055115A /* SyncDatabase.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SyncDatabase.xcodeproj; path = Frameworks/SyncDatabase/SyncDatabase.xcodeproj; sourceTree = SOURCE_ROOT; }; 5183CCCF226E1E880010922C /* NonIntrinsicLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NonIntrinsicLabel.swift; sourceTree = ""; }; 5183CCD9226E31A50010922C /* NonIntrinsicImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NonIntrinsicImageView.swift; sourceTree = ""; }; @@ -1037,10 +1039,11 @@ 5183CCEC22711DCE0010922C /* Settings.storyboard */, 51E595AA228DF94C00FCC42B /* SettingsTableViewCell.xib */, 5183CCEE227125970010922C /* SettingsViewController.swift */, + 51E595AC228E1C2100FCC42B /* AddAccountViewController.swift */, 51F85BE6227245FC00C787DC /* AboutViewController.swift */, + 51543684228F6753005E1CDF /* DetailAccountViewController.swift */, 51F85BDB2272162F00C787DC /* RefreshIntervalViewController.swift */, 51EF0F7B2277919E0050506E /* TimelineNumberOfLinesViewController.swift */, - 51E595AC228E1C2100FCC42B /* AddAccountViewController.swift */, ); path = Settings; sourceTree = ""; @@ -2347,6 +2350,7 @@ 51C4526A226508F600C03939 /* MasterFeedTableViewCellLayout.swift in Sources */, 51C452AE2265104D00C03939 /* TimelineStringFormatter.swift in Sources */, 512E08E62268800D00BDCFDD /* FolderTreeControllerDelegate.swift in Sources */, + 51543685228F6753005E1CDF /* DetailAccountViewController.swift in Sources */, 51C4529922650A0000C03939 /* ArticleStylesManager.swift in Sources */, 51EF0F802277A8330050506E /* MasterTimelineCellLayout.swift in Sources */, 51F85BF722749FA100C787DC /* UIFont-Extensions.swift in Sources */, diff --git a/iOS/NavigationStateController.swift b/iOS/NavigationStateController.swift index 6b231be88..25abc5d82 100644 --- a/iOS/NavigationStateController.swift +++ b/iOS/NavigationStateController.swift @@ -177,7 +177,8 @@ class NavigationStateController { NotificationCenter.default.addObserver(self, selector: #selector(containerChildrenDidChange(_:)), name: .ChildrenDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(batchUpdateDidPerform(_:)), name: .BatchUpdateDidPerform, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(displayNameDidChange(_:)), name: .DisplayNameDidChange, object: nil) - + NotificationCenter.default.addObserver(self, selector: #selector(accountStateDidChange(_:)), name: .AccountStateDidChange, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(userDefaultsDidChange(_:)), name: UserDefaults.didChangeNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(accountDidDownloadArticles(_:)), name: .AccountDidDownloadArticles, object: nil) @@ -197,6 +198,10 @@ class NavigationStateController { rebuildBackingStores() } + @objc func accountStateDidChange(_ note: Notification) { + rebuildBackingStores() + } + @objc func userDefaultsDidChange(_ note: Notification) { self.sortDirection = AppDefaults.timelineSortDirection } @@ -230,6 +235,8 @@ class NavigationStateController { func rebuildShadowTable() { + shadowTable = [[Node]]() + for i in 0.. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -401,7 +494,7 @@ - + diff --git a/iOS/Settings/SettingsViewController.swift b/iOS/Settings/SettingsViewController.swift index 93691ff39..2e1664f1a 100644 --- a/iOS/Settings/SettingsViewController.swift +++ b/iOS/Settings/SettingsViewController.swift @@ -48,6 +48,8 @@ class SettingsViewController: UITableViewController { buildLabel.translatesAutoresizingMaskIntoConstraints = false tableView.tableFooterView = buildLabel + tableView.reloadData() + } // MARK: UITableView @@ -96,10 +98,12 @@ class SettingsViewController: UITableViewController { case 0: let sortedAccounts = AccountManager.shared.sortedAccounts if indexPath.row == sortedAccounts.count { - let timeline = UIStoryboard.settings.instantiateController(ofType: AddAccountViewController.self) - self.navigationController?.pushViewController(timeline, animated: true) + let controller = UIStoryboard.settings.instantiateController(ofType: AddAccountViewController.self) + self.navigationController?.pushViewController(controller, animated: true) } else { - // TODO + let controller = UIStoryboard.settings.instantiateController(ofType: DetailAccountViewController.self) + controller.account = sortedAccounts[indexPath.row] + self.navigationController?.pushViewController(controller, animated: true) } case 1: switch indexPath.row {