diff --git a/Sources/ODP/OdpManager.swift b/Sources/ODP/OdpManager.swift index f5f49a7b..8e6254be 100644 --- a/Sources/ODP/OdpManager.swift +++ b/Sources/ODP/OdpManager.swift @@ -57,13 +57,11 @@ public class OdpManager { cacheTimeoutInSecs: cacheTimeoutInSecs, resourceTimeoutInSecs: timeoutForSegmentFetchInSecs) self.eventManager = eventManager ?? OdpEventManager(sdkKey: sdkKey, - resourceTimeoutInSecs: timeoutForEventDispatchInSecs) + resourceTimeoutInSecs: timeoutForEventDispatchInSecs) + self.odpConfig = OdpConfig() self.segmentManager.odpConfig = odpConfig self.eventManager.odpConfig = odpConfig - if let vuid = vuid, VuidManager.isVuid(vuid) { - self.eventManager.sendInitializedEvent(vuid: vuid) - } } func fetchQualifiedSegments(userId: String, @@ -122,7 +120,7 @@ public class OdpManager { var identifiersUpdated = identifiers - if identifiers[Constants.ODP.keyForVuid] == nil, let _vuid = vuid { + if identifiers[Constants.ODP.keyForVuid] == nil, let _vuid = vuid, VuidManager.isVuid(_vuid) { identifiersUpdated[Constants.ODP.keyForVuid] = _vuid } diff --git a/Sources/Optimizely/OptimizelyClient.swift b/Sources/Optimizely/OptimizelyClient.swift index 20281c17..3f002197 100644 --- a/Sources/Optimizely/OptimizelyClient.swift +++ b/Sources/Optimizely/OptimizelyClient.swift @@ -96,11 +96,11 @@ open class OptimizelyClient: NSObject { self.vuidManager.configure(enable: self.sdkSettings.enableVuid) self.odpManager = odpManager ?? OdpManager(sdkKey: sdkKey, disable: sdkSettings.disableOdp, - vuid: VuidManager.shared.vuid, cacheSize: sdkSettings.segmentsCacheSize, cacheTimeoutInSecs: sdkSettings.segmentsCacheTimeoutInSecs, timeoutForSegmentFetchInSecs: sdkSettings.timeoutForSegmentFetchInSecs, timeoutForEventDispatchInSecs: sdkSettings.timeoutForOdpEventInSecs) + self.odpManager.vuid = self.vuidManager.vuid let userProfileService = userProfileService ?? DefaultUserProfileService() let logger = logger ?? DefaultLogger() type(of: logger).logLevel = defaultLogLevel ?? .info @@ -118,15 +118,15 @@ open class OptimizelyClient: NSObject { self.decisionService = HandlerRegistryService.shared.injectDecisionService(sdkKey: self.sdkKey) self.notificationCenter = HandlerRegistryService.shared.injectNotificationCenter(sdkKey: self.sdkKey) -// if self.enableVuid { -// try? sendOdpEvent(type: Constants.ODP.eventType, -// action: "client_initialized", -// identifiers: [ -// Constants.ODP.keyForVuid: self.vuid -// ], -// data: [:]) -// -// } + if self.enableVuid { + try? sendOdpEvent(type: Constants.ODP.eventType, + action: "client_initialized", + identifiers: [ + Constants.ODP.keyForVuid: self.vuid + ], + data: [:]) + + } logger.d("SDK Version: \(version)") }