Fix some build errors.

This commit is contained in:
Brent Simmons 2017-10-02 13:15:07 -07:00
parent 0630a89df3
commit 83231ed373
13 changed files with 23 additions and 36 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,11 +11,6 @@ import Data
extension Account: Container {
public func hasAtLeastOneFeed() -> Bool {
return !feedIDDictionary.isEmpty
}
public func flattenedFeeds() -> Set<Feed> {
return Set(feedIDDictionary.values)

View File

@ -20,7 +20,6 @@ extension NSNotification.Name {
public protocol Container {
//Recursive
func hasAtLeastOneFeed() -> Bool
func flattenedFeeds() -> Set<Feed>
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

View File

@ -11,6 +11,7 @@ import Foundation
struct LocalAccountDelegate: AccountDelegate {
let supportsSubFolders = false
private let refresher = LocalAccountRefresher()
func refreshAll(for account: Account) {

View File

@ -13,7 +13,7 @@
#import "RSParsedArticle.h"
#import "NSString+RSParser.h"
#import "RSDateParser.h"
#import <RSParser/RSParser-Swift.h>
//#import "RSParser-Swift.h"
@interface RSAtomParser () <RSSAXParserDelegate>

View File

@ -14,7 +14,7 @@
#import "RSParserInternal.h"
#import "NSString+RSParser.h"
#import "RSDateParser.h"
#import <RSParser/RSParser-Swift.h>
#import "RSParser-Swift.h"
@interface RSRSSParser () <RSSAXParserDelegate>

View File

@ -11,7 +11,7 @@
#import "RSSAXHTMLParser.h"
#import "RSSAXParser.h"
#import "RSParserInternal.h"
#import <RSParser/RSParser-Swift.h>
#import "RSParser-Swift.h"
@interface RSHTMLLinkParser() <RSSAXHTMLParserDelegate>

View File

@ -12,7 +12,7 @@
#import "RSSAXHTMLParser.h"
#import "RSSAXParser.h"
#import "RSParserInternal.h"
#import <RSParser/RSParser-Swift.h>
#import "RSParser-Swift.h"
@interface RSHTMLMetadataParser () <RSSAXHTMLParserDelegate>

View File

@ -12,7 +12,7 @@
#import "RSOPMLItem.h"
#import "RSOPMLDocument.h"
#import "RSOPMLAttributes.h"
#import <RSParser/RSParser-Swift.h>
#import "RSParser-Swift.h"
#import "RSOPMLError.h"