fix(privacy-policy): route non http(s) links out of the WebView#165
Open
jim-daf wants to merge 1 commit into
Open
fix(privacy-policy): route non http(s) links out of the WebView#165jim-daf wants to merge 1 commit into
jim-daf wants to merge 1 commit into
Conversation
The PrivacyPolicyActivity WebView only configures onReceivedError, so any link in the rendered privacy policy with a non http(s) scheme (mailto:, tel:, intent:, market:, geo:, ...) is dispatched to the WebView's default handler. Override shouldOverrideUrlLoading to keep http(s) inside the WebView and route other schemes out via Intent.ACTION_VIEW, catching ActivityNotFoundException so the Activity does not crash if no handler is installed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #164.
PrivacyPolicyActivity.onCreatesets up theWebViewClientwith only anonReceivedErroroverride, so any link in the privacy policy with a non http(s) scheme (mailto:,tel:,intent:,market:,geo:, ...) is dispatched by the default WebView handler instead of leaving the WebView for the system app that registered for that scheme. The visible effect is that tapping amailto:link in the policy text shows nothing.Change
Override
shouldOverrideUrlLoading. Keep http(s) inside the WebView, route other schemes toIntent.ACTION_VIEW, and wrap the launch intry/catch (ActivityNotFoundException)so a device with no handler does not crash the Activity:Behaviour
https://opencloud.eu/privacylink inside the policy keeps loading in the WebView like before.mailto:legal@opencloud.eulink now opens the user's mail app.falseso the user does not see a crash.