try to avoid FILL500 getting stuck in some devices

This commit is contained in:
adbenitez
2024-12-19 15:48:57 +01:00
parent 08e4229533
commit 0dae71f4b7
@@ -67,6 +67,7 @@ public class WebxdcActivity extends WebViewActivity implements DcEventCenter.DcE
private static final String EXTRA_HIDE_ACTION_BAR = "hideActionBar";
private static final String EXTRA_HREF = "href";
private static final int REQUEST_CODE_FILE_PICKER = 51426;
private static long lastOpenTime = 0;
private ValueCallback<Uri[]> filePathCallback;
private DcContext dcContext;
@@ -233,7 +234,16 @@ public class WebxdcActivity extends WebViewActivity implements DcEventCenter.DcE
e.printStackTrace();
}
webView.loadUrl(this.baseURL + "/webxdc_bootstrap324567869.html?i=" + (internetAccess? "1" : "0") + "&href=" + encodedHref);
long now = System.currentTimeMillis();
long timeDelta = now - lastOpenTime;
lastOpenTime = now;
final String url = this.baseURL + "/webxdc_bootstrap324567869.html?i=" + (internetAccess? "1" : "0") + "&href=" + encodedHref;
Util.runOnAnyBackgroundThread(() -> {
if (timeDelta < 2000) Util.sleep(1000);
Util.runOnMain(() -> {
webView.loadUrl(url);
});
});
Util.runOnAnyBackgroundThread(() -> {
final DcChat chat = dcContext.getChat(dcAppMsg.getChatId());