diff --git a/Evergreen/Data/DefaultFeedsImporter.swift b/Evergreen/Data/DefaultFeedsImporter.swift index c8ca3f26f..85de9e8c3 100644 --- a/Evergreen/Data/DefaultFeedsImporter.swift +++ b/Evergreen/Data/DefaultFeedsImporter.swift @@ -29,15 +29,9 @@ struct DefaultFeedsImporter { private static func shouldImportDefaultFeeds(_ isFirstRun: Bool) -> Bool { - if !isFirstRun { + if !isFirstRun || AccountManager.shared.anyAccountHasAtLeastOneFeed() { return false } - - for oneAccount in AccountManager.shared.accounts { - if oneAccount.hasAtLeastOneFeed() { - return false - } - } return true } } diff --git a/Evergreen/MainWindow/Sidebar/SidebarViewController.swift b/Evergreen/MainWindow/Sidebar/SidebarViewController.swift index 814f7cfec..6a3dce719 100644 --- a/Evergreen/MainWindow/Sidebar/SidebarViewController.swift +++ b/Evergreen/MainWindow/Sidebar/SidebarViewController.swift @@ -321,9 +321,9 @@ private extension SidebarViewController { return outlineView.revealAndSelectRepresentedObject(representedObject, treeController) } - func folderParentForNode(_ node: Node) -> Folder? { + func folderParentForNode(_ node: Node) -> Container? { - if let folder = node.parent?.representedObject as? Folder { + if let folder = node.parent?.representedObject as? Container { return folder } if let feed = node.representedObject as? Feed { @@ -337,9 +337,9 @@ private extension SidebarViewController { func deleteItemForNode(_ node: Node) { - if let folder = folderParentForNode(node) { - folder.deleteItems([node.representedObject]) - } +// if let folder = folderParentForNode(node) { +// folder.deleteItems([node.representedObject]) +// } } func deleteItemsForNodes(_ nodes: [Node]) { diff --git a/Evergreen/Preferences/PreferencesWindowController.swift b/Evergreen/Preferences/PreferencesWindowController.swift index 270108542..b64ac3116 100644 --- a/Evergreen/Preferences/PreferencesWindowController.swift +++ b/Evergreen/Preferences/PreferencesWindowController.swift @@ -103,13 +103,13 @@ private extension PreferencesWindowController { func toolbarItemSpec(for identifier: String) -> PreferencesToolbarItemSpec? { - return toolbarItemSpecs.first(where: { $0.identifier == identifier }) + return toolbarItemSpecs.first(where: { $0.identifier.rawValue == identifier }) } func switchToViewAtIndex(_ index: Int) { let identifier = toolbarItemSpecs[index].identifier - switchToView(identifier: identifier) + switchToView(identifier: identifier.rawValue) } func switchToView(identifier: String) { @@ -152,7 +152,7 @@ private extension PreferencesWindowController { } let storyboard = NSStoryboard(name: NSStoryboard.Name(rawValue: "Preferences"), bundle: nil) - guard let viewController = storyboard.instantiateController(withIdentifier: identifier) as? NSViewController else { + guard let viewController = storyboard.instantiateController(withIdentifier: NSStoryboard.SceneIdentifier(rawValue: identifier)) as? NSViewController else { assertionFailure("Unknown preferences view controller: \(identifier)") return nil } diff --git a/Frameworks/Account/Account.swift b/Frameworks/Account/Account.swift index 41a0f805c..9ef2d43c7 100644 --- a/Frameworks/Account/Account.swift +++ b/Frameworks/Account/Account.swift @@ -38,6 +38,12 @@ public final class Account: DisplayNameProvider, Hashable { var username: String? var refreshInProgress = false + var hasAtLeastOneFeed: Bool { + get { + return !feedIDDictionary.isEmpty + } + } + var supportsSubFolders: Bool { get { return delegate.supportsSubFolders diff --git a/Frameworks/Account/AccountManager.swift b/Frameworks/Account/AccountManager.swift index 91b185ecc..1cd0913f9 100644 --- a/Frameworks/Account/AccountManager.swift +++ b/Frameworks/Account/AccountManager.swift @@ -87,10 +87,10 @@ public final class AccountManager: UnreadCountProvider { } } - func anyAccountHasAtLeastOneFeed() -> Bool { + public func anyAccountHasAtLeastOneFeed() -> Bool { for account in accounts { - if account.hasAtLeastOneFeed() { + if account.hasAtLeastOneFeed { return true } } diff --git a/Frameworks/Account/Container/Account+Container.swift b/Frameworks/Account/Container/Account+Container.swift index ec3731ba1..e45084ec8 100644 --- a/Frameworks/Account/Container/Account+Container.swift +++ b/Frameworks/Account/Container/Account+Container.swift @@ -11,11 +11,6 @@ import Data extension Account: Container { - public func hasAtLeastOneFeed() -> Bool { - - return !feedIDDictionary.isEmpty - } - public func flattenedFeeds() -> Set { return Set(feedIDDictionary.values) diff --git a/Frameworks/Account/Container/Container.swift b/Frameworks/Account/Container/Container.swift index ba1a316a6..e4aeaeb16 100644 --- a/Frameworks/Account/Container/Container.swift +++ b/Frameworks/Account/Container/Container.swift @@ -20,7 +20,6 @@ extension NSNotification.Name { public protocol Container { //Recursive - func hasAtLeastOneFeed() -> Bool func flattenedFeeds() -> Set func existingFeed(with feedID: String) -> Feed? func existingFeed(withURL url: String) -> Feed? @@ -36,14 +35,6 @@ public protocol Container { public extension Container { - func hasAtLeastOneFeed() -> Bool { - - let foundObject = findObject(true, visitBlock: { (oneDescendant) -> Bool in - return oneDescendant is Feed - }) - return foundObject != nil - } - func existingFeed(with feedID: String) -> Feed? { let foundObject = findObject(true) { (oneDescendant) -> Bool in diff --git a/Frameworks/Account/Local/LocalAccountDelegate.swift b/Frameworks/Account/Local/LocalAccountDelegate.swift index f9e4ef010..1157588b6 100644 --- a/Frameworks/Account/Local/LocalAccountDelegate.swift +++ b/Frameworks/Account/Local/LocalAccountDelegate.swift @@ -11,6 +11,7 @@ import Foundation struct LocalAccountDelegate: AccountDelegate { let supportsSubFolders = false + private let refresher = LocalAccountRefresher() func refreshAll(for account: Account) { diff --git a/Frameworks/RSParser/Feeds/XML/RSAtomParser.m b/Frameworks/RSParser/Feeds/XML/RSAtomParser.m index 6bd657184..c71c0a94f 100755 --- a/Frameworks/RSParser/Feeds/XML/RSAtomParser.m +++ b/Frameworks/RSParser/Feeds/XML/RSAtomParser.m @@ -13,7 +13,7 @@ #import "RSParsedArticle.h" #import "NSString+RSParser.h" #import "RSDateParser.h" -#import +//#import "RSParser-Swift.h" @interface RSAtomParser () diff --git a/Frameworks/RSParser/Feeds/XML/RSRSSParser.m b/Frameworks/RSParser/Feeds/XML/RSRSSParser.m index 2502d3eea..0b487f407 100755 --- a/Frameworks/RSParser/Feeds/XML/RSRSSParser.m +++ b/Frameworks/RSParser/Feeds/XML/RSRSSParser.m @@ -14,7 +14,7 @@ #import "RSParserInternal.h" #import "NSString+RSParser.h" #import "RSDateParser.h" -#import +#import "RSParser-Swift.h" @interface RSRSSParser () diff --git a/Frameworks/RSParser/HTML/RSHTMLLinkParser.m b/Frameworks/RSParser/HTML/RSHTMLLinkParser.m index c006e1e42..3270ae743 100755 --- a/Frameworks/RSParser/HTML/RSHTMLLinkParser.m +++ b/Frameworks/RSParser/HTML/RSHTMLLinkParser.m @@ -11,7 +11,7 @@ #import "RSSAXHTMLParser.h" #import "RSSAXParser.h" #import "RSParserInternal.h" -#import +#import "RSParser-Swift.h" @interface RSHTMLLinkParser() diff --git a/Frameworks/RSParser/HTML/RSHTMLMetadataParser.m b/Frameworks/RSParser/HTML/RSHTMLMetadataParser.m index ec15f8714..8746d72f3 100755 --- a/Frameworks/RSParser/HTML/RSHTMLMetadataParser.m +++ b/Frameworks/RSParser/HTML/RSHTMLMetadataParser.m @@ -12,7 +12,7 @@ #import "RSSAXHTMLParser.h" #import "RSSAXParser.h" #import "RSParserInternal.h" -#import +#import "RSParser-Swift.h" @interface RSHTMLMetadataParser () diff --git a/Frameworks/RSParser/OPML/RSOPMLParser.m b/Frameworks/RSParser/OPML/RSOPMLParser.m index 12e94a542..669238bd8 100755 --- a/Frameworks/RSParser/OPML/RSOPMLParser.m +++ b/Frameworks/RSParser/OPML/RSOPMLParser.m @@ -12,7 +12,7 @@ #import "RSOPMLItem.h" #import "RSOPMLDocument.h" #import "RSOPMLAttributes.h" -#import +#import "RSParser-Swift.h" #import "RSOPMLError.h"