Fix Equatable impl for Status and Account (thanks class)

This commit is contained in:
Thomas Ricouard 2023-02-21 12:35:07 +01:00
parent b643dda083
commit 5d3b378373
2 changed files with 14 additions and 3 deletions

View File

@ -1,8 +1,19 @@
import Foundation import Foundation
public final class Account: Codable, Identifiable, Equatable, Hashable, Sendable { public final class Account: Codable, Identifiable, Hashable, Sendable, Equatable {
public static func == (lhs: Account, rhs: Account) -> Bool { public static func == (lhs: Account, rhs: Account) -> Bool {
lhs.id == rhs.id lhs.id == rhs.id &&
lhs.username == rhs.username &&
lhs.note.asRawText == rhs.note.asRawText &&
lhs.statusesCount == rhs.statusesCount &&
lhs.followersCount == rhs.followersCount &&
lhs.followingCount == rhs.followingCount &&
lhs.acct == rhs.acct &&
lhs.displayName == rhs.displayName &&
lhs.fields == rhs.fields &&
lhs.lastStatusAt == rhs.lastStatusAt &&
lhs.discoverable == rhs.discoverable &&
lhs.bot == rhs.bot
} }
public func hash(into hasher: inout Hasher) { public func hash(into hasher: inout Hasher) {

View File

@ -74,7 +74,7 @@ public final class Status: AnyStatus, Codable, Identifiable, Equatable, Hashable
public var userMentioned: Bool? public var userMentioned: Bool?
public static func == (lhs: Status, rhs: Status) -> Bool { public static func == (lhs: Status, rhs: Status) -> Bool {
lhs.id == rhs.id lhs.id == rhs.id && lhs.viewId == rhs.viewId
} }
public func hash(into hasher: inout Hasher) { public func hash(into hasher: inout Hasher) {