From 48db3d6d85ddffc1bf753f3ce28ce34208684245 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Mon, 21 Oct 2019 16:42:58 -0500 Subject: [PATCH] Add group by feed setting --- iOS/Settings/Settings.storyboard | 55 ++++++++++++++++++----- iOS/Settings/SettingsViewController.swift | 19 +++++++- 2 files changed, 60 insertions(+), 14 deletions(-) diff --git a/iOS/Settings/Settings.storyboard b/iOS/Settings/Settings.storyboard index 3cafee91b..2c71e6cc9 100644 --- a/iOS/Settings/Settings.storyboard +++ b/iOS/Settings/Settings.storyboard @@ -69,9 +69,39 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -98,7 +128,7 @@ - + @@ -122,7 +152,7 @@ - + @@ -139,7 +169,7 @@ - + @@ -160,7 +190,7 @@ - + @@ -177,7 +207,7 @@ - + @@ -194,7 +224,7 @@ - + @@ -211,7 +241,7 @@ - + @@ -228,7 +258,7 @@ - + @@ -245,7 +275,7 @@ - + @@ -277,6 +307,7 @@ + @@ -440,7 +471,7 @@ - + @@ -555,7 +586,7 @@ - + diff --git a/iOS/Settings/SettingsViewController.swift b/iOS/Settings/SettingsViewController.swift index ebd7d52d9..857251d37 100644 --- a/iOS/Settings/SettingsViewController.swift +++ b/iOS/Settings/SettingsViewController.swift @@ -15,6 +15,7 @@ class SettingsViewController: UITableViewController { @IBOutlet weak var refreshIntervalLabel: UILabel! @IBOutlet weak var timelineSortOrderSwitch: UISwitch! + @IBOutlet weak var groupByFeedSwitch: UISwitch! @IBOutlet weak var timelineNumberOfLinesLabel: UILabel! weak var presentingParentController: UIViewController? @@ -37,6 +38,12 @@ class SettingsViewController: UITableViewController { timelineSortOrderSwitch.isOn = false } + if AppDefaults.timelineGroupByFeed { + groupByFeedSwitch.isOn = true + } else { + groupByFeedSwitch.isOn = false + } + refreshIntervalLabel.text = AppDefaults.refreshInterval.description() let numberOfLinesText = NSLocalizedString(" lines", comment: "Lines") @@ -109,7 +116,7 @@ class SettingsViewController: UITableViewController { self.navigationController?.pushViewController(controller, animated: true) } case 1: - if indexPath.row == 1 { + if indexPath.row == 2 { let timeline = UIStoryboard.settings.instantiateController(ofType: TimelineNumberOfLinesViewController.self) self.navigationController?.pushViewController(timeline, animated: true) } @@ -123,7 +130,7 @@ class SettingsViewController: UITableViewController { case 2: exportOPML() default: - print("export") + break } case 3: switch indexPath.row { @@ -192,6 +199,14 @@ class SettingsViewController: UITableViewController { } } + @IBAction func switchGroupByFeed(_ sender: Any) { + if groupByFeedSwitch.isOn { + AppDefaults.timelineGroupByFeed = true + } else { + AppDefaults.timelineGroupByFeed = false + } + } + @objc func contentSizeCategoryDidChange() { tableView.reloadData() }