Skip to content
Draft
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
134 changes: 126 additions & 8 deletions config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,20 @@
</config-file>

<config-file target="AndroidManifest.xml" parent="./application">
<activity
android:name="com.foxdebug.system.LauncherActivity"
android:exported="false"
android:noHistory="true"
android:relinquishTaskIdentity="true"
android:theme="@android:style/Theme.NoDisplay" />
<activity-alias
android:name=".MainActivityIconDefault"
android:enabled="true"
android:exported="true"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:label="@string/app_name"
android:targetActivity=".MainActivity">
android:targetActivity="com.foxdebug.system.LauncherActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand All @@ -100,7 +106,7 @@
android:icon="@mipmap/ic_acode_pro"
android:roundIcon="@mipmap/ic_acode_pro_round"
android:label="@string/app_name"
android:targetActivity=".MainActivity">
android:targetActivity="com.foxdebug.system.LauncherActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand All @@ -114,7 +120,7 @@
android:icon="@mipmap/ic_acode_midnight_circuit"
android:roundIcon="@mipmap/ic_acode_midnight_circuit_round"
android:label="@string/app_name"
android:targetActivity=".MainActivity">
android:targetActivity="com.foxdebug.system.LauncherActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand All @@ -128,7 +134,7 @@
android:icon="@mipmap/ic_acode_aurora_pulse"
android:roundIcon="@mipmap/ic_acode_aurora_pulse_round"
android:label="@string/app_name"
android:targetActivity=".MainActivity">
android:targetActivity="com.foxdebug.system.LauncherActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand All @@ -142,7 +148,7 @@
android:icon="@mipmap/ic_acode_terminal_glow"
android:roundIcon="@mipmap/ic_acode_terminal_glow_round"
android:label="@string/app_name"
android:targetActivity=".MainActivity">
android:targetActivity="com.foxdebug.system.LauncherActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand All @@ -156,7 +162,7 @@
android:icon="@mipmap/ic_acode_solar_flare"
android:roundIcon="@mipmap/ic_acode_solar_flare_round"
android:label="@string/app_name"
android:targetActivity=".MainActivity">
android:targetActivity="com.foxdebug.system.LauncherActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand All @@ -170,7 +176,7 @@
android:icon="@mipmap/ic_acode_blueprint"
android:roundIcon="@mipmap/ic_acode_blueprint_round"
android:label="@string/app_name"
android:targetActivity=".MainActivity">
android:targetActivity="com.foxdebug.system.LauncherActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand All @@ -184,7 +190,119 @@
android:icon="@mipmap/ic_acode_pixel_party"
android:roundIcon="@mipmap/ic_acode_pixel_party_round"
android:label="@string/app_name"
android:targetActivity=".MainActivity">
android:targetActivity="com.foxdebug.system.LauncherActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>

<activity-alias
android:name=".MainActivityIconPrism"
android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_acode_prism"
android:roundIcon="@mipmap/ic_acode_prism_round"
android:label="@string/app_name"
android:targetActivity="com.foxdebug.system.LauncherActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>

<activity-alias
android:name=".MainActivityIconPorcelain"
android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_acode_porcelain"
android:roundIcon="@mipmap/ic_acode_porcelain_round"
android:label="@string/app_name"
android:targetActivity="com.foxdebug.system.LauncherActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>

<activity-alias
android:name=".MainActivityIconTangerine"
android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_acode_tangerine"
android:roundIcon="@mipmap/ic_acode_tangerine_round"
android:label="@string/app_name"
android:targetActivity="com.foxdebug.system.LauncherActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>

<activity-alias
android:name=".MainActivityIconTidal"
android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_acode_tidal"
android:roundIcon="@mipmap/ic_acode_tidal_round"
android:label="@string/app_name"
android:targetActivity="com.foxdebug.system.LauncherActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>

<activity-alias
android:name=".MainActivityIconLilac"
android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_acode_lilac"
android:roundIcon="@mipmap/ic_acode_lilac_round"
android:label="@string/app_name"
android:targetActivity="com.foxdebug.system.LauncherActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>

<activity-alias
android:name=".MainActivityIconVolt"
android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_acode_volt"
android:roundIcon="@mipmap/ic_acode_volt_round"
android:label="@string/app_name"
android:targetActivity="com.foxdebug.system.LauncherActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>

<activity-alias
android:name=".MainActivityIconCobalt"
android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_acode_cobalt"
android:roundIcon="@mipmap/ic_acode_cobalt_round"
android:label="@string/app_name"
android:targetActivity="com.foxdebug.system.LauncherActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>

<activity-alias
android:name=".MainActivityIconGlacier"
android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_acode_glacier"
android:roundIcon="@mipmap/ic_acode_glacier_round"
android:label="@string/app_name"
android:targetActivity="com.foxdebug.system.LauncherActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand Down
30 changes: 27 additions & 3 deletions hooks/post-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
const path = require('path');
const fs = require('fs');
const { execSync } = require('child_process');
const { parse } = require('elementtree');

