From 1cc2c9ca67400f07aa059e6cd844eb6faec4a2b8 Mon Sep 17 00:00:00 2001 From: Brandon Sneed Date: Thu, 26 Oct 2023 10:09:29 -0700 Subject: [PATCH] Add new fields to settings object decode. (#263) --- Sources/Segment/Settings.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/Segment/Settings.swift b/Sources/Segment/Settings.swift index a434cf7e..41a6aeb3 100644 --- a/Sources/Segment/Settings.swift +++ b/Sources/Segment/Settings.swift @@ -12,6 +12,8 @@ public struct Settings: Codable { public var plan: JSON? = nil public var edgeFunction: JSON? = nil public var middlewareSettings: JSON? = nil + public var metrics: JSON? = nil + public var consentSettings: JSON? = nil public init(writeKey: String, apiHost: String) { integrations = try! JSON([ @@ -37,6 +39,8 @@ public struct Settings: Codable { self.plan = try? values.decode(JSON.self, forKey: CodingKeys.plan) self.edgeFunction = try? values.decode(JSON.self, forKey: CodingKeys.edgeFunction) self.middlewareSettings = try? values.decode(JSON.self, forKey: CodingKeys.middlewareSettings) + self.metrics = try? values.decode(JSON.self, forKey: CodingKeys.metrics) + self.consentSettings = try? values.decode(JSON.self, forKey: CodingKeys.consentSettings) } static public func load(from url: URL?) -> Settings? { @@ -56,6 +60,8 @@ public struct Settings: Codable { case plan case edgeFunction case middlewareSettings + case metrics + case consentSettings } /**