Skip to content

Commit bac7570

Browse files
Replace onGeolocationPermissionsShowPrompt routine
Co-authored-by: João Loureiro <[email protected]> Signed-off-by: Kylan Hurt <[email protected]>
1 parent c3f5fd7 commit bac7570

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

android/src/main/java/com/reactnativecommunity/webview/RNCWebChromeClient.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -245,15 +245,7 @@ public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermiss
245245
requestPermissions(Collections.singletonList(Manifest.permission.ACCESS_FINE_LOCATION));
246246

247247
} else {
248-
String uri = "";
249-
try {
250-
// get current URL for webview
251-
uri = mWebView.getUrl();
252-
// get parsed URL
253-
URI parsedUri = new URI(uri);
254-
// create URL string of origin and path
255-
String formattedUrl = parsedUri.getHost() + parsedUri.getPath();
256-
String alertMessage = String.format("Allow %s to use your location?", formattedUrl);
248+
String alertMessage = String.format("Allow %s to use your location?", origin);
257249
AlertDialog.Builder builder = new AlertDialog.Builder(this.mWebView.getContext());
258250
builder.setMessage(alertMessage);
259251
builder.setCancelable(false);
@@ -269,9 +261,6 @@ public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermiss
269261
Button posButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
270262
posButton.setEnabled(false);
271263
this.runDelayed(() -> posButton.setEnabled(true), 500);
272-
} catch (Exception e) {
273-
System.out.println("URI " + uri + " is a malformed URL");
274-
}
275264
}
276265
}
277266

0 commit comments

Comments
 (0)