Don't allow users to add Reddit or Twitter feeds if they don't have an extension configured.

This commit is contained in:
Maurice Parker 2020-08-12 10:27:58 -05:00
parent 9a91648acc
commit d6ed015514
4 changed files with 10 additions and 6 deletions

View File

@ -420,13 +420,13 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
return !isDisplayingSheet && !AccountManager.shared.activeAccounts.isEmpty
}
if item.action == #selector(showAddRedditFeedWindow(_:)) {
guard !isDisplayingSheet && isSpecialAccountAvailable else {
guard !isDisplayingSheet && isSpecialAccountAvailable && ExtensionPointManager.shared.isRedditEnabled else {
return false
}
return ExtensionPointManager.shared.isRedditEnabled
}
if item.action == #selector(showAddTwitterFeedWindow(_:)) {
guard !isDisplayingSheet && isSpecialAccountAvailable else {
guard !isDisplayingSheet && isSpecialAccountAvailable && ExtensionPointManager.shared.isTwitterEnabled else {
return false
}
return ExtensionPointManager.shared.isTwitterEnabled

View File

@ -27,7 +27,7 @@ class ExtensionPointAddViewController: NSViewController {
super.viewDidLoad()
tableView.dataSource = self
tableView.delegate = self
availableExtensionPointTypes = ExtensionPointManager.shared.availableExtensionPointTypes
availableExtensionPointTypes = ExtensionPointManager.shared.availableExtensionPointTypes.sorted(by: { $0.title < $1.title })
}
}

View File

@ -423,9 +423,13 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
alertController.addAction(addWebFeedAction)
if AccountManager.shared.activeAccounts.contains(where: { $0.type == .onMyMac || $0.type == .cloudKit }) {
if ExtensionPointManager.shared.isRedditEnabled {
alertController.addAction(addRedditFeedAction)
}
if ExtensionPointManager.shared.isTwitterEnabled {
alertController.addAction(addTwitterFeedAction)
}
}
alertController.addAction(addWebFolderAction)
alertController.addAction(cancelAction)

View File

@ -18,7 +18,7 @@ class AddExtensionPointViewController: UITableViewController, AddExtensionPointD
override func viewDidLoad() {
super.viewDidLoad()
availableExtensionPointTypes = ExtensionPointManager.shared.availableExtensionPointTypes
availableExtensionPointTypes = ExtensionPointManager.shared.availableExtensionPointTypes.sorted(by: { $0.title < $1.title })
}
override func numberOfSections(in tableView: UITableView) -> Int {