Publish Score iOS SDK 0.4.0

This commit is contained in:
bdot
2026-10-06 22:25:11 -04:00
parent 47531c5192
commit 540823aac1
5 changed files with 51 additions and 17 deletions

View File

@@ -30,7 +30,8 @@ public final class ScoreClient {
locale: String? = nil,
initialConsent: ConsentState = ConsentState.companion.NONE,
pii: PiiOptions? = nil,
tokenRefreshTimeoutSeconds: Double = 5
tokenRefreshTimeoutSeconds: Double = 5,
identifyReplayBufferSize: Int = 100
) {
let config = TrackerConfig(
publishableKey: publishableKey,
@@ -42,7 +43,8 @@ public final class ScoreClient {
config: config,
initialConsent: initialConsent,
pii: pii,
tokenRefreshTimeoutMs: Int64(tokenRefreshTimeoutSeconds * 1000)
tokenRefreshTimeoutMs: Int64(tokenRefreshTimeoutSeconds * 1000),
identifyReplayBufferSize: Int32(identifyReplayBufferSize)
)
}
@@ -82,8 +84,19 @@ public final class ScoreClient {
// MARK: - Identity / Auth0
public func identify(userId: String, token: String? = nil) {
tracker.identify(userId: userId, token: token)
/// Bind events to the fan (#488). Sends an `identify` event carrying
/// `traits` (consent-gated and PII-scrubbed like any props). With
/// `replayAnonymousEvents`, events already sent before sign-in are re-sent
/// with the fan attached, marked `_backfill`, so a vote cast while signed
/// out earns its karma. Events still queued need no replay: they go out
/// with the user on the next flush.
public func identify(
userId: String,
token: String? = nil,
traits: [String: Any] = [:],
replayAnonymousEvents: Bool = false
) {
tracker.identify(userId: userId, token: token, traits: traits, replayAnonymousEvents: replayAnonymousEvents)
}
public func setToken(_ token: String?) { tracker.setToken(token: token) }