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

recordUserDetails should have it's counterpart to safely update custom properties #69

Closed
delebedev opened this issue Jan 14, 2016 · 6 comments

Comments

@delebedev
Copy link

SDK should allow to query current user details
- (NSDictionary *)currentUserDetails

Use case for that:

  1. I'm setting custom property on user upon initialization:
    [[Countly sharedInstance] recordUserDetails:@{kCLYUserCustom: @{@"prop": @1}}]
  2. Then in completely different part of the app I want to set another property:
    [[Countly sharedInstance] recordUserDetails:@{kCLYUserCustom: @{@"prop2": @"another"}}]

Which apparently wipes my first property.

Proposed approach is to query currentUserDetails and update this collection as necessary, then perform
[[Countly sharedInstance] recordUserDetails:adjustedUserDetails]

Another possible solution is to iterate kCLYUserCustom inside SDK and update keys in the same fashion as predefined keys (e.g. name or birthday) -- checking if they are non-nil before updating.

Would be happy to make PR, just let me know what approach is preferred.

@erkanyildiz
Copy link
Member

Hello,

I will make sure the new SDK follows these new rules about user details soon:
http://resources.count.ly/docs/sdk-development-guide#section-user-details

push and pushUnique methods on pseudo code should be ok, right?

@delebedev
Copy link
Author

@erkanyildiz Documentation still looks not very obvious for me, sorry. Just to confirm:

Countly.userData.push(string key, string value) is going to append user properties to existing value of the property and form an array
Countly.userData.pushUnique(string key, string value) is going to replace particular user property

is that correct?

@ar2rsawseen
Copy link
Member

@garnett those two methods you listed will be used for custom properties and they will create an array property with many possible values, in first situation with possible duplicatevalues in second only with unique values

@delebedev
Copy link
Author

I see, thanks @ar2rsawseen. Is there any approximate estimation of rolling this changes out?

@erkanyildiz
Copy link
Member

We can say within this month.

@erkanyildiz
Copy link
Member

This commit solves it: f2ac81f

Soon we will merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants