From 70341391b9d4546f245758a3abdea5b79e657600 Mon Sep 17 00:00:00 2001 From: tommasini Date: Sat, 29 Jun 2024 00:33:37 +0100 Subject: [PATCH 1/2] host in sensor permission --- .../com/reactnativecommunity/webview/RNCWebChromeClient.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/reactnativecommunity/webview/RNCWebChromeClient.java b/android/src/main/java/com/reactnativecommunity/webview/RNCWebChromeClient.java index e40a25f8a..fa23412d7 100644 --- a/android/src/main/java/com/reactnativecommunity/webview/RNCWebChromeClient.java +++ b/android/src/main/java/com/reactnativecommunity/webview/RNCWebChromeClient.java @@ -179,8 +179,10 @@ public void onPermissionRequest(final PermissionRequest request) { */ androidPermission = PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID; } } + Uri originUri = request.getOrigin(); + String host = originUri.getHost(); // TODO: RESOURCE_MIDI_SYSEX, RESOURCE_PROTECTED_MEDIA_ID. - String alertMessage = String.format("Allow this app to use your " + requestPermissionIdentifier + "?"); + String alertMessage = String.format("Allow this " + host + " to use your " + requestPermissionIdentifier + "?"); if (androidPermission != null) { if (ContextCompat.checkSelfPermission(this.mWebView.getThemedReactContext(), androidPermission) == PackageManager.PERMISSION_GRANTED) { AlertDialog.Builder builder = new AlertDialog.Builder(this.mWebView.getContext()); From b9a795e4178a823a8959bb2ba3bc6da2e9f52d2b Mon Sep 17 00:00:00 2001 From: tommasini <46944231+tommasini@users.noreply.github.com> Date: Tue, 2 Jul 2024 13:03:32 +0100 Subject: [PATCH 2/2] Update android/src/main/java/com/reactnativecommunity/webview/RNCWebChromeClient.java MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: João Loureiro <1649425+jpcloureiro@users.noreply.github.com> Signed-off-by: tommasini <46944231+tommasini@users.noreply.github.com> --- .../com/reactnativecommunity/webview/RNCWebChromeClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/src/main/java/com/reactnativecommunity/webview/RNCWebChromeClient.java b/android/src/main/java/com/reactnativecommunity/webview/RNCWebChromeClient.java index fa23412d7..746771e58 100644 --- a/android/src/main/java/com/reactnativecommunity/webview/RNCWebChromeClient.java +++ b/android/src/main/java/com/reactnativecommunity/webview/RNCWebChromeClient.java @@ -182,7 +182,7 @@ public void onPermissionRequest(final PermissionRequest request) { Uri originUri = request.getOrigin(); String host = originUri.getHost(); // TODO: RESOURCE_MIDI_SYSEX, RESOURCE_PROTECTED_MEDIA_ID. - String alertMessage = String.format("Allow this " + host + " to use your " + requestPermissionIdentifier + "?"); + String alertMessage = String.format("Allow " + host + " to use your " + requestPermissionIdentifier + "?"); if (androidPermission != null) { if (ContextCompat.checkSelfPermission(this.mWebView.getThemedReactContext(), androidPermission) == PackageManager.PERMISSION_GRANTED) { AlertDialog.Builder builder = new AlertDialog.Builder(this.mWebView.getContext());