Skip to content

fix(messaging,nnbd): regression in RemoteMessage.fromMap() causing silent failure #5336

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

Merged
merged 10 commits into from
Mar 22, 2021
Merged

fix(messaging,nnbd): regression in RemoteMessage.fromMap() causing silent failure #5336

merged 10 commits into from
Mar 22, 2021

Conversation

spacejunky
Copy link
Contributor

@spacejunky spacejunky commented Mar 12, 2021

Description

Proposed correction of Issue #4949, which causes silent discard of incoming FCM's when running under sound null safety.

This not a breaking change but a correction of a previous regression.

Due to multiple problems getting Melos to run on my windows system, despite attempting to follow the Contributor Guide, I have used the firebase_messaging example app to provide a demo of the faulty behavior and its subsequent correction. This is neither unit or integration testing. Sorry!

The changes made to the example app so that it runs under sound null safety (c1fda5b) -- which is when the faulty behavior shows up -- are not the result of any deep thought and are not proposed for merging. The analysis & formatting fails are all to be found in this commit, I believe.

Likewise not tracking.md (f5cd8e5), which just provides commentary for your convenience.

Only the two lines in remote_message.dart, commit 48bc692, are relevant to the issue. I'm sorry that I don't know how to formulate the PR so that it says only that, while still giving you the visibility of the supporting work.

Related Issues

fix #4949

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]).
This will ensure a smooth and quick review process. Updating the pubspec.yaml and changelogs is not required.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (flutter analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md and increment major revision).
  • No, this is not a breaking change.

@google-cla
Copy link

google-cla bot commented Mar 12, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added the cla: no label Mar 12, 2021
@spacejunky
Copy link
Contributor Author

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.

What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@googlebot I signed it!

@google-cla google-cla bot added cla: yes and removed cla: no labels Mar 12, 2021
@spacejunky spacejunky changed the title @spacejunky/fix(#4949) @spacejunky/fix(#4949) FirebaseMessaging: RemoteMessage.fromMap(): regression, faulty handling of 'contentAvailable' & 'mutableContent' Mar 12, 2021
@spacejunky spacejunky marked this pull request as ready for review March 12, 2021 20:09
@spacejunky
Copy link
Contributor Author

I suspect Issue #5324 of being an occurrence of this as well

@spacejunky spacejunky changed the title @spacejunky/fix(#4949) FirebaseMessaging: RemoteMessage.fromMap(): regression, faulty handling of 'contentAvailable' & 'mutableContent' Fix: Correct regression in FirebaseMessaging: RemoteMessage.fromMap() causing silent failure of FCM delivery in sound null safety Mar 12, 2021
@spacejunky spacejunky changed the title Fix: Correct regression in FirebaseMessaging: RemoteMessage.fromMap() causing silent failure of FCM delivery in sound null safety fix: Correct regression in FirebaseMessaging: RemoteMessage.fromMap() causing silent failure of FCM delivery in sound null safety Mar 12, 2021
@GarvMaggu
Copy link

GarvMaggu commented Mar 14, 2021

@spacejunky Hello, my background and foreground message handlers, both were not working on Flutter 2.0.1 and Firebase Messaging 9.0.0 with null safety on. Using this fix, it is working now. Thank you.

@rrousselGit
Copy link
Contributor

Thanks!

Could you add tests for this?
Also the analyzer warnings should be fixed

@spacejunky
Copy link
Contributor Author

Could you add tests for this?

Done

Also the analyzer warnings should be fixed

Analyzer warnings are all in the "rough" coversion of the example app to null-safety, which is not intended (and not suitable, for many reasons) for merging.

Cheers,

@rrousselGit
Copy link
Contributor

rrousselGit commented Mar 19, 2021

Analyzer warnings are all in the "rough" coversion of the example app to null-safety, which is not intended (and not suitable, for many reasons) for merging.

If this is not intended for merging, could you revert the changes? As they cause the CI to fail.

@spacejunky
Copy link
Contributor Author

Moved as requested, noting that I am unable to verify correctness as (due to the multiple melos problems I have encounted) nothing in that part of the tree has will even compile on my system as the package paths are broken.

PS: Is melos supposed to work on Windows systems?

@Salakar Salakar changed the title fix: Correct regression in FirebaseMessaging: RemoteMessage.fromMap() causing silent failure of FCM delivery in sound null safety fix(messaging,nnbd): regression in RemoteMessage.fromMap() causing silent failure Mar 22, 2021
@Salakar Salakar merged commit 64b3005 into firebase:master Mar 22, 2021
@pengw00
Copy link

pengw00 commented Mar 27, 2021

@Salakar hello, is it built to fix the IOS silent issue? haven't seen version updated for this PR.

@firebase firebase locked and limited conversation to collaborators Apr 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FirebaseMessaging: RemoteMessage.fromMap(): regression, faulty handling of 'contentAvailable' & 'mutableContent'
5 participants