@@ -321,10 +321,15 @@ private int pageRectToViewHeight(final @NonNull Activity activity, @NonNull JSON
321
321
}
322
322
323
323
private void updateSafeAreaInsets () {
324
- int [] insets = OSViewUtils .getCutoutAndStatusBarInsets (activity );
325
- String safeAreaInsetsObject = String .format (OSJavaScriptInterface .SAFE_AREA_JS_OBJECT , insets [0 ], insets [1 ], insets [2 ], insets [3 ]);
326
- String safeAreaInsetsFunction = String .format (OSJavaScriptInterface .SET_SAFE_AREA_INSETS_JS_FUNCTION , safeAreaInsetsObject );
327
- webView .evaluateJavascript (safeAreaInsetsFunction , null );
324
+ OSUtils .runOnMainUIThread (new Runnable () {
325
+ @ Override
326
+ public void run () {
327
+ int [] insets = OSViewUtils .getCutoutAndStatusBarInsets (activity );
328
+ String safeAreaInsetsObject = String .format (OSJavaScriptInterface .SAFE_AREA_JS_OBJECT , insets [0 ], insets [1 ], insets [2 ], insets [3 ]);
329
+ String safeAreaInsetsFunction = String .format (OSJavaScriptInterface .SET_SAFE_AREA_INSETS_JS_FUNCTION , safeAreaInsetsObject );
330
+ webView .evaluateJavascript (safeAreaInsetsFunction , null );
331
+ }
332
+ });
328
333
}
329
334
330
335
// Every time an Activity is shown we update the height of the WebView since the available
@@ -513,8 +518,6 @@ private static void enableWebViewRemoteDebugging() {
513
518
private int getWebViewMaxSizeX (Activity activity ) {
514
519
if (messageContent .isFullBleed ()) {
515
520
return getFullbleedWindowWidth (activity );
516
- } else {
517
-
518
521
}
519
522
int margin = (MARGIN_PX_SIZE * 2 );
520
523
return OSViewUtils .getWindowWidth (activity ) - margin ;
0 commit comments