Skip to content

Commit 1cc2c9c

Browse files
authored
Add new fields to settings object decode. (#263)
1 parent d473ab9 commit 1cc2c9c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sources/Segment/Settings.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ public struct Settings: Codable {
1212
public var plan: JSON? = nil
1313
public var edgeFunction: JSON? = nil
1414
public var middlewareSettings: JSON? = nil
15+
public var metrics: JSON? = nil
16+
public var consentSettings: JSON? = nil
1517

1618
public init(writeKey: String, apiHost: String) {
1719
integrations = try! JSON([
@@ -37,6 +39,8 @@ public struct Settings: Codable {
3739
self.plan = try? values.decode(JSON.self, forKey: CodingKeys.plan)
3840
self.edgeFunction = try? values.decode(JSON.self, forKey: CodingKeys.edgeFunction)
3941
self.middlewareSettings = try? values.decode(JSON.self, forKey: CodingKeys.middlewareSettings)
42+
self.metrics = try? values.decode(JSON.self, forKey: CodingKeys.metrics)
43+
self.consentSettings = try? values.decode(JSON.self, forKey: CodingKeys.consentSettings)
4044
}
4145

4246
static public func load(from url: URL?) -> Settings? {
@@ -56,6 +60,8 @@ public struct Settings: Codable {
5660
case plan
5761
case edgeFunction
5862
case middlewareSettings
63+
case metrics
64+
case consentSettings
5965
}
6066

6167
/**

0 commit comments

Comments
 (0)