diff --git a/android/app/src/main/java/com/aethex/os/MainActivity.java b/android/app/src/main/java/com/aethex/os/MainActivity.java index 56e64a7..77d59ea 100644 --- a/android/app/src/main/java/com/aethex/os/MainActivity.java +++ b/android/app/src/main/java/com/aethex/os/MainActivity.java @@ -12,19 +12,25 @@ import com.getcapacitor.BridgeActivity; import android.util.Log; +import android.os.Handler; + public class MainActivity extends BridgeActivity { - // Using onStart to hijack the process immediately after bridge init @Override public void onStart() { super.onStart(); if (this.bridge != null && this.bridge.getWebView() != null) { - loadCustomUrl(); + // Delay loading to ensure WebView is ready and avoid race conditions + new Handler().postDelayed(this::loadCustomUrl, 1000); } } private void loadCustomUrl() { WebView webView = this.bridge.getWebView(); + + runOnUiThread(() -> { + Toast.makeText(MainActivity.this, "Resetting & Loading...", Toast.LENGTH_SHORT).show(); + }); // Set WebView background to BLACK webView.setBackgroundColor(0xFF000000); @@ -60,16 +66,13 @@ public class MainActivity extends BridgeActivity { } }); - // Clear cache to ensure we aren't loading stale files + // NUCLEAR CACHE CLEAR webView.clearCache(true); webView.clearHistory(); + webView.clearFormData(); + webView.clearSslPreferences(); // Force load our local test file - // webView.loadUrl("file:///android_asset/public/test.html"); - - // SWITCH TO REAL APP - // Using "file:///android_asset/public/" base path which matches the physical structure - // AND ensuring we load index.html webView.loadUrl("file:///android_asset/public/test_red.html"); } }