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

Allow attaching completion handler for updating context. #81

Merged

Conversation

DenTelezhkin
Copy link
Contributor

About the changes

This PR adds optional completion handler to updateContext method. This is needed to receive a callback once update is complete.

My use-case:

I need to receive updated configuration after user logs in (several user profile fields are set in context). Those fields can determine A/B test variants and feature flags user can receive. To achieve this, I call updateContext(completion:) before letting user in the app after logging in.

Discussion points

This addition is non-breaking, as parameter has default value of nil.

I also removed stop method call in this function, as stop method is already called in start function. However, this change is optional, I can put it back if maintainers think it's good for consistency.

Copy link
Contributor

@andreas-unleash andreas-unleash left a comment

Choose a reason for hiding this comment

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

LG

@andreas-unleash andreas-unleash merged commit ebf32e6 into Unleash:main Feb 1, 2024
3 checks passed
@andreas-unleash
Copy link
Contributor

@DenTelezhkin Thanks for contributing! v1.2.0 should be out that includes this change

@DenTelezhkin DenTelezhkin deleted the update-context-completion branch February 2, 2024 10:33
@DenTelezhkin DenTelezhkin restored the update-context-completion branch February 19, 2024 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants