-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MOB-9974] fix event replay from visitor to known user #845
base: feature/itbl_track_anon_user
Are you sure you want to change the base?
Conversation
func syncNonSyncedEvents() | ||
func syncEvents() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question on why are we deciding to stop using the syncNonSyncedEvents
method that just adds a delay in execution of the syncEvents
method?
On the InternalIterableAPI method attemptAndProcessMerge
we can easily still call syncNonSyncedEvents
instead right? Is there any reason why we want to use the syncEvents
method directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling that function was clearing the local storage for some odd reason
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I see. Maybe there's a race condition issue then?
if(config.enableAnonTracking) { | ||
if(email != nil) { | ||
attemptAndProcessMerge(merge: merge ?? true, replay: replay ?? true, destinationUser: email, isEmail: true, failureHandler: failureHandler) | ||
} | ||
self.localStorage.userIdAnnon = nil | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(config.enableAnonTracking) { | |
if(email != nil) { | |
attemptAndProcessMerge(merge: merge ?? true, replay: replay ?? true, destinationUser: email, isEmail: true, failureHandler: failureHandler) | |
} | |
self.localStorage.userIdAnnon = nil | |
} | |
if config.enableAnonTracking, let email = email { | |
attemptAndProcessMerge( | |
merge: merge ?? true, | |
replay: replay ?? true, | |
destinationUser: email, | |
isEmail: true, | |
failureHandler: failureHandler | |
) | |
self.localStorage.userIdAnnon = nil | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just code style suggestion. It helps reducing the nesting and makes the code easier to read!
Also, in Swift you don't need to add the ( )
on if statements.
if(config.enableAnonTracking) { | ||
if(userId != nil && userId != localStorage.userIdAnnon) { | ||
attemptAndProcessMerge(merge: merge ?? true, replay: replay ?? true, destinationUser: userId, isEmail: false, failureHandler: failureHandler) | ||
} | ||
|
||
if(!isAnon) { | ||
self.localStorage.userIdAnnon = nil | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(config.enableAnonTracking) { | |
if(userId != nil && userId != localStorage.userIdAnnon) { | |
attemptAndProcessMerge(merge: merge ?? true, replay: replay ?? true, destinationUser: userId, isEmail: false, failureHandler: failureHandler) | |
} | |
if(!isAnon) { | |
self.localStorage.userIdAnnon = nil | |
} | |
} | |
if config.enableAnonTracking { | |
if let userId = userId, userId != localStorage.userIdAnnon { | |
attemptAndProcessMerge( | |
merge: merge ?? true, | |
replay: replay ?? true, | |
destinationUser: userId, | |
isEmail: false, | |
failureHandler: failureHandler | |
) | |
} | |
if !isAnon { | |
localStorage.userIdAnnon = nil | |
} | |
} | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here!
🔹 Jira Ticket(s)
✏️ Description