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