modified: android/app/src/main/java/com/aethex/os/MainActivity.java

This commit is contained in:
MrPiglr 2026-02-12 20:15:30 -07:00
parent 711efba2da
commit afb0b13ef6
10 changed files with 25 additions and 992 deletions

View file

@ -21,8 +21,6 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

View file

@ -1,77 +1,9 @@
package com.aethex.os;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebSettings;
import android.webkit.WebViewClient;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceError;
import android.widget.Toast;
import android.app.AlertDialog;
import com.getcapacitor.BridgeActivity;
import android.util.Log;
import android.os.Handler;
import android.view.View;
public class MainActivity extends BridgeActivity {
@Override
public void onStart() {
super.onStart();
if (this.bridge != null && this.bridge.getWebView() != null) {
// 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();
// Disable software rendering (Revert)
// webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
// Set WebView background to BLACK
webView.setBackgroundColor(0xFF000000);
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setDomStorageEnabled(true);
settings.setAllowFileAccess(true);
settings.setAllowContentAccess(true);
settings.setAllowFileAccessFromFileURLs(true);
settings.setAllowUniversalAccessFromFileURLs(true);
// Add WebViewClient to catch errors
webView.setWebViewClient(new WebViewClient() {
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
Log.e("AeThexOS", "WebView Error: " + error.getDescription());
runOnUiThread(() -> {
new AlertDialog.Builder(MainActivity.this)
.setTitle("WebView Error")
.setMessage("Failed to load: " + request.getUrl() + "\n\nReason: " + error.getDescription())
.setPositiveButton("OK", null)
.show();
});
}
@Override
public void onPageFinished(WebView view, String url) {
Log.i("AeThexOS", "Page Loaded: " + url);
runOnUiThread(() -> {
Toast.makeText(MainActivity.this, "Loaded: " + url, Toast.LENGTH_SHORT).show();
});
}
});
// NUCLEAR CACHE CLEAR
webView.clearCache(true);
webView.clearHistory();
// LOAD THE REAL APP (SINGLE FILE BUILD)
webView.loadUrl("file:///android_asset/public/index.html");
}
// Reverting to standard Capacitor implementation.
// The BridgeActivity handles the WebView creation and loading of assets
// via the scheme configured in capacitor.config.ts (androidScheme: "https").
}

View file

