Skip to content

Commit

Permalink
Add new fields to settings object decode. (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
bsneed authored Oct 26, 2023
1 parent d473ab9 commit 1cc2c9c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Sources/Segment/Settings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand All @@ -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? {
Expand All @@ -56,6 +60,8 @@ public struct Settings: Codable {
case plan
case edgeFunction
case middlewareSettings
case metrics
case consentSettings
}

/**
Expand Down

0 comments on commit 1cc2c9c

Please sign in to comment.