mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-27 10:02:37 +01:00
Use new hash-into function instead of calculating hashValue. WIP on #402.
This commit is contained in:
parent
6d49cd4620
commit
cfb3bd706e
@ -47,7 +47,6 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
||||
public let accountID: String
|
||||
public let type: AccountType
|
||||
public var nameForDisplay = ""
|
||||
public let hashValue: Int
|
||||
public var children = [AnyObject]()
|
||||
var urlToFeedDictionary = [String: Feed]()
|
||||
var idToFeedDictionary = [String: Feed]()
|
||||
@ -106,7 +105,6 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
||||
self.type = type
|
||||
self.settingsFile = settingsFile
|
||||
self.dataFolder = dataFolder
|
||||
self.hashValue = accountID.hashValue
|
||||
|
||||
let databaseFilePath = (dataFolder as NSString).appendingPathComponent("DB.sqlite3")
|
||||
self.database = ArticlesDatabase(databaseFilePath: databaseFilePath, accountID: accountID)
|
||||
@ -479,6 +477,12 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Hashable
|
||||
|
||||
public func hash(into hasher: inout Hasher) {
|
||||
hasher.combine(accountID)
|
||||
}
|
||||
|
||||
// MARK: - Equatable
|
||||
|
||||
public class func ==(lhs: Account, rhs: Account) -> Bool {
|
||||
|
@ -30,7 +30,6 @@ public final class Feed: DisplayNameProvider, UnreadCountProvider, Hashable {
|
||||
|
||||
public var conditionalGetInfo: HTTPConditionalGetInfo?
|
||||
public var contentHash: String?
|
||||
public let hashValue: Int
|
||||
|
||||
// MARK: - DisplayNameProvider
|
||||
|
||||
@ -61,7 +60,6 @@ public final class Feed: DisplayNameProvider, UnreadCountProvider, Hashable {
|
||||
self.accountID = accountID
|
||||
self.url = url
|
||||
self.feedID = feedID
|
||||
self.hashValue = feedID.hashValue
|
||||
}
|
||||
|
||||
// MARK: - Disk Dictionary
|
||||
@ -162,6 +160,12 @@ public final class Feed: DisplayNameProvider, UnreadCountProvider, Hashable {
|
||||
contentHash = nil
|
||||
}
|
||||
|
||||
// MARK: - Hashable
|
||||
|
||||
public func hash(into hasher: inout Hasher) {
|
||||
hasher.combine(feedID)
|
||||
}
|
||||
|
||||
// MARK: - Equatable
|
||||
|
||||
public class func ==(lhs: Feed, rhs: Feed) -> Bool {
|
||||
|
@ -24,7 +24,6 @@ public final class Folder: DisplayNameProvider, Container, UnreadCountProvider,
|
||||
static let untitledName = NSLocalizedString("Untitled ƒ", comment: "Folder name")
|
||||
public let folderID: Int // not saved: per-run only
|
||||
static var incrementingID = 0
|
||||
public let hashValue: Int
|
||||
|
||||
// MARK: - DisplayNameProvider
|
||||
|
||||
@ -52,7 +51,6 @@ public final class Folder: DisplayNameProvider, Container, UnreadCountProvider,
|
||||
let folderID = Folder.incrementingID
|
||||
Folder.incrementingID += 1
|
||||
self.folderID = folderID
|
||||
self.hashValue = folderID
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(childrenDidChange(_:)), name: .ChildrenDidChange, object: self)
|
||||
@ -142,6 +140,12 @@ public final class Folder: DisplayNameProvider, Container, UnreadCountProvider,
|
||||
updateUnreadCount()
|
||||
}
|
||||
|
||||
// MARK: - Hashable
|
||||
|
||||
public func hash(into hasher: inout Hasher) {
|
||||
hasher.combine(folderID)
|
||||
}
|
||||
|
||||
// MARK: - Equatable
|
||||
|
||||
static public func ==(lhs: Folder, rhs: Folder) -> Bool {
|
||||
|
Loading…
Reference in New Issue
Block a user