-
Notifications
You must be signed in to change notification settings - Fork 16
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
setOnBackgroundMessage() is now a Future<void> that will await for the function to complete. #498
Conversation
I made the call to the onPushBackgroundMessage await for the handler to complete.
I changed handleBackgroundMessage() to become a Future<void> and async/await.
I made the BackgroundMessageHandler a Future<void> instead of void so that we can async/await for it to be completed.
Do I need to go and fix these errors that have popped up? There is an AWS error for credentials, I'm not sure how I'm supposed to get past that for a github test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for this pull request. We cannot merge it right now because it appears to introduce breaking changes. However, we are happy to work on this together.
No need, this is because actions run on forked repository and it doesn't have access to secrets |
handleBackgroundMessage now handles when _onBackgroundMessage is defined as void or Future<void> It checks to see if it's a Future and then awaits it if it is.
Changed the cast on BackgroundMessageHandler to dynamic, this allows it to be defined as both void and Future<void>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for updated version, looks good! But could you please run flutter format .
there are some extra whitespaces and linter doesn't like it. Also I am not sure we need to do any changes in lib/src/platform/src/background_android_isolate_platform.dart
I added a comment above. I'm fairly sure that change is required. I can test without it if you like to confirm. Also I'm a bit confused on how to run flutter format. Obviously the command line, but for these changes I made them locally in my installed packages for flutter, and I made a fork and changed them online. I guess I could pull my repo locally, run the command and then push it. But I'm not sure if that would work. Working on packages is all new to me. |
It will be lovely if you test, but I am pretty sure that nothing will change if you rollback changes from
Yeah, this is exactly what I meant, it will work, just push changes in
Nice, my congratulations! :) If you have any questions we are happy to help |
I pushed the changes to my repo. Also I was confused looking for the command "flutter format ." It turns out it was "dart format ." I think everything should be good to go now. |
Huzzah! Is this done now? Or do I need to do anything to resolve the conversation? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@asoap Sorry, still some checks are not passing, so I can't merge it, could you add those changes:
|
Can do. I'm going to be in the middle of some work, but I will try to address this today and test it out to make sure it works before submitting changes. |
Unfortuantely work went long today, and I'll have to address this on Monday. |
I tested these changes and everything is working as expected. I then pushed them to the pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @asoap I'm sorry but formatting checks are still failing and I can't merge. Do you mind if I close the PR and add required changes in new internal PR?
Yeah absolutely, do what you need to do. |
moved to #499 |
This is in regards to this issue here:
#496
If a setOnBackgroundMessage() was fired and if it took to long to complete the isolate on Android would end before the code was completed. This was extra annoying if you were trying to debug a background messsage or if it used other packages that used async/await. Those items just wouldn't fire.
Now all code will complete before the isolate dismisses itself.