mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-22 23:58:36 +01:00
Don't allow Twitter or Reddit feeds to be added to accounts that can't handle them
This commit is contained in:
parent
0835e789e5
commit
c4ad7c71fd
@ -17,6 +17,7 @@ protocol AddFeedFolderViewControllerDelegate {
|
||||
class AddFeedFolderViewController: UITableViewController {
|
||||
|
||||
var delegate: AddFeedFolderViewControllerDelegate?
|
||||
var addFeedType = AddFeedType.web
|
||||
var initialContainer: Container?
|
||||
|
||||
var containers = [Container]()
|
||||
@ -24,7 +25,14 @@ class AddFeedFolderViewController: UITableViewController {
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
for account in AccountManager.shared.sortedActiveAccounts {
|
||||
var sortedActiveAccounts: [Account]
|
||||
if addFeedType == .web {
|
||||
sortedActiveAccounts = AccountManager.shared.sortedActiveAccounts
|
||||
} else {
|
||||
sortedActiveAccounts = AccountManager.shared.sortedActiveAccounts.filter { $0.type == .onMyMac || $0.type == .cloudKit }
|
||||
}
|
||||
|
||||
for account in sortedActiveAccounts {
|
||||
containers.append(account)
|
||||
if let sortedFolders = account.sortedFolders {
|
||||
containers.append(contentsOf: sortedFolders)
|
||||
|
@ -164,6 +164,7 @@ class AddFeedViewController: UITableViewController {
|
||||
navController.modalPresentationStyle = .currentContext
|
||||
let folderViewController = navController.topViewController as! AddFeedFolderViewController
|
||||
folderViewController.delegate = self
|
||||
folderViewController.addFeedType = addFeedType
|
||||
folderViewController.initialContainer = container
|
||||
present(navController, animated: true)
|
||||
}
|
||||
|
@ -421,8 +421,12 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
||||
}
|
||||
|
||||
alertController.addAction(addWebFeedAction)
|
||||
alertController.addAction(addRedditFeedAction)
|
||||
alertController.addAction(addTwitterFeedAction)
|
||||
|
||||
if AccountManager.shared.activeAccounts.contains(where: { $0.type == .onMyMac || $0.type == .cloudKit }) {
|
||||
alertController.addAction(addRedditFeedAction)
|
||||
alertController.addAction(addTwitterFeedAction)
|
||||
}
|
||||
|
||||
alertController.addAction(addWebFolderAction)
|
||||
alertController.addAction(cancelAction)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user