-
Notifications
You must be signed in to change notification settings - Fork 39
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
feat: add alias api with previousId support #554
Merged
SKannaniOS
merged 11 commits into
develop
from
feat/sdk-2669-add-previousId-support-in-alias-api
Dec 9, 2024
Merged
feat: add alias api with previousId support #554
SKannaniOS
merged 11 commits into
develop
from
feat/sdk-2669-add-previousId-support-in-alias-api
Dec 9, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SKannaniOS
reviewed
Dec 2, 2024
Sources/Classes/RSClient.m
Outdated
Comment on lines
243
to
253
NSObject *prevId = nil; | ||
if (previousId != nil) { | ||
prevId = previousId; | ||
} else { | ||
prevId = [traits objectForKey:@"userId"]; | ||
if(prevId == nil) { | ||
prevId =[traits objectForKey:@"id"]; | ||
} | ||
if (prevId == nil) { | ||
prevId = self.anonymousId; | ||
} |
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.
To simplify multiple if conditions, use the Ternary Conditional Operator (?:) as shown below.
NSObject *prevId = previousId ?: [traits objectForKey:@"userId"] ?: [traits objectForKey:@"id"] ?: self.anonymousId;
…into feat/sdk-2669-add-previousId-support-in-alias-api
SKannaniOS
approved these changes
Dec 2, 2024
SKannaniOS
previously approved these changes
Dec 2, 2024
ChryssaAliferi
previously approved these changes
Dec 6, 2024
1abhishekpandey
dismissed stale reviews from ChryssaAliferi and SKannaniOS
December 6, 2024 10:57
The base branch was changed.
SKannaniOS
previously approved these changes
Dec 6, 2024
…previousId-support-in-alias-api
SKannaniOS
approved these changes
Dec 9, 2024
ChryssaAliferi
approved these changes
Dec 9, 2024
1abhishekpandey
deleted the
feat/sdk-2669-add-previousId-support-in-alias-api
branch
December 9, 2024 10:59
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Alias
API withpreviousId
support. Now,previousId
can be passed and will be preferred over the existinguserId
oranonymousId
.previousId
can be explicitly passed if needed.NOTE: The change is backwards compatible, as we are introducing a new Alias API which adds a new behaviour to the existing payload schema.
How to test
Objective: We need to test, if
previousId
is passed then it should be used, else the existing behaviour should continue i.e., userId or anonymousId should be used.alias
event and explicitly passpreviousId
field -> It should be set as thepreviousId
.RESET
call and then analias
event (with previousId) ->previousId
should be set as passed previousId.alias
event with onlynewId
->previousId
should be set asanonymousId
.alias
event with onlynewId
andoptions
->previousId
should be set asanonymousId
.identify
event and then analias
event (without previousId) ->previousId
should be set as previous userId.RESET
call and then analias
event (without previousId) ->previousId
should be set asanonymousId
.