From 9550b29a01aa4424009a0a114a8587270a4f0484 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Mon, 6 Jan 2020 18:32:17 -0700 Subject: [PATCH] Move filter button to bottom left. Issues #1525 and #1527 --- iOS/Base.lproj/LaunchScreenPad.storyboard | 2 +- iOS/Base.lproj/LaunchScreenPhone.storyboard | 2 +- iOS/Base.lproj/Main.storyboard | 23 ++++++++----------- iOS/MasterFeed/MasterFeedViewController.swift | 15 +++++++----- 4 files changed, 20 insertions(+), 22 deletions(-) diff --git a/iOS/Base.lproj/LaunchScreenPad.storyboard b/iOS/Base.lproj/LaunchScreenPad.storyboard index edb676e06..da3b37910 100644 --- a/iOS/Base.lproj/LaunchScreenPad.storyboard +++ b/iOS/Base.lproj/LaunchScreenPad.storyboard @@ -65,12 +65,12 @@ + - diff --git a/iOS/Base.lproj/LaunchScreenPhone.storyboard b/iOS/Base.lproj/LaunchScreenPhone.storyboard index 6ac462068..e2fb7fa5c 100644 --- a/iOS/Base.lproj/LaunchScreenPhone.storyboard +++ b/iOS/Base.lproj/LaunchScreenPhone.storyboard @@ -65,12 +65,12 @@ + - diff --git a/iOS/Base.lproj/Main.storyboard b/iOS/Base.lproj/Main.storyboard index e49f78bd6..5f91ef60a 100644 --- a/iOS/Base.lproj/Main.storyboard +++ b/iOS/Base.lproj/Main.storyboard @@ -119,12 +119,12 @@ - + - + - + @@ -139,9 +139,12 @@ - + + + + - + @@ -192,17 +195,9 @@ - - - - - - - - @@ -373,7 +368,7 @@ - + diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index 9987eef5d..ad6fd9c35 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -14,7 +14,7 @@ import RSTree class MasterFeedViewController: UITableViewController, UndoableCommandRunner { - @IBOutlet weak var filterButton: UIBarButtonItem! + private var filterButton: UIBarButtonItem! private var refreshProgressView: RefreshProgressView? private var addNewItemButton: UIBarButtonItem! @@ -400,7 +400,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner { coordinator.showSettings() } - @IBAction func toggleFilter(_ sender: Any) { + @objc func toggleFilter(_ sender: Any) { if coordinator.isReadFeedsFiltered { filterButton.image = AppAssets.filterInactiveImage coordinator.showAllFeeds() @@ -410,7 +410,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner { } } - @IBAction func add(_ sender: UIBarButtonItem) { + @objc func add(_ sender: UIBarButtonItem) { coordinator.showAdd(.feed) } @@ -669,12 +669,15 @@ private extension MasterFeedViewController { self.refreshProgressView = refreshProgressView + filterButton = UIBarButtonItem(image: AppAssets.filterInactiveImage, style: .plain, target: self, action: #selector(toggleFilter(_:))) + filterButton.accLabelText = NSLocalizedString("Filter Feeds", comment: "Filter Feeds") let spaceItemButton1 = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil) let refreshProgressItemButton = UIBarButtonItem(customView: refreshProgressView) let spaceItemButton2 = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil) addNewItemButton = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(add(_:))) - setToolbarItems([spaceItemButton1, + setToolbarItems([filterButton, + spaceItemButton1, refreshProgressItemButton, spaceItemButton2, addNewItemButton @@ -683,9 +686,9 @@ private extension MasterFeedViewController { func updateUI() { if coordinator.isReadFeedsFiltered { - filterButton.image = AppAssets.filterActiveImage + filterButton?.image = AppAssets.filterActiveImage } else { - filterButton.image = AppAssets.filterInactiveImage + filterButton?.image = AppAssets.filterInactiveImage } refreshProgressView?.updateRefreshLabel() addNewItemButton?.isEnabled = !AccountManager.shared.activeAccounts.isEmpty