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

Throw BrowserSwitchException When Unable to Start Activity #77

Merged
merged 3 commits into from
Dec 12, 2023

Conversation

sarahkoop
Copy link
Contributor

Summary of changes

  • Catch the ActivityNotFoundException that is thrown in BrowserSwitchClient#start when a browser app is not available, and throw a BrowserSwitchException as defined by the method contract
  • Will be used to resolve issue in core SDK

Checklist

  • Added a changelog entry

Authors

List GitHub usernames for everyone who contributed to this pull request.

@sarahkoop sarahkoop requested a review from a team as a code owner December 12, 2023 18:55
activity.startActivity(launchUrlInBrowser);
try {
activity.startActivity(launchUrlInBrowser);
} catch (ActivityNotFoundException e) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Opted for this approach rather than a check if able to perform intent to avoid any false negatives on devices having browsers.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a good catch! I didn't understand at first. ActivityNotFoundException is a runtime exception so it isn't checked by the compiler. This will prevent apps from crashing.

@sarahkoop sarahkoop merged commit 813f29c into main Dec 12, 2023
3 checks passed
@sarahkoop sarahkoop deleted the handle_no_browser branch December 12, 2023 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants