Get Data.framework building again.

This commit is contained in:
Brent Simmons 2017-09-07 21:00:30 -07:00
parent 75603eefdc
commit 9ee20ee270
6 changed files with 54 additions and 52 deletions

View File

@ -8,7 +8,15 @@
import Foundation
public typealias AccountInfo = [String: AnyObject]
public struct AccountInfo: Equatable {
var dictionary: [String: AnyObject]?
public static func ==(lhs: AccountInfo, rhs: AccountInfo) -> Bool {
return true // TODO
}
}
// AccountInfo is a plist-compatible dictionary thats stored as a binary plist in the database.

View File

@ -54,9 +54,9 @@ public struct ArticleStatus: Hashable {
return userDeleted
}
}
else if let flag = accountInfo?[key] as? Bool {
return flag
}
// else if let flag = accountInfo?[key] as? Bool {
// return flag
// }
return false
}

View File

@ -25,7 +25,6 @@
844BEE981F0AB4F8004AB7CD /* AccountDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 844BEE941F0AB4F8004AB7CD /* AccountDelegate.swift */; };
844BEE991F0AB4F8004AB7CD /* Container.swift in Sources */ = {isa = PBXBuildFile; fileRef = 844BEE951F0AB4F8004AB7CD /* Container.swift */; };
844BEE9A1F0AB4F8004AB7CD /* DisplayNameProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 844BEE961F0AB4F8004AB7CD /* DisplayNameProvider.swift */; };
844BEE9B1F0AB4F8004AB7CD /* UnreadCountProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 844BEE971F0AB4F8004AB7CD /* UnreadCountProvider.swift */; };
848935221F6249AC00CEBD24 /* AccountInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 848935211F6249AC00CEBD24 /* AccountInfo.swift */; };
/* End PBXBuildFile section */
@ -81,7 +80,6 @@
844BEE941F0AB4F8004AB7CD /* AccountDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountDelegate.swift; sourceTree = "<group>"; };
844BEE951F0AB4F8004AB7CD /* Container.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Container.swift; sourceTree = "<group>"; };
844BEE961F0AB4F8004AB7CD /* DisplayNameProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DisplayNameProvider.swift; sourceTree = "<group>"; };
844BEE971F0AB4F8004AB7CD /* UnreadCountProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnreadCountProvider.swift; sourceTree = "<group>"; };
844BEE9C1F0AB512004AB7CD /* RSCore.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RSCore.xcodeproj; path = ../RSCore/RSCore.xcodeproj; sourceTree = "<group>"; };
848935211F6249AC00CEBD24 /* AccountInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountInfo.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -162,7 +160,6 @@
844BEE941F0AB4F8004AB7CD /* AccountDelegate.swift */,
844BEE951F0AB4F8004AB7CD /* Container.swift */,
844BEE961F0AB4F8004AB7CD /* DisplayNameProvider.swift */,
844BEE971F0AB4F8004AB7CD /* UnreadCountProvider.swift */,
);
path = Protocols;
sourceTree = "<group>";
@ -342,7 +339,6 @@
844BEE811F0AB4D0004AB7CD /* Author.swift in Sources */,
844BEE921F0AB4EF004AB7CD /* OPMLRepresentable.swift in Sources */,
840405CA1F1A8E4300DF0296 /* DatabaseID.swift in Sources */,
844BEE9B1F0AB4F8004AB7CD /* UnreadCountProvider.swift in Sources */,
844BEE851F0AB4DB004AB7CD /* ArticleStatus.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;

View File

@ -9,7 +9,7 @@
import Foundation
import RSCore
public final class Feed: UnreadCountProvider, DisplayNameProvider, Hashable {
public final class Feed: DisplayNameProvider, Hashable {
public let accountID: String
public let url: String
@ -27,13 +27,13 @@ public final class Feed: UnreadCountProvider, DisplayNameProvider, Hashable {
}
}
public var unreadCount = 0 {
didSet {
if unreadCount != oldValue {
postUnreadCountDidChangeNotification()
}
}
}
// public var unreadCount = 0 {
// didSet {
// if unreadCount != oldValue {
// postUnreadCountDidChangeNotification()
// }
// }
// }
public init(accountID: String, url: String, feedID: String) {
@ -43,15 +43,15 @@ public final class Feed: UnreadCountProvider, DisplayNameProvider, Hashable {
self.hashValue = accountID.hashValue ^ url.hashValue ^ feedID.hashValue
}
public func updateUnreadCount() {
unreadCount = articles.reduce(0) { (result, oneArticle) -> Int in
if let read = oneArticle.status?.read, !read {
return result + 1
}
return result
}
}
// public func updateUnreadCount() {
//
// unreadCount = articles.reduce(0) { (result, oneArticle) -> Int in
// if let read = oneArticle.status?.read, !read {
// return result + 1
// }
// return result
// }
// }
public class func ==(lhs: Feed, rhs: Feed) -> Bool {

View File

@ -8,7 +8,7 @@
import Foundation
public final class Folder: UnreadCountProvider {
public final class Folder {
public let accountID: String
public var nameForDisplay: String
@ -19,36 +19,34 @@ public final class Folder: UnreadCountProvider {
self.accountID = accountID
self.nameForDisplay = nameForDisplay
NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)
// NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)
}
// MARK: Notifications
@objc dynamic public func unreadCountDidChange(_ note: Notification) {
guard let obj = note.object else {
return
}
let potentialChild = obj as AnyObject
if isChild(potentialChild) {
updateUnreadCount()
}
}
// MARK: UnreadCountProvider
public var unreadCount = 0 {
didSet {
if unreadCount != oldValue {
postUnreadCountDidChangeNotification()
}
}
}
public func updateUnreadCount() {
unreadCount = calculateUnreadCount(childObjects)
}
// @objc dynamic public func unreadCountDidChange(_ note: Notification) {
//
// guard let obj = note.object else {
// return
// }
// let potentialChild = obj as AnyObject
// if isChild(potentialChild) {
// updateUnreadCount()
// }
// }
// public var unreadCount = 0 {
// didSet {
// if unreadCount != oldValue {
// postUnreadCountDidChangeNotification()
// }
// }
// }
// public func updateUnreadCount() {
//
// unreadCount = calculateUnreadCount(childObjects)
// }
}
extension Folder: Container {