diff --git a/iOS/AppDefaults.swift b/iOS/AppDefaults.swift
index 0942df915..f29b7d191 100644
--- a/iOS/AppDefaults.swift
+++ b/iOS/AppDefaults.swift
@@ -23,6 +23,7 @@ struct AppDefaults {
static let timelineNumberOfLines = "timelineNumberOfLines"
static let timelineIconSize = "timelineIconSize"
static let timelineSortDirection = "timelineSortDirection"
+ static let articleFullscreenEnabled = "articleFullscreenEnabled"
static let displayUndoAvailableTip = "displayUndoAvailableTip"
static let lastRefresh = "lastRefresh"
static let addWebFeedAccountID = "addWebFeedAccountID"
@@ -92,6 +93,15 @@ struct AppDefaults {
}
}
+ static var articleFullscreenEnabled: Bool {
+ get {
+ return bool(for: Key.articleFullscreenEnabled)
+ }
+ set {
+ setBool(for: Key.articleFullscreenEnabled, newValue)
+ }
+ }
+
static var displayUndoAvailableTip: Bool {
get {
return bool(for: Key.displayUndoAvailableTip)
@@ -135,6 +145,7 @@ struct AppDefaults {
Key.timelineNumberOfLines: 2,
Key.timelineIconSize: IconSize.medium.rawValue,
Key.timelineSortDirection: ComparisonResult.orderedDescending.rawValue,
+ Key.articleFullscreenEnabled: false,
Key.displayUndoAvailableTip: true]
AppDefaults.shared.register(defaults: defaults)
}
diff --git a/iOS/Article/ArticleViewController.swift b/iOS/Article/ArticleViewController.swift
index 47eabd5a8..fd400d9a2 100644
--- a/iOS/Article/ArticleViewController.swift
+++ b/iOS/Article/ArticleViewController.swift
@@ -135,6 +135,13 @@ class ArticleViewController: UIViewController {
}
+ override func viewWillAppear(_ animated: Bool) {
+ super.viewWillAppear(animated)
+ if AppDefaults.articleFullscreenEnabled {
+ hideBars()
+ }
+ }
+
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(true)
coordinator.isArticleViewControllerPending = false
@@ -484,6 +491,7 @@ private extension ArticleViewController {
func showBars() {
if traitCollection.userInterfaceIdiom == .phone && coordinator.isRootSplitCollapsed {
+ AppDefaults.articleFullscreenEnabled = false
coordinator.showStatusBar()
showNavigationViewConstraint.constant = 0
showToolbarViewConstraint.constant = 0
@@ -494,6 +502,7 @@ private extension ArticleViewController {
func hideBars() {
if traitCollection.userInterfaceIdiom == .phone && coordinator.isRootSplitCollapsed {
+ AppDefaults.articleFullscreenEnabled = true
coordinator.hideStatusBar()
showNavigationViewConstraint.constant = 44.0
showToolbarViewConstraint.constant = 44.0
diff --git a/iOS/Settings/Settings.storyboard b/iOS/Settings/Settings.storyboard
index 24d8aef6f..c81c9ed12 100644
--- a/iOS/Settings/Settings.storyboard
+++ b/iOS/Settings/Settings.storyboard
@@ -19,7 +19,7 @@
-
+
@@ -196,10 +196,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -216,7 +250,7 @@
-
+
@@ -233,7 +267,7 @@
-
+
@@ -250,7 +284,7 @@
-
+
@@ -267,7 +301,7 @@
-
+
@@ -284,7 +318,7 @@
-
+
@@ -301,7 +335,7 @@
-
+
@@ -334,6 +368,7 @@
+
diff --git a/iOS/Settings/SettingsViewController.swift b/iOS/Settings/SettingsViewController.swift
index 3c249e19b..cde10c3a2 100644
--- a/iOS/Settings/SettingsViewController.swift
+++ b/iOS/Settings/SettingsViewController.swift
@@ -17,6 +17,7 @@ class SettingsViewController: UITableViewController {
@IBOutlet weak var timelineSortOrderSwitch: UISwitch!
@IBOutlet weak var groupByFeedSwitch: UISwitch!
+ @IBOutlet weak var showFullscreenArticlesSwitch: UISwitch!
weak var presentingParentController: UIViewController?
@@ -50,6 +51,12 @@ class SettingsViewController: UITableViewController {
groupByFeedSwitch.isOn = false
}
+ if AppDefaults.articleFullscreenEnabled {
+ showFullscreenArticlesSwitch.isOn = true
+ } else {
+ showFullscreenArticlesSwitch.isOn = false
+ }
+
let buildLabel = NonIntrinsicLabel(frame: CGRect(x: 20.0, y: 0.0, width: 0.0, height: 0.0))
buildLabel.font = UIFont.systemFont(ofSize: 11.0)
buildLabel.textColor = UIColor.gray
@@ -71,24 +78,42 @@ class SettingsViewController: UITableViewController {
// MARK: UITableView
+ override func numberOfSections(in tableView: UITableView) -> Int {
+ var sections = super.numberOfSections(in: tableView)
+ if traitCollection.userInterfaceIdiom != .phone {
+ sections = sections - 1
+ }
+ return sections
+ }
+
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
- switch section {
+ var adjustedSection = section
+ if traitCollection.userInterfaceIdiom != .phone && section > 3 {
+ adjustedSection = adjustedSection + 1
+ }
+
+ switch adjustedSection {
case 1:
return AccountManager.shared.accounts.count + 1
case 2:
- let defaultNumberOfRows = super.tableView(tableView, numberOfRowsInSection: section)
+ let defaultNumberOfRows = super.tableView(tableView, numberOfRowsInSection: adjustedSection)
if AccountManager.shared.activeAccounts.isEmpty || AccountManager.shared.anyAccountHasFeedWithURL(appNewsURLString) {
return defaultNumberOfRows - 1
}
return defaultNumberOfRows
default:
- return super.tableView(tableView, numberOfRowsInSection: section)
+ return super.tableView(tableView, numberOfRowsInSection: adjustedSection)
}
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+ var adjustedSection = indexPath.section
+ if traitCollection.userInterfaceIdiom != .phone && adjustedSection > 3 {
+ adjustedSection = adjustedSection + 1
+ }
+
let cell: UITableViewCell
- switch indexPath.section {
+ switch adjustedSection {
case 1:
let sortedAccounts = AccountManager.shared.sortedAccounts
@@ -105,8 +130,8 @@ class SettingsViewController: UITableViewController {
}
default:
-
- cell = super.tableView(tableView, cellForRowAt: indexPath)
+ let adjustedIndexPath = IndexPath(row: indexPath.row, section: adjustedSection)
+ cell = super.tableView(tableView, cellForRowAt: adjustedIndexPath)
}
@@ -114,7 +139,12 @@ class SettingsViewController: UITableViewController {
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
- switch indexPath.section {
+ var adjustedSection = indexPath.section
+ if traitCollection.userInterfaceIdiom != .phone && adjustedSection > 3 {
+ adjustedSection = adjustedSection + 1
+ }
+
+ switch adjustedSection {
case 0:
UIApplication.shared.open(URL(string: "\(UIApplication.openSettingsURLString)")!)
tableView.selectRow(at: nil, animated: true, scrollPosition: .none)
@@ -156,7 +186,7 @@ class SettingsViewController: UITableViewController {
default:
break
}
- case 4:
+ case 5:
switch indexPath.row {
case 0:
openURL("https://ranchero.com/netnewswire/help/ios/5.0/en/")
@@ -200,19 +230,11 @@ class SettingsViewController: UITableViewController {
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
- if indexPath.section == 1 {
- return super.tableView(tableView, heightForRowAt: IndexPath(row: 0, section: 1))
- } else {
- return super.tableView(tableView, heightForRowAt: indexPath)
- }
+ return super.tableView(tableView, heightForRowAt: IndexPath(row: 0, section: 1))
}
override func tableView(_ tableView: UITableView, indentationLevelForRowAt indexPath: IndexPath) -> Int {
- if indexPath.section == 1 {
- return super.tableView(tableView, indentationLevelForRowAt: IndexPath(row: 0, section: 1))
- } else {
- return super.tableView(tableView, indentationLevelForRowAt: indexPath)
- }
+ return super.tableView(tableView, indentationLevelForRowAt: IndexPath(row: 0, section: 1))
}
// MARK: Actions
@@ -237,6 +259,14 @@ class SettingsViewController: UITableViewController {
}
}
+ @IBAction func switchFullscreenArticles(_ sender: Any) {
+ if showFullscreenArticlesSwitch.isOn {
+ AppDefaults.articleFullscreenEnabled = true
+ } else {
+ AppDefaults.articleFullscreenEnabled = false
+ }
+ }
+
// MARK: Notifications
@objc func contentSizeCategoryDidChange() {