Skip to content

Commit f6741cb

Browse files
evantk91joaodordio
andauthored
Update swift-sdk/Internal/InternalIterableAPI.swift
Co-authored-by: Joao Dordio <[email protected]>
1 parent b54a9c9 commit f6741cb

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

swift-sdk/Internal/InternalIterableAPI.swift

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,19 @@ final class InternalIterableAPI: NSObject, PushTrackerProtocol, AuthProvider {
188188
self._email = nil
189189
self._userId = userId
190190

191-
if(config.enableAnonTracking) {
192-
if(userId != nil && userId != localStorage.userIdAnnon) {
193-
attemptAndProcessMerge(merge: merge ?? true, replay: replay ?? true, destinationUser: userId, isEmail: false, failureHandler: failureHandler)
191+
if config.enableAnonTracking {
192+
if let userId = userId, userId != localStorage.userIdAnnon {
193+
attemptAndProcessMerge(
194+
merge: merge ?? true,
195+
replay: replay ?? true,
196+
destinationUser: userId,
197+
isEmail: false,
198+
failureHandler: failureHandler
199+
)
194200
}
195-
196-
if(!isAnon) {
197-
self.localStorage.userIdAnnon = nil
201+
202+
if !isAnon {
203+
localStorage.userIdAnnon = nil
198204
}
199205
}
200206

0 commit comments

Comments
 (0)