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

Refactor broadcast receiver usage #619

Merged
merged 4 commits into from
Apr 28, 2021
Merged

Refactor broadcast receiver usage #619

merged 4 commits into from
Apr 28, 2021

Conversation

lbalmaceda
Copy link
Contributor

Changes

The broadcast receiver that handles events was being registered right after the lock widget Builder was built. This is because the lock instance is meant to be created once and reused. And while this instance is meant to be released in the (dev's) activity#onDestroy() method, this wasn't consistently documented across the readme.

Calling multiple times builder#build(context) like we used to do in our demo app before this PR, would cause multiple different broadcast receiver instances to be registered. Then the callback would be invoked multiple times after each event.

The right way to clear up resources and broadcast receiver registrations is via the lock#onDestroy(context).

References

Fixes #607

Testing

This part of the code is not unit-tested.

@lbalmaceda lbalmaceda added this to the Major - v3 milestone Apr 27, 2021
@lbalmaceda lbalmaceda requested a review from a team as a code owner April 27, 2021 18:43
Widcket
Widcket previously approved these changes Apr 27, 2021
Widcket
Widcket previously approved these changes Apr 28, 2021
auto-merge was automatically disabled April 28, 2021 15:34

Rebase failed

@lbalmaceda lbalmaceda merged commit fafd7e2 into v3 Apr 28, 2021
@lbalmaceda lbalmaceda deleted the fix-broadcast branch April 28, 2021 18:05
@lbalmaceda lbalmaceda changed the title Fix broadcast receiver usage Refactor broadcast receiver usage May 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AuthenticationCallback methods are only called the first time I login
2 participants