From 25ed2dcd565f657c12bcfcb0a3b0278cac572969 Mon Sep 17 00:00:00 2001 From: Chris Leonavicius Date: Wed, 2 Oct 2024 13:35:05 -0700 Subject: [PATCH] feat: expose more configuration in plugins --- .../AmplitudeSegmentSessionReplayPlugin.swift | 8 ++++++-- .../AmplitudeSwiftSessionReplayPlugin.swift | 12 ++++++++++-- .../AmplitudeiOSSessionReplayMiddleware.swift | 12 ++++++++++-- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/Sources/AmplitudeSegmentSessionReplayPlugin/AmplitudeSegmentSessionReplayPlugin.swift b/Sources/AmplitudeSegmentSessionReplayPlugin/AmplitudeSegmentSessionReplayPlugin.swift index 5bea167..95eea58 100644 --- a/Sources/AmplitudeSegmentSessionReplayPlugin/AmplitudeSegmentSessionReplayPlugin.swift +++ b/Sources/AmplitudeSegmentSessionReplayPlugin/AmplitudeSegmentSessionReplayPlugin.swift @@ -27,10 +27,14 @@ public class AmplitudeSegmentSessionReplayPlugin: Plugin { public init(amplitudeApiKey apiKey: String, sampleRate: Float = 0.0, - serverZone: ServerZone = .US) { + serverZone: ServerZone = .US, + maskLevel: MaskLevel = .medium, + enableRemoteConfig: Bool = true) { sessionReplay = SessionReplay(apiKey: apiKey, sampleRate: sampleRate, - serverZone: serverZone) + serverZone: serverZone, + maskLevel: maskLevel, + enableRemoteConfig: enableRemoteConfig) } public func configure(analytics: Analytics) { diff --git a/Sources/AmplitudeSwiftSessionReplayPlugin/AmplitudeSwiftSessionReplayPlugin.swift b/Sources/AmplitudeSwiftSessionReplayPlugin/AmplitudeSwiftSessionReplayPlugin.swift index ff334da..22f42f7 100644 --- a/Sources/AmplitudeSwiftSessionReplayPlugin/AmplitudeSwiftSessionReplayPlugin.swift +++ b/Sources/AmplitudeSwiftSessionReplayPlugin/AmplitudeSwiftSessionReplayPlugin.swift @@ -15,11 +15,17 @@ import AmplitudeSessionReplay private static let sessionReplayProperty = "[Amplitude] Session Replay ID" private let sampleRate: Float + private let maskLevel: MaskLevel + private let enableRemoteConfig: Bool private var sessionReplay: SessionReplay? - @objc public init(sampleRate: Float = 0.0) { + @objc public init(sampleRate: Float = 0.0, + maskLevel: MaskLevel = .medium, + enableRemoteConfig: Bool = true) { self.sampleRate = sampleRate + self.maskLevel = maskLevel + self.enableRemoteConfig = enableRemoteConfig } public func setup(amplitude: Amplitude) { @@ -37,7 +43,9 @@ import AmplitudeSessionReplay optOut: amplitude.configuration.optOut, sampleRate: sampleRate, logger: LoggerWrapper(amplitude.configuration.loggerProvider), - serverZone: serverZone) + serverZone: serverZone, + maskLevel: maskLevel, + enableRemoteConfig: enableRemoteConfig) sessionReplay?.start() } diff --git a/Sources/AmplitudeiOSSessionReplayMiddleware/AmplitudeiOSSessionReplayMiddleware.swift b/Sources/AmplitudeiOSSessionReplayMiddleware/AmplitudeiOSSessionReplayMiddleware.swift index 8c69e50..adf51e9 100644 --- a/Sources/AmplitudeiOSSessionReplayMiddleware/AmplitudeiOSSessionReplayMiddleware.swift +++ b/Sources/AmplitudeiOSSessionReplayMiddleware/AmplitudeiOSSessionReplayMiddleware.swift @@ -11,11 +11,17 @@ import AmplitudeSessionReplay @objc public class AmplitudeiOSSessionReplayMiddleware: NSObject, AMPMiddleware { private let sampleRate: Float + private let maskLevel: AmplitudeSessionReplay.MaskLevel + private let enableRemoteConfig: Bool private var sessionReplay: SessionReplay? - @objc public init(sampleRate: Float = 0.0) { + @objc public init(sampleRate: Float = 0.0, + maskLevel: AmplitudeSessionReplay.MaskLevel = .medium, + enableRemoteConfig: Bool = true) { self.sampleRate = sampleRate + self.maskLevel = maskLevel + self.enableRemoteConfig = enableRemoteConfig } public func amplitudeDidFinishInitializing(_ amplitude: Amplitude) { @@ -34,7 +40,9 @@ import AmplitudeSessionReplay sessionId: amplitude.getSessionId(), optOut: amplitude.optOut, sampleRate: sampleRate, - serverZone: serverZone) + serverZone: serverZone, + maskLevel: maskLevel, + enableRemoteConfig: enableRemoteConfig) sessionReplay?.start() }