Skip to content

Commit 0e4d3c4

Browse files
vuid optional make empty string
1 parent 62ae49b commit 0e4d3c4

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

Sources/Optimizely+Decide/OptimizelyClient+Decide.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ extension OptimizelyClient {
3636
/// - Parameter attributes: A map of attribute names to current user attribute values.
3737
/// - Returns: An OptimizelyUserContext associated with this OptimizelyClient
3838
public func createUserContext(attributes: [String: Any]? = nil) -> OptimizelyUserContext? {
39-
guard enableVuid, let vuid = self.vuid else {
39+
guard enableVuid else {
4040
logger.e("Vuid is not enabled or invalid VUID. User context not created.")
4141
return nil
4242
}

Sources/Optimizely/OptimizelyClient.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,14 @@ open class OptimizelyClient: NSObject {
118118
self.decisionService = HandlerRegistryService.shared.injectDecisionService(sdkKey: self.sdkKey)
119119
self.notificationCenter = HandlerRegistryService.shared.injectNotificationCenter(sdkKey: self.sdkKey)
120120

121-
if let _vuid = self.vuidManager.vuid {
122-
try? sendOdpEvent(type: Constants.ODP.eventType,
123-
action: "client_initialized",
124-
identifiers: [
125-
Constants.ODP.keyForVuid: _vuid
126-
],
127-
data: [:])
128-
}
121+
122+
try? sendOdpEvent(type: Constants.ODP.eventType,
123+
action: "client_initialized",
124+
identifiers: [
125+
Constants.ODP.keyForVuid: self.vuid
126+
],
127+
data: [:])
128+
129129

130130

131131
logger.d("SDK Version: \(version)")
@@ -984,7 +984,7 @@ extension OptimizelyClient {
984984
}
985985

986986
/// the device vuid (read only)
987-
public var vuid: String? {
987+
public var vuid: String {
988988
return self.vuidManager.vuid
989989
}
990990

Sources/Optimizely/VuidManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ public class VuidManager {
5252
// MARK: - VUID Store
5353

5454
extension VuidManager {
55-
public var vuid: String? {
55+
public var vuid: String {
5656
if self.enable {
5757
return _vuid
5858
} else {
5959
logger.w("VUID is not enabled.")
60-
return nil
60+
return ""
6161
}
6262
}
6363

0 commit comments

Comments
 (0)