const buildFilePath = path.resolve(__dirname, '../build.json');
const copyToPath = path.resolve(__dirname, '../platforms/android/build.json');
Expand Down Expand Up @@ -37,6 +38,30 @@ disableSplashFadeOnRealmeAndroid13();
removeLegacyKeyboardWorkaround();
patchTargetSdkVersion();
stripLauncherFilterFromMainActivity();
syncLauncherActivities();

// Cordova can retain old aliases when their targetActivity changes. Replace
// only our launcher entries, keeping the target activity before its aliases.
function syncLauncherActivities() {
const config = parse(fs.readFileSync(path.resolve(__dirname, '../config.xml'), 'utf8'));
const launcherConfig = config.findall('.//config-file').find(element =>
element.findall('activity').some(activity =>
activity.get('android:name') === 'com.foxdebug.system.LauncherActivity'
)
);
const manifestPath = path.resolve(__dirname, '../platforms/android/app/src/main/AndroidManifest.xml');
if (!launcherConfig || !fs.existsSync(manifestPath)) return;

const manifest = parse(fs.readFileSync(manifestPath, 'utf8'));
const application = manifest.find('application');
const entries = launcherConfig.getchildren();
const names = new Set(entries.map(entry => entry.get('android:name')));
for (const entry of [...application.getchildren()]) {
if (names.has(entry.get('android:name'))) application.remove(entry);
}
for (const entry of entries) application.append(entry);
fs.writeFileSync(manifestPath, manifest.write({ indent: 4 }), 'utf8');
}

