andre-paraense / launchdarkly_flutter

A LaunchDarkly Flutter SDK
GNU Lesser General Public License v3.0
4 stars 5 forks source link

Add custom attributes support #20

Closed ookami-kb closed 4 years ago

ookami-kb commented 4 years ago

Requirements

Related issues

Fixes #19

Describe the solution you've provided

Added optional custom argument to init method.

Describe alternatives you've considered

No.

Additional context

No.

How to test?

Pass Map<String, dynamic> custom argument to init method (e.g. {'custom': 'value'}). Check that the corresponding user in LD has this custom attribute set.

Future works

  1. Maybe we should enforce validation for custom parameters. For Android, it checks value types and calls overloaded custom methods; if values are of the wrong type it ignores the value at all. For iOS, it just passes the argument as [String: Any]? to user data.
  2. In Android, we always have user builder, so we pass custom attributes always as well. In iOS, we only create user object if the user key is passed, so custom attributes are only set for an authenticated user. Maybe we should unify this behavior, either by ignoring custom attributes in Android for an anonymous user or by always creating user object in iOS (but it will require creating user key as well).
andre-paraense commented 4 years ago

Awesome, @ookami-kb . Hero! I will definitely find sometime to review your PR this week so we can have a new version as soon as possible! ;)

andre-paraense commented 4 years ago

@ookami-kb if you can update the example app in the repository, it would be a huge bonus for the community. It is always easier for people to adopt the new feature you have contributed if the example app has and example of its usage ;)

Even better if you also update the Readme in the example folder.

andre-paraense commented 4 years ago

@ookami-kb awesome, thanls for the contribution, will be merging this and releasing a new version as soon as possible, probably in the next couple of days! :)

I plan to leave an explicit mention of your name in the version changelog, let me know if you are not comfortable with that.

ookami-kb commented 4 years ago

Cool, nice to hear that!

Yeah, I'm totally ok with it 👍