From 5d3b378373c9e419c43066ce2832b7ba21452a34 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Tue, 21 Feb 2023 12:35:07 +0100 Subject: [PATCH] Fix Equatable impl for Status and Account (thanks class) --- Packages/Models/Sources/Models/Account.swift | 15 +++++++++++++-- Packages/Models/Sources/Models/Status.swift | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Packages/Models/Sources/Models/Account.swift b/Packages/Models/Sources/Models/Account.swift index d68f4279..9b4ac70e 100644 --- a/Packages/Models/Sources/Models/Account.swift +++ b/Packages/Models/Sources/Models/Account.swift @@ -1,8 +1,19 @@ 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 { - 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) { diff --git a/Packages/Models/Sources/Models/Status.swift b/Packages/Models/Sources/Models/Status.swift index 0d170aaa..390ec912 100644 --- a/Packages/Models/Sources/Models/Status.swift +++ b/Packages/Models/Sources/Models/Status.swift @@ -74,7 +74,7 @@ public final class Status: AnyStatus, Codable, Identifiable, Equatable, Hashable public var userMentioned: 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) {