Skip to content

Commit

Permalink
Add emitter configuration properties to coder and copying
Browse files Browse the repository at this point in the history
  • Loading branch information
matus-tomlein committed Jan 19, 2024
1 parent 9967f25 commit 48f916f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Sources/Snowplow/Configurations/EmitterConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ public class EmitterConfiguration: SerializableConfiguration, EmitterConfigurati
copy.serverAnonymisation = serverAnonymisation
copy.eventStore = eventStore
copy.retryFailedRequests = retryFailedRequests
copy.maxEventStoreAge = maxEventStoreAge
copy.maxEventStoreSize = maxEventStoreSize
return copy
}

Expand All @@ -333,6 +335,8 @@ public class EmitterConfiguration: SerializableConfiguration, EmitterConfigurati
coder.encode(customRetryForStatusCodes, forKey: "customRetryForStatusCodes")
coder.encode(serverAnonymisation, forKey: "serverAnonymisation")
coder.encode(retryFailedRequests, forKey: "retryFailedRequests")
coder.encode(maxEventStoreAge, forKey: "maxEventStoreAge")
coder.encode(maxEventStoreSize, forKey: "maxEventStoreSize")
}

required init?(coder: NSCoder) {
Expand All @@ -351,5 +355,11 @@ public class EmitterConfiguration: SerializableConfiguration, EmitterConfigurati
if coder.containsValue(forKey: "retryFailedRequests") {
retryFailedRequests = coder.decodeBool(forKey: "retryFailedRequests")
}
if coder.containsValue(forKey: "maxEventStoreAge") {
maxEventStoreAge = coder.decodeDouble(forKey: "maxEventStoreAge")
}
if coder.containsValue(forKey: "maxEventStoreSize") {
maxEventStoreSize = coder.decodeInt64(forKey: "maxEventStoreSize")
}
}
}

0 comments on commit 48f916f

Please sign in to comment.