Adds an account behavior to disable folders
Some sync services (Feed Wrangler) don't support folders. This behavior removes the account from the UI when adding new folders.
This commit is contained in:
parent
2324d652cd
commit
a37bfd5d74
@ -28,6 +28,11 @@ public enum AccountBehavior: Equatable {
|
|||||||
*/
|
*/
|
||||||
case disallowFeedInRootFolder
|
case disallowFeedInRootFolder
|
||||||
|
|
||||||
|
/**
|
||||||
|
Account doesn't support folders
|
||||||
|
*/
|
||||||
|
case disallowFolderManagement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Account doesn't support OPML imports
|
Account doesn't support OPML imports
|
||||||
*/
|
*/
|
||||||
|
@ -16,7 +16,7 @@ import Secrets
|
|||||||
|
|
||||||
final class FeedWranglerAccountDelegate: AccountDelegate {
|
final class FeedWranglerAccountDelegate: AccountDelegate {
|
||||||
|
|
||||||
var behaviors: AccountBehaviors = []
|
var behaviors: AccountBehaviors = [.disallowFolderManagement]
|
||||||
|
|
||||||
var isOPMLImportInProgress = false
|
var isOPMLImportInProgress = false
|
||||||
var server: String? = FeedWranglerConfig.clientPath
|
var server: String? = FeedWranglerConfig.clientPath
|
||||||
|
@ -42,7 +42,11 @@ class AddFolderWindowController : NSWindowController {
|
|||||||
let menu = NSMenu()
|
let menu = NSMenu()
|
||||||
accountPopupButton.menu = menu
|
accountPopupButton.menu = menu
|
||||||
|
|
||||||
for oneAccount in AccountManager.shared.sortedActiveAccounts {
|
let accounts = AccountManager.shared
|
||||||
|
.sortedActiveAccounts
|
||||||
|
.filter { !$0.behaviors.contains(.disallowFolderManagement) }
|
||||||
|
|
||||||
|
for oneAccount in accounts {
|
||||||
|
|
||||||
let oneMenuItem = NSMenuItem()
|
let oneMenuItem = NSMenuItem()
|
||||||
oneMenuItem.title = oneAccount.nameForDisplay
|
oneMenuItem.title = oneAccount.nameForDisplay
|
||||||
|
@ -43,7 +43,9 @@ class AddFolderViewController: UITableViewController, AddContainerViewController
|
|||||||
|
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
|
||||||
accounts = AccountManager.shared.sortedActiveAccounts
|
accounts = AccountManager.shared
|
||||||
|
.sortedActiveAccounts
|
||||||
|
.filter { !$0.behaviors.contains(.disallowFolderManagement) }
|
||||||
|
|
||||||
nameTextField.delegate = self
|
nameTextField.delegate = self
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user