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

fix(firebase_analytics): allow null values for setDefaultEventParameters() which removes defaults. Permissible on android and iOS. #9135

Merged
merged 5 commits into from Jul 21, 2022

Conversation

ueman
Copy link
Contributor

@ueman ueman commented Jul 18, 2022

Description

As described in the linked issue, setDefaultEventParameters should accept Map<String, Object?>?.


In order to reset default event parameters, you should set the corresponding key to null. In order to reset all parameters, you should pass null.
That's what the documentation for Android and iOS says.

Android:
Parameters to be added to the map of parameters added to every event. They will be added to the map of default event parameters, replacing any existing parameter with the same name. Valid parameter values are String, long, and double. Setting a key's value to null will clear that parameter. Passing in a null bundle will clear all parameters.

iOS:
Parameters to be added to the dictionary of parameters added to every event. They will be added to the dictionary of default event parameters, replacing any existing parameter with the same name. Valid parameters are String, Int, and Double. Setting a key’s value to NSNull() will clear that parameter. Passing in a nil dictionary will clear all parameters.

However, the Dart code only accepts Map<String, Object> according to the docs.

Since this fixes a bug, this is not a breaking change.

Related Issues

Fixes #9005.

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 (melos run 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.
  • No, this is not a breaking change.

@ueman ueman marked this pull request as ready for review July 18, 2022 09:36
@Lyokone
Copy link
Contributor

Lyokone commented Jul 20, 2022

Hello @ueman, thanks for your contribution :)
LGTM, just need to rebase from master for CI to go green :)

Copy link
Member

@russellwheatley russellwheatley left a comment

Choose a reason for hiding this comment

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

Do you mind adding an e2e test here which also tests setDefaultEventParameters() passing a null value? Thanks 🙏

@russellwheatley russellwheatley changed the title fix(firebase_analytics): Fix setDefaultEventParameters by making it more nullable fix(firebase_analytics): allow null values for setDefaultEventParameters() which removes defaults. Permissible on android and iOS. Jul 20, 2022
@russellwheatley russellwheatley added type: bug Something isn't working plugin: analytics labels Jul 20, 2022
@ueman
Copy link
Contributor Author

ueman commented Jul 20, 2022

Do you mind adding an e2e test here which also tests setDefaultEventParameters() passing a null value? Thanks 🙏

Yes, will do

@ueman
Copy link
Contributor Author

ueman commented Jul 20, 2022

@russellwheatley Done ✅

@russellwheatley russellwheatley merged commit dff46a3 into firebase:master Jul 21, 2022
@ueman ueman deleted the fix-9005 branch July 21, 2022 13:33
@firebase firebase locked and limited conversation to collaborators Aug 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
plugin: analytics type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 [firebase_analytics] FirebaseAnalytics.setDefaultEventParameters() should accept Map<String, Object?>?
3 participants