From 979bf7f5b40e563e5c1d393d831de5640caa29d1 Mon Sep 17 00:00:00 2001 From: Gavin Whelan Date: Fri, 22 Apr 2022 14:12:34 -0400 Subject: [PATCH] Update LDUser to use default equatable instance rather than custom one that only compares keys. (#194) --- LaunchDarkly/LaunchDarkly/Models/LDUser.swift | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/LaunchDarkly/LaunchDarkly/Models/LDUser.swift b/LaunchDarkly/LaunchDarkly/Models/LDUser.swift index 91ec678b..683935d1 100644 --- a/LaunchDarkly/LaunchDarkly/Models/LDUser.swift +++ b/LaunchDarkly/LaunchDarkly/Models/LDUser.swift @@ -7,7 +7,7 @@ typealias UserKey = String // use for identifying semantics for strings, partic The SDK caches last known feature flags for use on app startup to provide continuity with the last app run. Provided the LDClient is online and can establish a connection with LaunchDarkly servers, cached information will only be used a very short time. Once the latest feature flags arrive at the SDK, the SDK no longer uses cached feature flags. The SDK retains feature flags on the last 5 client defined users. The SDK will retain feature flags until they are overwritten by a different user's feature flags, or until the user removes the app from the device. The SDK does not cache user information collected, except for the user key. The user key is used to identify the cached feature flags for that user. Client app developers should use caution not to use sensitive user information as the user-key. */ -public struct LDUser: Encodable { +public struct LDUser: Encodable, Equatable { /// String keys associated with LDUser properties. public enum CodingKeys: String, CodingKey { @@ -179,13 +179,6 @@ public struct LDUser: Encodable { } } -extension LDUser: Equatable { - /// Compares users by comparing their user keys only, to allow the client app to collect user information over time - public static func == (lhs: LDUser, rhs: LDUser) -> Bool { - lhs.key == rhs.key - } -} - /// Class providing ObjC interoperability with the LDUser struct @objc final class LDUserWrapper: NSObject { let wrapped: LDUser