Skip to content
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

chore: minor fix in identifying user #302

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions ios/wrappers/CioRctWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,11 @@ class CioRctWrapper: NSObject {

@objc
func identify(_ userId: String? = nil, traits: [String: Any]? = nil) {
if let userId, let traits {
CustomerIO.shared.identify(userId: userId, traits: traits)
} else if let userId {
CustomerIO.shared.identify(userId: userId, traits: traits)
} else {
guard let userId = userId else {
// TODO: Add log when logger feature is implemented
return
}
CustomerIO.shared.identify(userId: userId, traits: traits)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this fail if traits are being attached to anonymous profile? Or do you plan to expose separate method for anonymous case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean if traits is nil ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. I mean, when profile is anonymous i.e. userId is nil. But customer wants to attach traits to anonymous profile. Similar to this method in iOS.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, you’re right. This doesn’t meet the anonymous profile criteria. Iwilll go ahead and update it.

Copy link
Collaborator Author

@ami-aman ami-aman Aug 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rehan, I just realized that user identification is covered under a separate ticket, which will also address anonymous profiles.
I think it’s best to leave this change for that ticket to avoid scope creep. I understand that this condition doesn’t resolve the anonymous criteria, but I suggest handling it in the upcoming ticket.​

Though this current change is also a scope creep but I wanted to do it to help testing the package better and as quick as we can.

I am dropping a note in the ticket so that this fix is not overlooked. Does that make sense?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, since the ticket will make any necessary changes required to handle the case for anonymous profile, I'm good with it 👍🏻

flush()
}

Expand Down
Loading