android: stop logging console logs from webview
Summary: We're logging all console logs from webview. This strips console logging for non debug builds Reviewed By: AaaChiuuu Differential Revision: D4578071 fbshipit-source-id: 79b21012a6ef215eb35701911662a720cb6be280
This commit is contained in:
parent
1fa95ed390
commit
cb68b97289
|
@ -24,6 +24,7 @@ import android.net.Uri;
|
|||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.webkit.ConsoleMessage;
|
||||
import android.webkit.GeolocationPermissions;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebView;
|
||||
|
@ -331,6 +332,15 @@ public class ReactWebViewManager extends SimpleViewManager<WebView> {
|
|||
protected WebView createViewInstance(ThemedReactContext reactContext) {
|
||||
ReactWebView webView = new ReactWebView(reactContext);
|
||||
webView.setWebChromeClient(new WebChromeClient() {
|
||||
@Override
|
||||
public boolean onConsoleMessage(ConsoleMessage message) {
|
||||
if (ReactBuildConfig.DEBUG) {
|
||||
return super.onConsoleMessage(message);
|
||||
}
|
||||
// Ignore console logs in non debug builds.
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
|
||||
callback.invoke(origin, true, false);
|
||||
|
|
Loading…
Reference in New Issue