mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Hide the Add NetNewsWire feed option if already subscribed
This commit is contained in:
@@ -12,6 +12,7 @@ import SafariServices
|
||||
|
||||
class SettingsViewController: UITableViewController {
|
||||
|
||||
private let appNewsURLString = "https://nnw.ranchero.com/feed.json"
|
||||
static let preferredContentSizeForFormSheetDisplay = CGSize(width: 460.0, height: 400.0)
|
||||
|
||||
@IBOutlet weak var refreshIntervalLabel: UILabel!
|
||||
@@ -77,6 +78,12 @@ class SettingsViewController: UITableViewController {
|
||||
return defaultNumberOfRows - 1
|
||||
}
|
||||
return defaultNumberOfRows
|
||||
case 3:
|
||||
let defaultNumberOfRows = super.tableView(tableView, numberOfRowsInSection: section)
|
||||
if AccountManager.shared.anyAccountHasFeedWithURL(appNewsURLString) {
|
||||
return defaultNumberOfRows - 1
|
||||
}
|
||||
return defaultNumberOfRows
|
||||
default:
|
||||
return super.tableView(tableView, numberOfRowsInSection: section)
|
||||
}
|
||||
@@ -243,24 +250,17 @@ private extension SettingsViewController {
|
||||
}
|
||||
|
||||
func addFeed() {
|
||||
|
||||
let appNewsURLString = "https://nnw.ranchero.com/feed.json"
|
||||
if AccountManager.shared.anyAccountHasFeedWithURL(appNewsURLString) {
|
||||
presentError(title: "Subscribe", message: "You are already subscribed to the NetNewsWire news feed.")
|
||||
return
|
||||
}
|
||||
|
||||
self.dismiss(animated: true)
|
||||
|
||||
let addNavViewController = UIStoryboard.add.instantiateInitialViewController() as! UINavigationController
|
||||
let addViewController = addNavViewController.topViewController as! AddContainerViewController
|
||||
addNavViewController.modalPresentationStyle = .formSheet
|
||||
addNavViewController.preferredContentSize = AddContainerViewController.preferredContentSizeForFormSheetDisplay
|
||||
addViewController.initialControllerType = .feed
|
||||
addViewController.initialFeed = appNewsURLString
|
||||
addViewController.initialFeedName = "NetNewsWire News"
|
||||
|
||||
presentingParentController?.present(addNavViewController, animated: true)
|
||||
|
||||
}
|
||||
|
||||
func importOPML() {
|
||||
|
||||
Reference in New Issue
Block a user