SwiftSDK
SwiftSDK copied to clipboard
Allow users to customize default payloads
Some users might want to reduce the default payloads due to privacy concerns.
As well as being able to reduce the default payload (from the ones the SDK provides), it would also be nice if clients were able to add their own defaults.
Currently it's possible for clients to add additional items to the payload through the send function ("additionalPayload") but this could lead to some duplication around the app.
It might be nice to have an API such as:
let configuration = TelemetryManagerConfiguration(appID: "<>")
configuration.defaultPayload["uiTheme"] = "dark-mode"
I would then expect uiTheme to be added to every signal sent after that.
Thoughts?
Yes! @kkostov created a similar architecture in the Kotlin SDK, where you can register individual "enrich" functions with the client, and each enrich function will get a chance to add to the payload before it gets sent. When we're next rethinking the Swift Client, we're planning to use this architecture as well.