mirror of
https://github.com/AeThex-Corporation/AeThex-OS.git
synced 2026-04-17 22:27:19 +00:00
modified: android/app/src/main/java/com/aethex/os/MainActivity.java
This commit is contained in:
parent
711efba2da
commit
afb0b13ef6
10 changed files with 25 additions and 992 deletions
|
|
@ -21,8 +21,6 @@
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
<category android:name="android.intent.category.HOME" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
|
|
|
||||||
|
|
@ -1,77 +1,9 @@
|
||||||
package com.aethex.os;
|
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 com.getcapacitor.BridgeActivity;
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import android.os.Handler;
|
|
||||||
|
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
public class MainActivity extends BridgeActivity {
|
public class MainActivity extends BridgeActivity {
|
||||||
|
// Reverting to standard Capacitor implementation.
|
||||||
@Override
|
// The BridgeActivity handles the WebView creation and loading of assets
|
||||||
public void onStart() {
|
// via the scheme configured in capacitor.config.ts (androidScheme: "https").
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ const config: CapacitorConfig = {
|
||||||
appName: 'AeThex OS',
|
appName: 'AeThex OS',
|
||||||
webDir: 'dist/public',
|
webDir: 'dist/public',
|
||||||
server: {
|
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
|
url: undefined, // Ensure no server URL is set
|
||||||
cleartext: true,
|
cleartext: true,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -97,14 +97,11 @@
|
||||||
/* Disable pull-to-refresh on body */
|
/* Disable pull-to-refresh on body */
|
||||||
body {
|
body {
|
||||||
overscroll-behavior-y: contain;
|
overscroll-behavior-y: contain;
|
||||||
background-color: #FF00FF; /* MAGENTA DEBUG */
|
background-color: #0a0a0a;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
console.log('Index.html loaded - Setting Magenta background');
|
console.log('Index.html loaded');
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
document.body.style.backgroundColor = '#FF00FF';
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,19 @@ export function detectPlatform(): PlatformType {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Capacitor check - sometimes injected late, so don't cache 'web' result immediately
|
// 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) {
|
if (window.Capacitor !== undefined) {
|
||||||
console.log('[Platform] Detected: mobile (Capacitor)');
|
// 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';
|
cachedPlatform = 'mobile';
|
||||||
return cachedPlatform;
|
return cachedPlatform;
|
||||||
|
} else {
|
||||||
|
console.log('[Platform] Capacitor detected but running on web - treating as web');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flutter check
|
// Flutter check
|
||||||
|
|
|
||||||
|
|
@ -1385,6 +1385,7 @@ export default function AeThexOS() {
|
||||||
|
|
||||||
// Native Android App Layout
|
// Native Android App Layout
|
||||||
if (layout.isMobile) {
|
if (layout.isMobile) {
|
||||||
|
console.log('📱 [OS] Rendering MOBILE layout (isMobile=true)', { layout });
|
||||||
const activeWindows = windows.filter(w => !w.minimized);
|
const activeWindows = windows.filter(w => !w.minimized);
|
||||||
const currentWindow = activeWindows[activeWindows.length - 1];
|
const currentWindow = activeWindows[activeWindows.length - 1];
|
||||||
|
|
||||||
|
|
|
||||||
812
dist/public/index.html
vendored
812
dist/public/index.html
vendored
File diff suppressed because one or more lines are too long
95
package-lock.json
generated
95
package-lock.json
generated
|
|
@ -138,7 +138,6 @@
|
||||||
"tsx": "^4.20.5",
|
"tsx": "^4.20.5",
|
||||||
"typescript": "5.6.3",
|
"typescript": "5.6.3",
|
||||||
"vite": "^7.1.9",
|
"vite": "^7.1.9",
|
||||||
"vite-plugin-singlefile": "^2.3.0",
|
|
||||||
"vitest": "^4.0.16"
|
"vitest": "^4.0.16"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
|
|
@ -5416,19 +5415,6 @@
|
||||||
"node": ">= 5.10.0"
|
"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": {
|
"node_modules/browserslist": {
|
||||||
"version": "4.28.1",
|
"version": "4.28.1",
|
||||||
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz",
|
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz",
|
||||||
|
|
@ -6699,19 +6685,6 @@
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"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": {
|
"node_modules/finalhandler": {
|
||||||
"version": "1.3.2",
|
"version": "1.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz",
|
||||||
|
|
@ -7118,16 +7091,6 @@
|
||||||
"node": ">=8"
|
"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": {
|
"node_modules/is-wsl": {
|
||||||
"version": "2.2.0",
|
"version": "2.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
|
||||||
|
|
@ -7600,33 +7563,6 @@
|
||||||
"node": ">= 0.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": {
|
"node_modules/mime": {
|
||||||
"version": "1.6.0",
|
"version": "1.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
|
||||||
|
|
@ -8145,6 +8081,7 @@
|
||||||
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
},
|
},
|
||||||
|
|
@ -9332,19 +9269,6 @@
|
||||||
"node": ">=14.0.0"
|
"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": {
|
"node_modules/toidentifier": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
|
"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": {
|
"node_modules/vite/node_modules/@esbuild/aix-ppc64": {
|
||||||
"version": "0.27.2",
|
"version": "0.27.2",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.2.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.2.tgz",
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,6 @@
|
||||||
"tsx": "^4.20.5",
|
"tsx": "^4.20.5",
|
||||||
"typescript": "5.6.3",
|
"typescript": "5.6.3",
|
||||||
"vite": "^7.1.9",
|
"vite": "^7.1.9",
|
||||||
"vite-plugin-singlefile": "^2.3.0",
|
|
||||||
"vitest": "^4.0.16"
|
"vitest": "^4.0.16"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import tailwindcss from "@tailwindcss/vite";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import runtimeErrorOverlay from "@replit/vite-plugin-runtime-error-modal";
|
import runtimeErrorOverlay from "@replit/vite-plugin-runtime-error-modal";
|
||||||
import { metaImagesPlugin } from "./vite-plugin-meta-images";
|
import { metaImagesPlugin } from "./vite-plugin-meta-images";
|
||||||
import { viteSingleFile } from "vite-plugin-singlefile";
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [
|
plugins: [
|
||||||
|
|
@ -12,7 +11,6 @@ export default defineConfig({
|
||||||
runtimeErrorOverlay(),
|
runtimeErrorOverlay(),
|
||||||
tailwindcss(),
|
tailwindcss(),
|
||||||
metaImagesPlugin(),
|
metaImagesPlugin(),
|
||||||
viteSingleFile(), // <--- INLINE EVERYTHING
|
|
||||||
...(process.env.NODE_ENV !== "production" &&
|
...(process.env.NODE_ENV !== "production" &&
|
||||||
process.env.REPL_ID !== undefined
|
process.env.REPL_ID !== undefined
|
||||||
? [
|
? [
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue