Skip to content

Commit 23ec320

Browse files
Add support for custom attribues
1 parent 885398d commit 23ec320

File tree

1 file changed

+1
-41
lines changed

1 file changed

+1
-41
lines changed
+1-41
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
public struct AppInfo: Equatable {
1+
public struct AppInfo {
22
let appId: String
33
let appName: String
44
let appVersion: String
@@ -24,44 +24,4 @@ public struct AppInfo: Equatable {
2424
self.appLanguage = appLanguage
2525
self.customAttributes = customAttributes
2626
}
27-
28-
public static func ==(lhs: AppInfo, rhs: AppInfo) -> Bool {
29-
return lhs.appId == rhs.appId &&
30-
lhs.appName == rhs.appName &&
31-
lhs.appVersion == rhs.appVersion &&
32-
lhs.platform == rhs.platform &&
33-
lhs.environment == rhs.environment &&
34-
lhs.appLanguage == rhs.appLanguage &&
35-
areDictionariesEqual(lhs.customAttributes, rhs.customAttributes)
36-
}
37-
38-
private static func areDictionariesEqual(_ dict1: [String: Any]?, _ dict2: [String: Any]?) -> Bool {
39-
guard let dict1 = dict1, let dict2 = dict2 else {
40-
return dict1 == nil && dict2 == nil
41-
}
42-
43-
if dict1.count != dict2.count {
44-
return false
45-
}
46-
47-
for (key, value1) in dict1 {
48-
guard let value2 = dict2[key] else {
49-
return false
50-
}
51-
52-
if !areEqual(value1, value2) {
53-
return false
54-
}
55-
}
56-
57-
return true
58-
}
59-
60-
private static func areEqual(_ value1: Any, _ value2: Any) -> Bool {
61-
if let value1 = value1 as? Equatable, let value2 = value2 as? Equatable {
62-
return value1 == value2
63-
}
64-
65-
return false
66-
}
6727
}

0 commit comments

Comments
 (0)