Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
{
"editor.formatOnSave": true,
"autoimport.doubleQuotes": false,
"java.configuration.updateBuildConfiguration": "disabled",
"prettier.requireConfig": true,
"javascript.format.enable": true,
"js/ts.format.enabled": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"prettier.tabWidth": 2,
"prettier.useTabs": false,
"javascript.format.semicolons": "insert",
"js/ts.format.semicolons": "insert",
"[scss]": {
"editor.defaultFormatter": "vscode.css-language-features"
},
Expand All @@ -27,6 +25,13 @@
"attr_quotes": "single"
}
},
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"editor.codeActionsOnSave": {
"quickFix.biome": "explicit",
"source.organizeImports.biome": "explicit"
},
"cSpell.words": [
"abap",
"Acode",
Expand Down Expand Up @@ -126,6 +131,7 @@
"flac",
"Flix",
"floobits",
"FOXBIZ",
"Foxdebug",
"freemarker",
"gamemaker",
Expand Down Expand Up @@ -370,10 +376,9 @@
"wtest",
"wxml",
"wxss",
"xhrs",
"XMLHTTP",
"xquery",
"Zeek"
],
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
}
]
}
21 changes: 9 additions & 12 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,15 @@
},
"files": {
"includes": [
"**/src/**/*",
"**/utils/**/*.js",
"!**/www/build/**/*",
"**/www/res/**/*.css",
"**/src/plugins/terminal/**",
"!**/ace-builds",
"!**/src/plugins/**/*",
"!**/plugins/**/*",
"!**/hooks/**/*",
"!**/fastlane/**/*",
"!**/res/**/*",
"!**/platforms/**/*"
"src/**/*.js",
"utils/**/*.js",
"!src/lang/**/*.json",
"!src/plugins/**/*.js",
"!www/**/*",
"!plugins/**/*",
"!hooks/**/*",
"!fastlane/**/*",
"!platforms/**/*"
]
}
}
3 changes: 0 additions & 3 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 13 additions & 10 deletions config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8' ?>
<widget id="com.foxdebug.acode" android-versionCode="967" version="1.11.8"
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.foxdebug.acode" android-versionCode="1000" version="1.12.0"
xmlns="http://www.w3.org/ns/widgets"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:cdv="http://cordova.apache.org/ns/1.0">
Expand All @@ -8,7 +8,7 @@
Light weight code editor and web IDE for android.
</description>
<author email="ajit@foxdebug.com" href="https://foxdebug.com">
Foxdebug
Foxdebug
</author>
<content src="index.html" />
<access launch-external="yes" origin="*" />
Expand All @@ -23,13 +23,14 @@

<platform name="android">
<allow-intent href="market:*" />
<preference name="fullscreen" value="false"/>
<preference name="SplashScreen" value="none"/>
<preference name="ShowTitle" value="true"/>
<preference name="fullscreen" value="false" />
<preference name="SplashScreen" value="none" />
<preference name="ShowTitle" value="true" />
<preference name="DisallowOverscroll" value="true" />
<preference name="BackgroundColor" value="0xFF313131" />
<preference name="AndroidWindowSplashScreenBackground" value="@color/ic_splash_background" />
<preference name="AndroidWindowSplashScreenAnimatedIcon" value="res/android/drawable/ic_launcher_foreground.xml" />
<preference name="AndroidWindowSplashScreenAnimatedIcon"
value="res/android/drawable/ic_launcher_foreground.xml" />
<preference name="AndroidPostSplashScreenTheme" value="@style/Theme.App.Activity" />
<preference name="AndroidPersistentFileLocation" value="Compatibility" />
<preference name="AndroidLaunchMode" value="singleTask" />
Expand All @@ -38,8 +39,9 @@
<preference name="GradlePluginKotlinEnabled" value="true" />
<preference name="android-targetSdkVersion" value="36" />


<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">

<edit-config file="app/src/main/AndroidManifest.xml" mode="merge"
target="/manifest/application">
<application
android:networkSecurityConfig="@xml/network_security_config"
android:hardwareAccelerated="true"
Expand All @@ -49,7 +51,8 @@
android:enableOnBackInvokedCallback="false" />
</edit-config>

