Merged
Conversation
Contributor
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
.yarn/patches/@metamask-react-native-webview-npm-14.5.0-b34fed6d50.patch
Show resolved
Hide resolved
smilingkylan
reviewed
Nov 5, 2025
.yarn/patches/@metamask-react-native-webview-npm-14.5.0-b34fed6d50.patch
Show resolved
Hide resolved
smilingkylan
approved these changes
Nov 5, 2025
.yarn/patches/@metamask-react-native-webview-npm-14.5.0-b34fed6d50.patch
Show resolved
Hide resolved
MarioAslau
approved these changes
Nov 5, 2025
sethkfman
reviewed
Nov 5, 2025
.yarn/patches/@metamask-react-native-webview-npm-14.5.0-b34fed6d50.patch
Show resolved
Hide resolved
.yarn/patches/@metamask-react-native-webview-npm-14.5.0-b34fed6d50.patch
Show resolved
Hide resolved
|
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.



Description
The app crashes on Android when users grant camera + microphone permissions through the in-app browser (e.g., visiting https://permission.site/).
Root Cause:
The WebView permission handling code had a fundamental architectural flaw when multiple permissions (camera + microphone) were requested simultaneously:
Old behavior: Showed separate dialogs for each permission (one for camera, one for microphone)
Each dialog's "Allow" button independently called request.grant()
Android's WebView API only allows calling grant() or deny() once per permission request
When the user clicked "Allow" on the second dialog → CRASH: "Either grant() or deny() has been already called"
Solution:
Rewrote the permission handling logic in RNCWebChromeClient.java:
Changed permission handling to show ONE dialog for all permissions:
Android build for this PR: https://app.bitrise.io/build/560c02e8-611e-4bfd-a24c-34e69751c86b?tab=artifacts
PR to browser: MetaMask/react-native-webview-mm#72
Changelog
CHANGELOG entry:null
Related issues
Fixes: #22162
Manual testing steps
Screenshots/Recordings
Before
Android Before

After
Android After

Pre-merge author checklist
Pre-merge reviewer checklist
Note
Consolidates Android WebView permission flow into a single dialog with a single grant call for multiple resources, adds error handling, and delivers via a Yarn patch of @metamask/react-native-webview.
RNCWebChromeClient.java):request.grant()once; mapCAMERA→RESOURCE_VIDEO_CAPTURE,RECORD_AUDIO→RESOURCE_AUDIO_CAPTURE, handleRESOURCE_PROTECTED_MEDIA_ID.permissionRequest/grantedPermissionslifecycle; only setpermissionRequestwhen system permissions must be requested.grant()withtry/catchto ignoreIllegalStateExceptionand prevent duplicate grant/deny errors.@metamask/react-native-webview@14.5.0via.yarn/patches/...; updatepackage.jsonandyarn.lock.Written by Cursor Bugbot for commit 7396b7f. This will update automatically on new commits. Configure here.