Don't allow Twitter or Reddit feeds to be added to accounts that can't handle them

This commit is contained in:
Maurice Parker
2020-08-11 17:33:48 -05:00
parent 0835e789e5
commit c4ad7c71fd
3 changed files with 16 additions and 3 deletions

View File

@@ -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)