Skip to content

LoginFragment: route non-auth URLs out of the WebView#221

Open
jim-daf wants to merge 1 commit into
cv-project-app:masterfrom
jim-daf:webview-scope-auth-flow
Open

LoginFragment: route non-auth URLs out of the WebView#221
jim-daf wants to merge 1 commit into
cv-project-app:masterfrom
jim-daf:webview-scope-auth-flow

Conversation

@jim-daf

@jim-daf jim-daf commented May 19, 2026

Copy link
Copy Markdown

Closes #220.

LoginFragment.setupWebBrowser only overrode onPageStarted / onPageFinished, so any link the auth pages or Common Voice landing page rendered (privacy/terms/contact, mailto:, off-host stuff) loaded inside the login WebView. That breaks the cookie pickup in onPageFinished and traps the user on a side page.

Change

Add shouldOverrideUrlLoading. Keep the WebView pinned to the hosts the OAuth flow actually uses (commonvoice.mozilla.org, auth.mozilla.auth0.com, plus *.mozilla.org / *.auth0.com for redirect hops). Hand any other URL to Intent.ACTION_VIEW via the system, wrapped in try/catch(ActivityNotFoundException) so an unhandled scheme cannot crash the fragment.

The success path (Common Voice -> Auth0 -> Common Voice with connect.sid) is unchanged. Imports for ActivityNotFoundException and WebResourceRequest are added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Login WebView follows any URL through commonvoice.mozilla.org

1 participant