mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Adds app default option
Adds app defaults option for controlling link opening preferences. Adds browser logic and images. Browser Manager Updates - Handles deletion of current browser - Fixes detection of installed browsers by moving URL Types to LSApplicationQuery - Updates icons to glyphs - Context menus update tidy up - removes browser specific options and offers in-app or default browser options (can be enabled via a bool) - adds 1Password as an option - removes custom wording on context menus Fixes - makes sure browser options are available on iPad - uses VibrantCell - Changes Settings title to "Open Links In"
This commit is contained in:
@@ -10,6 +10,7 @@ import UIKit
|
||||
import Account
|
||||
import CoreServices
|
||||
import SafariServices
|
||||
import SwiftUI
|
||||
|
||||
class SettingsViewController: UITableViewController {
|
||||
|
||||
@@ -21,10 +22,14 @@ class SettingsViewController: UITableViewController {
|
||||
@IBOutlet weak var confirmMarkAllAsReadSwitch: UISwitch!
|
||||
@IBOutlet weak var showFullscreenArticlesSwitch: UISwitch!
|
||||
@IBOutlet weak var colorPaletteDetailLabel: UILabel!
|
||||
@IBOutlet weak var currentBrowserLabel: UILabel!
|
||||
|
||||
|
||||
var scrollToArticlesSection = false
|
||||
weak var presentingParentController: UIViewController?
|
||||
|
||||
let browserManger = BrowserManager.shared
|
||||
|
||||
override func viewDidLoad() {
|
||||
// This hack mostly works around a bug in static tables with dynamic type. See: https://spin.atomicobject.com/2018/10/15/dynamic-type-static-uitableview/
|
||||
NotificationCenter.default.removeObserver(tableView!, name: UIContentSizeCategory.didChangeNotification, object: nil)
|
||||
@@ -34,6 +39,7 @@ class SettingsViewController: UITableViewController {
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(accountsDidChange), name: .UserDidDeleteAccount, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(displayNameDidChange), name: .DisplayNameDidChange, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(activeExtensionPointsDidChange), name: .ActiveExtensionPointsDidChange, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(browserPreferenceDidChange), name: .browserPreferenceDidChange, object: nil)
|
||||
|
||||
tableView.register(UINib(nibName: "SettingsComboTableViewCell", bundle: nil), forCellReuseIdentifier: "SettingsComboTableViewCell")
|
||||
tableView.register(UINib(nibName: "SettingsTableViewCell", bundle: nil), forCellReuseIdentifier: "SettingsTableViewCell")
|
||||
@@ -76,6 +82,7 @@ class SettingsViewController: UITableViewController {
|
||||
}
|
||||
|
||||
colorPaletteDetailLabel.text = String(describing: AppDefaults.userInterfaceColorPalette)
|
||||
currentBrowserLabel.text = browserManger.currentBrowser().displayName
|
||||
|
||||
let buildLabel = NonIntrinsicLabel(frame: CGRect(x: 32.0, y: 0.0, width: 0.0, height: 0.0))
|
||||
buildLabel.font = UIFont.systemFont(ofSize: 11.0)
|
||||
@@ -118,7 +125,7 @@ class SettingsViewController: UITableViewController {
|
||||
}
|
||||
return defaultNumberOfRows
|
||||
case 5:
|
||||
return traitCollection.userInterfaceIdiom == .phone ? 2 : 1
|
||||
return traitCollection.userInterfaceIdiom == .phone ? 3 : 2
|
||||
default:
|
||||
return super.tableView(tableView, numberOfRowsInSection: section)
|
||||
}
|
||||
@@ -157,7 +164,6 @@ class SettingsViewController: UITableViewController {
|
||||
acctCell.comboNameLabel?.text = extensionPoint.title
|
||||
cell = acctCell
|
||||
}
|
||||
|
||||
default:
|
||||
cell = super.tableView(tableView, cellForRowAt: indexPath)
|
||||
|
||||
@@ -220,6 +226,11 @@ class SettingsViewController: UITableViewController {
|
||||
default:
|
||||
break
|
||||
}
|
||||
case 5:
|
||||
if indexPath.row == 1 {
|
||||
let browser = UIStoryboard.settings.instantiateController(ofType: BrowserConfigurationViewController.self)
|
||||
self.navigationController?.pushViewController(browser, animated: true)
|
||||
}
|
||||
case 6:
|
||||
let colorPalette = UIStoryboard.settings.instantiateController(ofType: ColorPaletteTableViewController.self)
|
||||
self.navigationController?.pushViewController(colorPalette, animated: true)
|
||||
@@ -344,6 +355,10 @@ class SettingsViewController: UITableViewController {
|
||||
tableView.reloadData()
|
||||
}
|
||||
|
||||
@objc func browserPreferenceDidChange() {
|
||||
tableView.reloadData()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: OPML Document Picker
|
||||
|
||||
Reference in New Issue
Block a user