Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

[url_launcher] Handling the ActivityNotFoundExeption. #3125

Merged
merged 8 commits into from Oct 23, 2020

Conversation

Sempakonka
Copy link
Contributor

@Sempakonka Sempakonka commented Oct 8, 2020

Description

Currently on android when you call the launch method with an URL of wich there isn't any app installed that can open this URL, java will throw an ActivityNotFoundException. The user can't catch this exception savely in flutter because it was never catched in java.

This PR catches this Exception in java (wich is recommended in the documentation here).
It gives the user the ability to savely catch this exception in flutter.

Related Issues

Issue 66826

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.
  • 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.

@Sempakonka Sempakonka requested a review from mklim as a code owner October 8, 2020 11:09
@google-cla google-cla bot added the cla: yes label Oct 8, 2020
@google-cla
Copy link

google-cla bot commented Oct 8, 2020

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added cla: no and removed cla: yes labels Oct 8, 2020
@Sempakonka
Copy link
Contributor Author

@googlebot I consent.

@google-cla
Copy link

google-cla bot commented Oct 8, 2020

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@mvanbeusekom
Copy link
Contributor

@googlebot I consent.

Copy link
Contributor

@amirh amirh left a comment

Choose a reason for hiding this comment

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

Missing a test

@@ -1,3 +1,7 @@
## 5.7.4

* Added a new `LaunchStatus` to handle the ActivityNotFound exception that `activity.startActivity` can throw.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Let's make this message about what have changed from the plugin's user perspective. e.g maybe something like: "Fixed a crash on Android when there is no activity to handle the URL intent, instead the launch method will now throw a Dart PlatformException." (assuming I got the consequences right, side note: would be helpful to describe the previous bad behavior and the new behavior in the PR description)

@Sempakonka Sempakonka force-pushed the issue-66826 branch 2 times, most recently from 9673f35 to f82e47e Compare October 16, 2020 09:02
Copy link
Contributor

@amirh amirh left a comment

Choose a reason for hiding this comment

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

LGTM

@amirh
Copy link
Contributor

amirh commented Oct 22, 2020

Will land on green

@amirh amirh merged commit 0fbf417 into flutter:master Oct 23, 2020
FlutterSu pushed a commit to FlutterSu/flutter-plugins that referenced this pull request Nov 20, 2020
Catch ActivityNotFoundException and report an error back to the Dart side.
@mvanbeusekom mvanbeusekom deleted the issue-66826 branch September 21, 2021 09:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
3 participants