diff --git a/Evergreen/ArticleStyles/ArticleStylesManager.swift b/Evergreen/ArticleStyles/ArticleStylesManager.swift index a09f502ca..fadadf226 100644 --- a/Evergreen/ArticleStyles/ArticleStylesManager.swift +++ b/Evergreen/ArticleStyles/ArticleStylesManager.swift @@ -66,7 +66,7 @@ public final class ArticleStylesManager { updateStyleNames() updateCurrentStyle() - NotificationCenter.default.addObserver(self, selector: #selector(applicationDidBecomeActive(_:)), name: NSNotification.Name.NSApplicationDidBecomeActiveNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(applicationDidBecomeActive(_:)), name: NSApplication.didBecomeActiveNotification, object: nil) } // MARK: Notifications diff --git a/Evergreen/MainWindow/AddFeed/AddFeedController.swift b/Evergreen/MainWindow/AddFeed/AddFeedController.swift index 12e40dae8..1dcaf9b0c 100644 --- a/Evergreen/MainWindow/AddFeed/AddFeedController.swift +++ b/Evergreen/MainWindow/AddFeed/AddFeedController.swift @@ -63,7 +63,7 @@ class AddFeedController: AddFeedWindowControllerDelegate, FeedFinderDelegate { assert(folder.account != nil, "Folder must have an account.") let account = folder.account ?? AccountManager.sharedInstance.localAccount - if account.hasFeedWithURLString(url.absoluteString) { + if account.hasFeed(withURL: url.absoluteString) { showAlreadySubscribedError(url.absoluteString, folder) return } @@ -160,7 +160,7 @@ private extension AddFeedController { return } - if account.hasFeedWithURLString(feedURLString) { + if account.hasFeed(withURL: feedURLString) { showAlreadySubscribedError(feedURLString, folder) return } diff --git a/Evergreen/MainWindow/AddFolder/AddFolderWindowController.swift b/Evergreen/MainWindow/AddFolder/AddFolderWindowController.swift index 6a40baa2b..09f720301 100644 --- a/Evergreen/MainWindow/AddFolder/AddFolderWindowController.swift +++ b/Evergreen/MainWindow/AddFolder/AddFolderWindowController.swift @@ -68,7 +68,7 @@ class AddFolderWindowController : NSWindowController { return } - let _ = account.ensureFolderWithName(folderName) + let _ = account.ensureFolder(with: folderName) } // MARK: Actions diff --git a/Frameworks/Account/Account.swift b/Frameworks/Account/Account.swift index 5be79a9db..d5d2f16ab 100644 --- a/Frameworks/Account/Account.swift +++ b/Frameworks/Account/Account.swift @@ -70,6 +70,11 @@ public final class Account: DisplayNameProvider, Hashable { // TODO } + public func ensureFolder(with name: String) -> Folder? { + + return nil //TODO + } + // MARK: - Equatable public class func ==(lhs: Account, rhs: Account) -> Bool { diff --git a/Frameworks/Account/Container/Container.swift b/Frameworks/Account/Container/Container.swift index 96ed99c0d..ae7529423 100644 --- a/Frameworks/Account/Container/Container.swift +++ b/Frameworks/Account/Container/Container.swift @@ -24,6 +24,7 @@ public protocol Container { func flattenedFeeds() -> Set func existingFeed(with feedID: String) -> Feed? func existingFeed(withURL url: String) -> Feed? + func hasFeed(withURL url: String) -> Bool func isChild(_ obj: AnyObject) -> Bool @@ -64,6 +65,14 @@ public extension Container { return foundObject as! Feed? } + func hasFeed(withURL url: String) -> Bool { + + if let _ = existingFeed(withURL: url) { + return true + } + return false + } + func visitChildren(visitBlock: VisitBlock) -> Bool { return visitObjects(false, visitBlock)