Fix some build errors.
This commit is contained in:
parent
f187f6a9ef
commit
55967f8731
|
@ -1160,6 +1160,7 @@
|
|||
849A97651ED9EB96007D329B /* SidebarTreeControllerDelegate.swift in Sources */,
|
||||
849A97671ED9EB96007D329B /* UnreadCountView.swift in Sources */,
|
||||
849A975B1ED9EB0D007D329B /* ArticleUtilities.swift in Sources */,
|
||||
849A975C1ED9EB0D007D329B /* DefaultFeedsImporter.swift in Sources */,
|
||||
849A97891ED9ECEF007D329B /* ArticleStyle.swift in Sources */,
|
||||
849A978A1ED9ECEF007D329B /* ArticleStylesManager.swift in Sources */,
|
||||
849A97791ED9EC04007D329B /* TimelineStringUtilities.swift in Sources */,
|
||||
|
@ -1172,7 +1173,6 @@
|
|||
849A976E1ED9EBC8007D329B /* TimelineViewController.swift in Sources */,
|
||||
849A978D1ED9EE4D007D329B /* FeedListWindowController.swift in Sources */,
|
||||
849A97771ED9EC04007D329B /* TimelineCellData.swift in Sources */,
|
||||
849A975C1ED9EB0D007D329B /* DefaultFeedsImporter.swift in Sources */,
|
||||
849A97781ED9EC04007D329B /* TimelineCellLayout.swift in Sources */,
|
||||
849A976C1ED9EBC8007D329B /* TimelineTableRowView.swift in Sources */,
|
||||
849A977B1ED9EC04007D329B /* UnreadIndicatorView.swift in Sources */,
|
||||
|
|
|
@ -48,7 +48,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations {
|
|||
|
||||
let isFirstRun = AppDefaults.shared.isFirstRun
|
||||
let localAccount = AccountManager.shared.localAccount
|
||||
importDefaultFeedsIfNeeded(isFirstRun, account: localAccount)
|
||||
DefaultFeedsImporter.importIfNeeded(isFirstRun, account: localAccount)
|
||||
|
||||
currentTheme = themeLoader.defaultTheme
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import Foundation
|
|||
import Data
|
||||
import Account
|
||||
|
||||
typealias DiskFeedDictionary = [String: String]
|
||||
typealias DiskFeedDictionary = [String: Any]
|
||||
|
||||
struct DefaultFeedsImporter {
|
||||
|
||||
|
@ -44,24 +44,20 @@ struct DefaultFeedsImporter {
|
|||
|
||||
struct FeedsImporter {
|
||||
|
||||
func importFeeds(_ feedDictionaries: [DiskFeedDictionary], account: Account) {
|
||||
static func importFeeds(_ feedDictionaries: [DiskFeedDictionary], account: Account) {
|
||||
|
||||
let feedsToImport = feeds(with: feedDictionaries)
|
||||
feedsToImport.forEach(account.addItem)
|
||||
let feedsToImport = feeds(with: feedDictionaries, accountID: account.accountID)
|
||||
for feed in feedsToImport {
|
||||
if !account.hasFeed(with: feed.feedID) {
|
||||
let _ = account.addFeed(feed, to: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func feeds(with feedDictionaries: [DiskFeedDictionary]) -> Set<Feed> {
|
||||
private static func feeds(with feedDictionaries: [DiskFeedDictionary], accountID: String) -> Set<Feed> {
|
||||
|
||||
let feeds = Set(feedDictionaries.map { Feed(account: account, diskFeedDictionary: $0) })
|
||||
let feeds = Set(feedDictionaries.map { Feed(accountID: accountID, dictionary: $0) })
|
||||
return feeds
|
||||
}
|
||||
}
|
||||
|
||||
private extension Feed {
|
||||
|
||||
init?(account: Account, diskFeedDictionary: DiskFeedDictionary) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ class PreferencesWindowController : NSWindowController, NSToolbarDelegate {
|
|||
|
||||
func toolbar(_ toolbar: NSToolbar, itemForItemIdentifier itemIdentifier: NSToolbarItem.Identifier, willBeInsertedIntoToolbar flag: Bool) -> NSToolbarItem? {
|
||||
|
||||
guard let toolbarItemSpec = toolbarItemSpecs.first(where: { $0.identifier.rawValue == itemIdentifier }) else {
|
||||
guard let toolbarItemSpec = toolbarItemSpecs.first(where: { $0.identifier.rawValue == itemIdentifier.rawValue }) else {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
<string>By Brent Simmons, Evergreen developer</string>
|
||||
<key>editedName</key>
|
||||
<string>Inessential</string>
|
||||
<key>home</key>
|
||||
<key>homePageURL</key>
|
||||
<string>http://inessential.com/</string>
|
||||
<key>url</key>
|
||||
<string>http://inessential.com/xml/rss.xml</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>home</key>
|
||||
<key>homePageURL</key>
|
||||
<string>http://daringfireball.net/</string>
|
||||
<key>editedName</key>
|
||||
<string>Daring Fireball</string>
|
||||
|
@ -21,7 +21,7 @@
|
|||
<string>http://daringfireball.net/feeds/main</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>home</key>
|
||||
<key>homePageURL</key>
|
||||
<string>https://www.natashatherobot.com/</string>
|
||||
<key>editedName</key>
|
||||
<string>Natasha the Robot</string>
|
||||
|
@ -29,7 +29,7 @@
|
|||
<string>https://www.natashatherobot.com/feed/</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>home</key>
|
||||
<key>homePageURL</key>
|
||||
<string>http://www.imore.com/</string>
|
||||
<key>editedName</key>
|
||||
<string>iMore</string>
|
||||
|
@ -37,7 +37,7 @@
|
|||
<string>http://www.imore.com/rss.xml</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>home</key>
|
||||
<key>homePageURL</key>
|
||||
<string>http://becky.coffee/</string>
|
||||
<key>note</key>
|
||||
<string>iOS developer & corgi enthusiast</string>
|
||||
|
@ -47,7 +47,7 @@
|
|||
<string>http://beckyhansmeyer.com/feed/</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>home</key>
|
||||
<key>homePageURL</key>
|
||||
<string>http://shapeof.com/</string>
|
||||
<key>note</key>
|
||||
<string>By Gus Mueller, Acorn developer</string>
|
||||
|
@ -57,7 +57,7 @@
|
|||
<string>http://shapeof.com/rss.xml</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>home</key>
|
||||
<key>homePageURL</key>
|
||||
<string>http://redqueencoder.com/</string>
|
||||
<key>note</key>
|
||||
<string>Janie Clayton</string>
|
||||
|
@ -67,7 +67,7 @@
|
|||
<string>http://redqueencoder.com/feed/</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>home</key>
|
||||
<key>homePageURL</key>
|
||||
<string>https://medium.com/@jaimeejaimee</string>
|
||||
<key>editedName</key>
|
||||
<string>jaimeejaimee</string>
|
||||
|
@ -77,7 +77,7 @@
|
|||
<string>https://medium.com/feed/@jaimeejaimee</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>home</key>
|
||||
<key>homePageURL</key>
|
||||
<string>http://sixcolors.com</string>
|
||||
<key>note</key>
|
||||
<string>By Jason Snell & friends</string>
|
||||
|
@ -87,7 +87,7 @@
|
|||
<string>http://feedpress.me/sixcolors</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>home</key>
|
||||
<key>homePageURL</key>
|
||||
<string>http://www.loopinsight.com/</string>
|
||||
<key>note</key>
|
||||
<string>Jim Dalrymple and Dave Mark</string>
|
||||
|
@ -97,7 +97,7 @@
|
|||
<string>http://www.loopinsight.com/feed/</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>home</key>
|
||||
<key>homePageURL</key>
|
||||
<string>http://katiefloyd.com/</string>
|
||||
<key>editedName</key>
|
||||
<string>Katie Floyd</string>
|
||||
|
@ -105,7 +105,7 @@
|
|||
<string>http://feed.katiefloyd.com/</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>home</key>
|
||||
<key>homePageURL</key>
|
||||
<string>http://ashleynh.me/</string>
|
||||
<key>editedName</key>
|
||||
<string>Ashley Nelson-Hornstein</string>
|
||||
|
@ -113,7 +113,7 @@
|
|||
<string>http://blog.ashleynh.me/rss/</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>home</key>
|
||||
<key>homePageURL</key>
|
||||
<string>https://ranchero.com/evergreen/</string>
|
||||
<key>editedName</key>
|
||||
<string>Evergreen News</string>
|
||||
|
@ -121,7 +121,7 @@
|
|||
<string>https://ranchero.com/evergreen/feed.json</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>home</key>
|
||||
<key>homePageURL</key>
|
||||
<string>http://scripting.com/</string>
|
||||
<key>editedName</key>
|
||||
<string>Scripting News</string>
|
||||
|
@ -131,7 +131,7 @@
|
|||
<string>http://scripting.com/rss.xml</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>home</key>
|
||||
<key>homePageURL</key>
|
||||
<string>http://ericasadun.com/</string>
|
||||
<key>editedName</key>
|
||||
<string>Erica Sadun</string>
|
||||
|
@ -141,7 +141,7 @@
|
|||
<string>http://ericasadun.com/feed/</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>home</key>
|
||||
<key>homePageURL</key>
|
||||
<string>http://onefoottsunami.com/</string>
|
||||
<key>editedName</key>
|
||||
<string>One Foot Tsunami</string>
|
||||
|
|
|
@ -98,12 +98,12 @@ public final class Account: DisplayNameProvider, Hashable {
|
|||
return true // TODO
|
||||
}
|
||||
|
||||
public func canAddFolder(_ folder: Folder, to folder: Folder?) -> Bool {
|
||||
public func canAddFolder(_ folder: Folder, to containingFolder: Folder?) -> Bool {
|
||||
|
||||
return false // TODO
|
||||
}
|
||||
|
||||
public func addFolder(_ folder: Folder, to folder: Folder?) -> Bool {
|
||||
public func addFolder(_ folder: Folder, to containingFolder: Folder?) -> Bool {
|
||||
|
||||
return false // TODO
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ public protocol Container {
|
|||
func flattenedFeeds() -> Set<Feed>
|
||||
func existingFeed(with feedID: String) -> Feed?
|
||||
func existingFeed(withURL url: String) -> Feed?
|
||||
func hasFeed(with feedID: String) -> Bool
|
||||
func hasFeed(withURL url: String) -> Bool
|
||||
|
||||
func isChild(_ obj: AnyObject) -> Bool
|
||||
|
@ -65,6 +66,14 @@ public extension Container {
|
|||
return foundObject as! Feed?
|
||||
}
|
||||
|
||||
func hasFeed(with feedID: String) -> Bool {
|
||||
|
||||
if let _ = existingFeed(with: feedID) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func hasFeed(withURL url: String) -> Bool {
|
||||
|
||||
if let _ = existingFeed(withURL: url) {
|
||||
|
|
|
@ -42,7 +42,7 @@ final class LocalAccountRefresher: DownloadSessionDelegate {
|
|||
}
|
||||
|
||||
let request = NSMutableURLRequest(url: url)
|
||||
if let conditionalGetInfo = feed.conditionalGetInfo, !conditionalGetInfo.isEmpty {
|
||||
if let conditionalGetInfo = feed.conditionalGetInfo {
|
||||
conditionalGetInfo.addRequestHeadersToURLRequest(request)
|
||||
}
|
||||
|
||||
|
@ -75,10 +75,7 @@ final class LocalAccountRefresher: DownloadSessionDelegate {
|
|||
account.update(feed, with: parsedFeed) {
|
||||
|
||||
if let httpResponse = response as? HTTPURLResponse {
|
||||
let conditionalGetInfo = HTTPConditionalGetInfo(urlResponse: httpResponse)
|
||||
if !conditionalGetInfo.isEmpty || feed.conditionalGetInfo != nil {
|
||||
feed.conditionalGetInfo = conditionalGetInfo
|
||||
}
|
||||
feed.conditionalGetInfo = HTTPConditionalGetInfo(urlResponse: httpResponse)
|
||||
}
|
||||
|
||||
feed.contentHash = dataHash
|
||||
|
|
|
@ -13,9 +13,16 @@ public struct HTTPConditionalGetInfo {
|
|||
public let lastModified: String?
|
||||
public let etag: String?
|
||||
|
||||
public var isEmpty: Bool {
|
||||
public var dictionary: [String: String] {
|
||||
get {
|
||||
return lastModified == nil && etag == nil
|
||||
var d = [String: String]()
|
||||
if let lastModified = lastModified {
|
||||
d[HTTPResponseHeader.lastModified] = lastModified
|
||||
}
|
||||
if let etag = etag {
|
||||
d[HTTPResponseHeader.etag] = etag
|
||||
}
|
||||
return d
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,19 +43,6 @@ public struct HTTPConditionalGetInfo {
|
|||
self.init(lastModified: lastModified, etag: etag)
|
||||
}
|
||||
|
||||
public var dictionary: [String: String] {
|
||||
get {
|
||||
var d = [String: String]()
|
||||
if let lastModified = lastModified {
|
||||
d[HTTPResponseHeader.lastModified] = lastModified
|
||||
}
|
||||
if let etag = etag {
|
||||
d[HTTPResponseHeader.etag] = etag
|
||||
}
|
||||
return d
|
||||
}
|
||||
}
|
||||
|
||||
public init?(dictionary: [String: String]) {
|
||||
|
||||
self.init(lastModified: dictionary[HTTPResponseHeader.lastModified], etag: dictionary[HTTPResponseHeader.etag])
|
||||
|
|
Loading…
Reference in New Issue