function getPackageName() {
const configPath = path.resolve(__dirname, '../config.xml');
Expand Down Expand Up @@ -76,9 +101,8 @@ function getTmpDir() {
/**
* Removes the MAIN/LAUNCHER intent-filter from MainActivity in the generated
* AndroidManifest. The launcher role is handled by activity-aliases instead
* (see config.xml), so that switching app icons at runtime only toggles aliases
* and never disables the running MainActivity component (which would otherwise
* force-stop/restart the app).
* (see config.xml). They forward through LauncherActivity so the editor runs
* under its stable MainActivity component when an icon alias is disabled.
*/
function stripLauncherFilterFromMainActivity() {
const prefix = execSync('npm prefix').toString().trim();
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
"cordova-plugin-system": "file:src/plugins/system",
"cordova-plugin-websocket": "file:src/plugins/websocket",
"css-loader": "^7.1.4",
"elementtree": "^0.1.7",
"happy-dom": "^20.11.6",
"mini-css-extract-plugin": "^2.10.2",
"path-browserify": "^1.0.1",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions res/android/drawable/ic_acode_collection_monochrome.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='utf-8'?>
<vector android:height="108dp" android:viewportHeight="108" android:viewportWidth="108" android:width="108dp" xmlns:android="http://schemas.android.com/apk/res/android"><group android:scaleX="0.09225" android:scaleY="0.09225" android:translateX="28.86328125" android:translateY="33.1171875"><path android:fillColor="#FFFFFF" android:pathData="m216.9 55.7c1.54-9.11 9.61-17.98 16.49-17.98h42.28c9.31 0 17.81 11.45 15 25.95-16.32 84.09-48.75 253.82-63.92 334.21-2.15 11.4-10.51 17.02-16.04 17.02h-36.49c-7.06 0-17.09-9.66-15.71-17.67C176.66 292.05 202.34 141.61 216.9 55.7Z" /><path android:fillColor="#FFFFFF" android:pathData="m327.13 55.71c-1.54-9.11-9.61-17.98-16.49-17.98h-42.28c-9.31 0-17.81 11.45-15 25.95 16.32 84.09 48.75 253.82 63.92 334.21 2.15 11.4 10.51 17.02 16.04 17.02h36.49c7.06 0 17.09-9.66 15.71-17.67-18.15-105.18-43.83-255.62-58.39-341.53Z" /><path android:fillColor="#FFFFFF" android:pathData="M438.86 233.19c-4.64-4.84-53.34-55.72-70.25-72.53-6.23-6.19-6.23-16.45-3.45-23.32 2.17-5.36 8.75-11.32 15.15-11.29h46.31c4.16 0 7.87 2.18 11.59 5.95 20.31 20.55 59 60.43 80.61 83.36 1.44 1.52 2.93 2.88 4.1 4.12 3.54 3.75 4.64 8.13 4.84 11.56.09.93.13 1.8.15 2.58.09 3.59-.81 8.86-4.99 13.27-1.17 1.24-2.66 2.6-4.1 4.12-21.61 22.93-60.3 62.81-80.61 83.36-3.72 3.77-7.43 5.95-11.59 5.95h-46.31c-6.4.03-12.98-5.93-15.15-11.29-2.78-6.87-2.78-17.13 3.45-23.32 16.92-16.79 65.62-67.67 70.25-72.52Z" /><path android:fillColor="#FFFFFF" android:pathData="M105.51 233.77c4.64-4.84 53.34-55.72 70.25-72.53 6.23-6.19 6.23-16.45 3.45-23.32-2.17-5.36-8.75-11.32-15.15-11.29h-46.31c-4.16 0-7.87 2.18-11.59 5.95-20.31 20.55-59 60.43-80.61 83.36-1.44 1.52-2.93 2.88-4.1 4.12-3.54 3.75-4.64 8.13-4.84 11.56-.09.93-.13 1.8-.15 2.58-.09 3.59.81 8.86 4.99 13.27 1.17 1.24 2.66 2.6 4.1 4.12 21.61 22.93 60.3 62.81 80.61 83.36 3.72 3.77 7.43 5.95 11.59 5.95h46.31c6.4.03 12.98-5.93 15.15-11.29 2.78-6.87 2.78-17.13-3.45-23.32-16.91-16.8-65.61-67.68-70.25-72.52Z" /></group></vector>
6 changes: 6 additions & 0 deletions res/android/mipmap-anydpi-v26/ic_acode_cobalt.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_acode_cobalt_background"/>
<foreground android:drawable="@drawable/ic_acode_cobalt_foreground"/>
<monochrome android:drawable="@drawable/ic_acode_collection_monochrome"/>
</adaptive-icon>
6 changes: 6 additions & 0 deletions res/android/mipmap-anydpi-v26/ic_acode_cobalt_round.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_acode_cobalt_background"/>
<foreground android:drawable="@drawable/ic_acode_cobalt_foreground"/>
<monochrome android:drawable="@drawable/ic_acode_collection_monochrome"/>
</adaptive-icon>
6 changes: 6 additions & 0 deletions res/android/mipmap-anydpi-v26/ic_acode_glacier.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_acode_glacier_background"/>
<foreground android:drawable="@drawable/ic_acode_glacier_foreground"/>
<monochrome android:drawable="@drawable/ic_acode_collection_monochrome"/>
</adaptive-icon>
6 changes: 6 additions & 0 deletions res/android/mipmap-anydpi-v26/ic_acode_glacier_round.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_acode_glacier_background"/>
<foreground android:drawable="@drawable/ic_acode_glacier_foreground"/>
<monochrome android:drawable="@drawable/ic_acode_collection_monochrome"/>
</adaptive-icon>
6 changes: 6 additions & 0 deletions res/android/mipmap-anydpi-v26/ic_acode_lilac.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_acode_lilac_background"/>
<foreground android:drawable="@drawable/ic_acode_lilac_foreground"/>
<monochrome android:drawable="@drawable/ic_acode_collection_monochrome"/>
</adaptive-icon>
6 changes: 6 additions & 0 deletions res/android/mipmap-anydpi-v26/ic_acode_lilac_round.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_acode_lilac_background"/>
<foreground android:drawable="@drawable/ic_acode_lilac_foreground"/>
<monochrome android:drawable="@drawable/ic_acode_collection_monochrome"/>
</adaptive-icon>
6 changes: 6 additions & 0 deletions res/android/mipmap-anydpi-v26/ic_acode_porcelain.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_acode_porcelain_background"/>
<foreground android:drawable="@drawable/ic_acode_porcelain_foreground"/>
<monochrome android:drawable="@drawable/ic_acode_collection_monochrome"/>
</adaptive-icon>
6 changes: 6 additions & 0 deletions res/android/mipmap-anydpi-v26/ic_acode_porcelain_round.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_acode_porcelain_background"/>
<foreground android:drawable="@drawable/ic_acode_porcelain_foreground"/>
<monochrome android:drawable="@drawable/ic_acode_collection_monochrome"/>
</adaptive-icon>
6 changes: 6 additions & 0 deletions res/android/mipmap-anydpi-v26/ic_acode_prism.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_acode_prism_background"/>
<foreground android:drawable="@drawable/ic_acode_prism_foreground"/>
<monochrome android:drawable="@drawable/ic_acode_collection_monochrome"/>
</adaptive-icon>
6 changes: 6 additions & 0 deletions res/android/mipmap-anydpi-v26/ic_acode_prism_round.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_acode_prism_background"/>
<foreground android:drawable="@drawable/ic_acode_prism_foreground"/>
<monochrome android:drawable="@drawable/ic_acode_collection_monochrome"/>
</adaptive-icon>
6 changes: 6 additions & 0 deletions res/android/mipmap-anydpi-v26/ic_acode_tangerine.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_acode_tangerine_background"/>
<foreground android:drawable="@drawable/ic_acode_tangerine_foreground"/>
<monochrome android:drawable="@drawable/ic_acode_collection_monochrome"/>
</adaptive-icon>
6 changes: 6 additions & 0 deletions res/android/mipmap-anydpi-v26/ic_acode_tangerine_round.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_acode_tangerine_background"/>
<foreground android:drawable="@drawable/ic_acode_tangerine_foreground"/>
<monochrome android:drawable="@drawable/ic_acode_collection_monochrome"/>
</adaptive-icon>
6 changes: 6 additions & 0 deletions res/android/mipmap-anydpi-v26/ic_acode_tidal.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_acode_tidal_background"/>
<foreground android:drawable="@drawable/ic_acode_tidal_foreground"/>
<monochrome android:drawable="@drawable/ic_acode_collection_monochrome"/>
</adaptive-icon>
Loading