@ -10,7 +10,7 @@ const config: CapacitorConfig = {
appName: 'AeThex OS',
webDir: 'dist/public',
server: {
// androidScheme: 'http', // Disable explicit http scheme, let it fall back to file or default
androidScheme: 'https',
url: undefined, // Ensure no server URL is set
cleartext: true,
},

View file

@ -95,16 +95,13 @@
.safe-area-inset-left { padding-left: var(--safe-area-inset-left) !important; }
.safe-area-inset-right { padding-right: var(--safe-area-inset-right) !important; }
/* Disable pull-to-refresh on body */
body {
overscroll-behavior-y: contain;
background-color: #FF00FF; /* MAGENTA DEBUG */
body {
overscroll-behavior-y: contain;
background-color: #0a0a0a;
}
</style>
<script>
console.log('Index.html loaded - Setting Magenta background');
document.addEventListener('DOMContentLoaded', function() {
document.body.style.backgroundColor = '#FF00FF';
});
console.log('Index.html loaded');
</script>
</head>
<body>

View file

@ -37,10 +37,19 @@ export function detectPlatform(): PlatformType {
}
// Capacitor check - sometimes injected late, so don't cache 'web' result immediately
// IMPORTANT: Capacitor has a web implementation that creates window.Capacitor
// We need to check if we're in a REAL native app, not just the web polyfill
if (window.Capacitor !== undefined) {
console.log('[Platform] Detected: mobile (Capacitor)');
cachedPlatform = 'mobile';
return cachedPlatform;
// Check if we're actually in a native app by checking for native platform
const isRealNative = (window.Capacitor as any)?.getPlatform &&
(window.Capacitor as any).getPlatform() !== 'web';
if (isRealNative) {
console.log('[Platform] Detected: mobile (Capacitor native)');
cachedPlatform = 'mobile';
return cachedPlatform;
} else {
console.log('[Platform] Capacitor detected but running on web - treating as web');
}
}
// Flutter check

View file

@ -1385,9 +1385,10 @@ export default function AeThexOS() {
// Native Android App Layout
if (layout.isMobile) {
console.log('📱 [OS] Rendering MOBILE layout (isMobile=true)', { layout });
const activeWindows = windows.filter(w => !w.minimized);
const currentWindow = activeWindows[activeWindows.length - 1];
// Dynamic theme colors based on clearance mode
const isFoundation = clearanceMode === 'foundation';
const mobileTheme = {

812
dist/public/index.html vendored

File diff suppressed because one or more lines are too long

95
package-lock.json generated
View file

@ -138,7 +138,6 @@
"tsx": "^4.20.5",
"typescript": "5.6.3",
"vite": "^7.1.9",
"vite-plugin-singlefile": "^2.3.0",
"vitest": "^4.0.16"
},
"optionalDependencies": {
@ -5416,19 +5415,6 @@
"node": ">= 5.10.0"
}
},
"node_modules/braces": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
"dev": true,
"license": "MIT",
"dependencies": {
"fill-range": "^7.1.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/browserslist": {
"version": "4.28.1",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz",
@ -6699,19 +6685,6 @@
"dev": true,
"license": "MIT"
},
"node_modules/fill-range": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
"dev": true,
"license": "MIT",
"dependencies": {
"to-regex-range": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/finalhandler": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz",
@ -7118,16 +7091,6 @@
"node": ">=8"
}
},
"node_modules/is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.12.0"
}
},
"node_modules/is-wsl": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
@ -7600,33 +7563,6 @@
"node": ">= 0.6"
}
},
"node_modules/micromatch": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
"integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
"dev": true,
"license": "MIT",
"dependencies": {
"braces": "^3.0.3",
"picomatch": "^2.3.1"
},
"engines": {
"node": ">=8.6"
}
},
"node_modules/micromatch/node_modules/picomatch": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8.6"
},
"funding": {
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/mime": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
@ -8145,6 +8081,7 @@
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=12"
},
@ -9332,19 +9269,6 @@
"node": ">=14.0.0"
}
},
"node_modules/to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"is-number": "^7.0.0"
},
"engines": {
"node": ">=8.0"
}
},
"node_modules/toidentifier": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
@ -10254,23 +10178,6 @@
}
}
},
"node_modules/vite-plugin-singlefile": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/vite-plugin-singlefile/-/vite-plugin-singlefile-2.3.0.tgz",
"integrity": "sha512-DAcHzYypM0CasNLSz/WG0VdKOCxGHErfrjOoyIPiNxTPTGmO6rRD/te93n1YL/s+miXq66ipF1brMBikf99c6A==",
"dev": true,
"license": "MIT",
"dependencies": {
"micromatch": "^4.0.8"
},
"engines": {
"node": ">18.0.0"
},
"peerDependencies": {
"rollup": "^4.44.1",
"vite": "^5.4.11 || ^6.0.0 || ^7.0.0"
}
},
"node_modules/vite/node_modules/@esbuild/aix-ppc64": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.2.tgz",

View file

@ -157,7 +157,6 @@
"tsx": "^4.20.5",
"typescript": "5.6.3",
"vite": "^7.1.9",
"vite-plugin-singlefile": "^2.3.0",
"vitest": "^4.0.16"
},
"optionalDependencies": {

View file

@ -4,7 +4,6 @@ import tailwindcss from "@tailwindcss/vite";
import path from "path";
import runtimeErrorOverlay from "@replit/vite-plugin-runtime-error-modal";
import { metaImagesPlugin } from "./vite-plugin-meta-images";
import { viteSingleFile } from "vite-plugin-singlefile";
export default defineConfig({
plugins: [
@ -12,7 +11,6 @@ export default defineConfig({
runtimeErrorOverlay(),
tailwindcss(),
metaImagesPlugin(),
viteSingleFile(), // <--- INLINE EVERYTHING
...(process.env.NODE_ENV !== "production" &&
process.env.REPL_ID !== undefined
? [