<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application/activity[@android:name='MainActivity']">
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge"
target="/manifest/application/activity[@android:name='MainActivity']">
<activity android:resizeableActivity="true" />
</edit-config>

Expand Down
37 changes: 33 additions & 4 deletions hooks/post-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ enableStaticContext();
patchTargetSdkVersion();
enableKeyboardWorkaround();

function getPackageName() {
const configPath = path.resolve(__dirname, '../config.xml');
if (!fs.existsSync(configPath)) {
console.warn('[Cordova Hook] ⚠️ config.xml not found at', configPath);
throw new Error(`config.xml is missing at ${configPath}`);
}
const content = fs.readFileSync(configPath, 'utf-8');
const match = content.match(/id="([^"]+)"/);
const packageName = match ? match[1] : 'com.foxdebug.acode';
return packageName;
}


function getTmpDir() {
const tmpdirEnv = process.env.TMPDIR;
Expand Down Expand Up @@ -107,11 +119,17 @@ function enableLegacyJni() {
const prefix = execSync('npm prefix').toString().trim();
const gradleFile = path.join(prefix, 'platforms/android/app/build.gradle');

if (!fs.existsSync(gradleFile)) return;
if (!fs.existsSync(gradleFile)){
console.warn('[Cordova Hook] ⚠️ build.gradle not found');
return
};

let content = fs.readFileSync(gradleFile, 'utf-8');
// Check for correct block to avoid duplicate insertion
if (content.includes('useLegacyPackaging = true')) return;
if (content.includes('useLegacyPackaging = true')){
console.log('[Cordova Hook] ✅ Legacy JNI packaging already enabled, skipping');
return
};

// Inject under android block with correct Groovy syntax
content = content.replace(/android\s*{/, match => {
Expand All @@ -133,12 +151,16 @@ function enableLegacyJni() {
function enableStaticContext() {
try {
const prefix = execSync('npm prefix').toString().trim();
const packageName = getPackageName();
const mainActivityPath = path.join(
prefix,
'platforms/android/app/src/main/java/com/foxdebug/acode/MainActivity.java'
'platforms/android/app/src/main/java',
packageName.replace(/\./g, '/'),
'MainActivity.java'
);

if (!fs.existsSync(mainActivityPath)) {
console.warn('[Cordova Hook] ⚠️ MainActivity.java not found at', mainActivityPath);
return;
}

Expand All @@ -150,6 +172,7 @@ function enableStaticContext() {
content.includes('public static Context getContext()') &&
content.includes('weakContext = new WeakReference<>(this);')
) {
console.log('[Cordova Hook] ✅ Static context already enabled, skipping');
return;
}

Expand Down Expand Up @@ -181,6 +204,7 @@ function enableStaticContext() {
);

fs.writeFileSync(mainActivityPath, content, 'utf-8');
console.log('[Cordova Hook] ✅ Enabled static context');
} catch (err) {
console.error('[Cordova Hook] ❌ Failed to patch MainActivity:', err.message);
}
Expand All @@ -189,19 +213,24 @@ function enableStaticContext() {
function enableKeyboardWorkaround() {
try{
const prefix = execSync('npm prefix').toString().trim();
const packageName = getPackageName();
const mainActivityPath = path.join(
prefix,
'platforms/android/app/src/main/java/com/foxdebug/acode/MainActivity.java'
'platforms/android/app/src/main/java',
packageName.replace(/\./g, '/'),
'MainActivity.java'
);

if (!fs.existsSync(mainActivityPath)) {
console.warn('[Cordova Hook] ⚠️ MainActivity.java not found at', mainActivityPath);
return;
}

let content = fs.readFileSync(mainActivityPath, 'utf-8');

// Skip if already patched
if (content.includes('SoftInputAssist')) {
console.log('[Cordova Hook] ✅ Keyboard workaround already enabled, skipping');
return;
}

Expand Down
3 changes: 1 addition & 2 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"exclude": ["**/node_modules", "**/platforms", "**/www", "www/js/ace/**/*"],
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"*": ["*"]
"*": ["./src/*"]
}
},
"include": ["src/**/*"],
Expand Down
Loading