From d206a3baf0331c91df3dfbf496e8e5ea6cfe4a01 Mon Sep 17 00:00:00 2001 From: Muzahidul Islam Date: Sat, 23 Nov 2024 08:14:28 +0600 Subject: [PATCH] clean up --- Sources/ODP/OdpManager.swift | 7 ------- Sources/Optimizely/OptimizelyClient.swift | 13 +++++++++---- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Sources/ODP/OdpManager.swift b/Sources/ODP/OdpManager.swift index 32e35e0f..a307e0c8 100644 --- a/Sources/ODP/OdpManager.swift +++ b/Sources/ODP/OdpManager.swift @@ -81,13 +81,6 @@ public class OdpManager { completionHandler: completionHandler) } - func sendInitializedEvent() { - guard let vuid = self.vuid else { - return - } - eventManager?.sendInitializedEvent(vuid: vuid) - } - func identifyUser(userId: String) { guard enabled else { logger.d("ODP identify event is not dispatched (ODP disabled).") diff --git a/Sources/Optimizely/OptimizelyClient.swift b/Sources/Optimizely/OptimizelyClient.swift index c591cafb..27c4f367 100644 --- a/Sources/Optimizely/OptimizelyClient.swift +++ b/Sources/Optimizely/OptimizelyClient.swift @@ -100,7 +100,6 @@ open class OptimizelyClient: NSObject { self.odpManager = odpManager ?? OdpManager(sdkKey: sdkKey, disable: sdkSettings.disableOdp, - vuid: self.vuid, cacheSize: sdkSettings.segmentsCacheSize, cacheTimeoutInSecs: sdkSettings.segmentsCacheTimeoutInSecs, timeoutForSegmentFetchInSecs: sdkSettings.timeoutForSegmentFetchInSecs, @@ -121,9 +120,15 @@ open class OptimizelyClient: NSObject { self.datafileHandler = HandlerRegistryService.shared.injectDatafileHandler(sdkKey: self.sdkKey) self.decisionService = HandlerRegistryService.shared.injectDecisionService(sdkKey: self.sdkKey) self.notificationCenter = HandlerRegistryService.shared.injectNotificationCenter(sdkKey: self.sdkKey) - if vuid != nil { - self.odpManager.vuid = vuid - self.odpManager.sendInitializedEvent() + if let _vuid = vuid { + self.odpManager.vuid = _vuid + try? sendOdpEvent(type: Constants.ODP.eventType, + action: "client_initialized", + identifiers: [ + Constants.ODP.keyForVuid: _vuid + ], + data: [:]) + } logger.d("SDK Version: \(version)") }