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

[firebase_messaging] Separate onLaunch to a future to be able to retrieve launch message in a synchronous way #1481

Closed
wants to merge 1 commit into from

Conversation

jherencia
Copy link
Contributor

Separate onLaunch to an specific method to be able to retrieve launch message in a synchronous way

Description

When an application is closed an a user opens it by clicking a push notification we can retrieve the message in a synchronous way but the current architecture expects this to be asynchronous which may conflict with other processes run in parallel. This behaviour forces programmers to synchronize those processes and with the added problem that on of the async calls (onLaunch) is not called when the user opens the app in a normal way, so it is needed to add timeouts to limit the time we wait the callback.

Android and iOS let programmers access how the app has been opened in a synchronous way for Dynamic Links, Push notifications, etc. So this PR (and flutter/plugins#1687) fixes this and handles this two situations in a consistent way.

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.

  • 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.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • I signed the CLA.
  • [ x 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.

@jherencia jherencia changed the title [firebase_messaging] Separate onLaunch to an specific method to be ab… [firebase_messaging] Separate onLaunch to a future to be able to retrieve launch message in a synchronous way Nov 22, 2019
@jherencia
Copy link
Contributor Author

  firebase_messaging:
    git:
      url: https://github.com/mrmilu/flutterfire.git
      path: packages/firebase_messaging
      ref: PR-1481-v1

Copy link
Contributor

@ened ened left a comment

Choose a reason for hiding this comment

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

Just a few minor comments. I wonder if we should keep onLaunch method (but mark it deprecated) and add the new method.
That way it would not require a major version bump.

@kroikie wdyt?

@jherencia
Copy link
Contributor Author

Just a few minor comments. I wonder if we should keep onLaunch method (but mark it deprecated) and add the new method.
That way it would not require a major version bump.

Thank you @ened! I marked onLaunch as deprecated and did all the changes you proposed.

  firebase_messaging:
    git:
      url: https://github.com/mrmilu/flutterfire.git
      path: packages/firebase_messaging
      ref: PR-1481-v2

…le to retrieve launch message in a synchronous way
@Salakar Salakar closed this in #4012 Nov 3, 2020
@firebase firebase locked and limited conversation to collaborators Dec 4, 2020
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.

3 participants