From 8e579b1f57ac311e925a6cc60a7efa995850d069 Mon Sep 17 00:00:00 2001 From: RohitKushvaha01 Date: Sat, 28 Mar 2026 14:31:00 +0530 Subject: [PATCH 1/5] feat: improve launchApp --- .../android/com/foxdebug/system/System.java | 31 ++++++++++++++----- src/plugins/system/www/plugin.js | 4 +-- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/plugins/system/android/com/foxdebug/system/System.java b/src/plugins/system/android/com/foxdebug/system/System.java index 0c32cdfe2..2100ba4c6 100644 --- a/src/plugins/system/android/com/foxdebug/system/System.java +++ b/src/plugins/system/android/com/foxdebug/system/System.java @@ -1564,7 +1564,7 @@ private void openInBrowser(String src, CallbackContext callback) { private void launchApp( String appId, String className, - String data, + JSONObject extras, CallbackContext callback ) { if (appId == null || appId.equals("")) { @@ -1582,21 +1582,38 @@ private void launchApp( intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.setPackage(appId); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent.setClassName(appId, className); + + if (extras != null) { + Iterator keys = extras.keys(); + + while (keys.hasNext()) { + String key = keys.next(); + Object value = extras.get(key); - if (data != null && !data.equals("")) { - intent.putExtra("acode_data", data); + if (value instanceof Integer) { + intent.putExtra(key, (Integer) value); + } else if (value instanceof Boolean) { + intent.putExtra(key, (Boolean) value); + } else if (value instanceof Double) { + intent.putExtra(key, (Double) value); + } else if (value instanceof Long) { + intent.putExtra(key, (Long) value); + } else if (value instanceof String) { + intent.putExtra(key, (String) value); + } else { + intent.putExtra(key, value.toString()); + } + } } - intent.setClassName(appId, className); activity.startActivity(intent); callback.success("Launched " + appId); + } catch (Exception e) { callback.error(e.toString()); - return; } - - } diff --git a/src/plugins/system/www/plugin.js b/src/plugins/system/www/plugin.js index 939c130c7..624fc4c6d 100644 --- a/src/plugins/system/www/plugin.js +++ b/src/plugins/system/www/plugin.js @@ -126,8 +126,8 @@ module.exports = { openInBrowser: function (src) { cordova.exec(null, null, 'System', 'open-in-browser', [src]); }, - launchApp: function (app, className, data, onSuccess, onFail) { - cordova.exec(onSuccess, onFail, 'System', 'launch-app', [app, className, data]); + launchApp: function (app, className, extras, onSuccess, onFail) { + cordova.exec(onSuccess, onFail, 'System', 'launch-app', [app, className, extras]); }, inAppBrowser: function (url, title, showButtons, disableCache) { var myInAppBrowser = { From b667f7a2d4b41f52f59861cf01ce030002da0180 Mon Sep 17 00:00:00 2001 From: RohitKushvaha01 Date: Sat, 28 Mar 2026 14:34:22 +0530 Subject: [PATCH 2/5] feat: added jsdoc --- src/plugins/system/www/plugin.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/plugins/system/www/plugin.js b/src/plugins/system/www/plugin.js index 624fc4c6d..49727ad4b 100644 --- a/src/plugins/system/www/plugin.js +++ b/src/plugins/system/www/plugin.js @@ -126,6 +126,28 @@ module.exports = { openInBrowser: function (src) { cordova.exec(null, null, 'System', 'open-in-browser', [src]); }, + /** + * Launch an Android application activity. + * + * @param {string} app - Package name of the application (e.g. `com.example.app`). + * @param {string} className - Fully qualified activity class name (e.g. `com.example.app.MainActivity`). + * @param {Object} [extras] - Optional key-value pairs passed as Intent extras. + * @param {(message: string) => void} [onSuccess] - Callback invoked when the activity launches successfully. + * @param {(error: any) => void} [onFail] - Callback invoked if launching the activity fails. + * + * @example + * System.launchApp( + * "com.example.app", + * "com.example.app.MainActivity", + * { + * user: "example", + * age: 20, + * premium: true + * }, + * (msg) => console.log(msg), + * (err) => console.error(err) + * ); + */ launchApp: function (app, className, extras, onSuccess, onFail) { cordova.exec(onSuccess, onFail, 'System', 'launch-app', [app, className, extras]); }, From 2c5074b9420919e0f33ef49a54fd33d4b23295e3 Mon Sep 17 00:00:00 2001 From: RohitKushvaha01 Date: Sat, 28 Mar 2026 14:36:11 +0530 Subject: [PATCH 3/5] format --- biome.json | 2 +- src/components/lspInfoDialog/index.js | 34 ++++----- src/components/settingsPage.js | 12 ++-- src/components/toast/index.js | 14 ++-- src/dialogs/select.js | 6 +- src/pages/fontManager/fontManager.js | 28 ++++---- src/pages/plugin/plugin.view.js | 100 +++++++++++++------------- src/sidebarApps/extensions/index.js | 30 ++++---- 8 files changed, 117 insertions(+), 109 deletions(-) diff --git a/biome.json b/biome.json index 40b499694..2ee8fb48b 100644 --- a/biome.json +++ b/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/2.1.4/schema.json", + "$schema": "https://biomejs.dev/schemas/2.4.6/schema.json", "formatter": { "enabled": true, "indentStyle": "tab" diff --git a/src/components/lspInfoDialog/index.js b/src/components/lspInfoDialog/index.js index c2fa2e4e1..eb6a1d369 100644 --- a/src/components/lspInfoDialog/index.js +++ b/src/components/lspInfoDialog/index.js @@ -634,22 +634,24 @@ function showLspInfoDialog() {
- {logs.length === 0 - ?
No logs yet
- : logs.slice(-50).map((log) => { - const time = log.timestamp.toLocaleTimeString("en-US", { - hour12: false, - hour: "2-digit", - minute: "2-digit", - second: "2-digit", - }); - return ( -
- {time} - {log.message} -
- ); - })} + {logs.length === 0 ? ( +
No logs yet
+ ) : ( + logs.slice(-50).map((log) => { + const time = log.timestamp.toLocaleTimeString("en-US", { + hour12: false, + hour: "2-digit", + minute: "2-digit", + second: "2-digit", + }); + return ( +
+ {time} + {log.message} +
+ ); + }) + )}
); diff --git a/src/components/settingsPage.js b/src/components/settingsPage.js index 53b02db68..2e04e76a7 100644 --- a/src/components/settingsPage.js +++ b/src/components/settingsPage.js @@ -435,9 +435,9 @@ function createTrailingValueDisplay(item) { return (
{$trailingValueText} - {item.select - ? - : null} + {item.select ? ( + + ) : null}
); } @@ -491,9 +491,9 @@ function buildListContent(renderedItems, options) { function createSectionElements(category) { const shouldShowLabel = category !== "__default__"; - const $label = shouldShowLabel - ?
{category}
- : null; + const $label = shouldShowLabel ? ( +
{category}
+ ) : null; const $card =
; return { $card, diff --git a/src/components/toast/index.js b/src/components/toast/index.js index 18f40b85a..17eccf0d0 100644 --- a/src/components/toast/index.js +++ b/src/components/toast/index.js @@ -19,12 +19,14 @@ export default function toast(message, duration = 0, bgColor, color) { style={{ backgroundColor: bgColor, color }} > {message} - {duration === false - ? - : ""} + {duration === false ? ( + + ) : ( + "" + )} ); diff --git a/src/dialogs/select.js b/src/dialogs/select.js index 764dee865..9503e3de5 100644 --- a/src/dialogs/select.js +++ b/src/dialogs/select.js @@ -48,9 +48,9 @@ function select(title, items, options = {}) { const $list = tag("ul", { className: `scroll${!textTransform ? " no-text-transform" : ""}`, }); - const $titleSpan = title - ? {title} - : null; + const $titleSpan = title ? ( + {title} + ) : null; const $select = (
{$titleSpan ? [$titleSpan, $list] : $list} diff --git a/src/pages/fontManager/fontManager.js b/src/pages/fontManager/fontManager.js index 9be89c42b..d466de7c8 100644 --- a/src/pages/fontManager/fontManager.js +++ b/src/pages/fontManager/fontManager.js @@ -307,20 +307,20 @@ export default function fontManager() {
{name}
{subtitle}
- {isCurrent || !isDefault - ?
- {isCurrent - ? Current - : null} - {!isDefault - ? - : null} -
- : null} + {isCurrent || !isDefault ? ( +
+ {isCurrent ? ( + Current + ) : null} + {!isDefault ? ( + + ) : null} +
+ ) : null} ); diff --git a/src/pages/plugin/plugin.view.js b/src/pages/plugin/plugin.view.js index 643f1b361..62a55a4cd 100644 --- a/src/pages/plugin/plugin.view.js +++ b/src/pages/plugin/plugin.view.js @@ -100,12 +100,12 @@ export default (props) => {

{name}

- {repository - ? - - {strings.open_source} - - : null} + {repository ? ( + + + {strings.open_source} + + ) : null}
@@ -121,14 +121,16 @@ export default (props) => { {author} - {authorVerified - ? { - toast(strings["verified publisher"]); - }} - className="licons verified verified-tick" - > - : ""} + {authorVerified ? ( + { + toast(strings["verified publisher"]); + }} + className="licons verified verified-tick" + > + ) : ( + "" + )} { {license || "Unknown"}
- {votesUp !== undefined - ?
-
- - - {helpers.formatDownloadCount( - typeof downloads === "string" - ? Number.parseInt(downloads) - : downloads, - )} - - {strings.downloads} -
-
- - = 80 ? "rating-high" : rating.replace("%", "") >= 50 ? "rating-medium" : "rating-low"}`} - > - {rating} - -
-
+
+ + + {helpers.formatDownloadCount( + typeof downloads === "string" + ? Number.parseInt(downloads) + : downloads, + )} + + {strings.downloads} +
+
+ + = 80 ? "rating-high" : rating.replace("%", "") >= 50 ? "rating-medium" : "rating-low"}`} > - - {commentCount} - {strings.reviews} -
+ {rating} +
- : null} - {Array.isArray(keywords) && keywords.length - ?
- {keywords.map((keyword) => ( - {keyword} - ))} +
+ + {commentCount} + {strings.reviews}
- : null} +
+ ) : null} + {Array.isArray(keywords) && keywords.length ? ( +
+ {keywords.map((keyword) => ( + {keyword} + ))} +
+ ) : null}
diff --git a/src/sidebarApps/extensions/index.js b/src/sidebarApps/extensions/index.js index c2c36426d..2502e9b29 100644 --- a/src/sidebarApps/extensions/index.js +++ b/src/sidebarApps/extensions/index.js @@ -726,20 +726,22 @@ function ListItem({ icon, name, id, version, downloads, installed, source }) { > {name} - {installed - ? <> - {source - ? - : null} - - - : } + {installed ? ( + <> + {source ? ( + + ) : null} + + + ) : ( + + )}
); From 18a6d0f9140a54a524b11f9cbc5891d93225b110 Mon Sep 17 00:00:00 2001 From: RohitKushvaha01 Date: Sat, 28 Mar 2026 14:40:12 +0530 Subject: [PATCH 4/5] fix: compile --- package.json | 2 +- src/plugins/system/android/com/foxdebug/system/System.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f571532bd..31821aee5 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "@babel/preset-typescript": "^7.28.5", "@babel/runtime": "^7.28.4", "@babel/runtime-corejs3": "^7.28.4", - "@biomejs/biome": "2.1.4", + "@biomejs/biome": "2.4.6", "@rspack/cli": "^1.7.0", "@rspack/core": "^1.7.0", "@types/ace": "^0.0.52", diff --git a/src/plugins/system/android/com/foxdebug/system/System.java b/src/plugins/system/android/com/foxdebug/system/System.java index 2100ba4c6..55fb27062 100644 --- a/src/plugins/system/android/com/foxdebug/system/System.java +++ b/src/plugins/system/android/com/foxdebug/system/System.java @@ -546,7 +546,7 @@ public void run() { openInBrowser(arg1, callbackContext); break; case "launch-app": - launchApp(arg1, arg2, arg3, callbackContext); + launchApp(arg1, arg2, args.optJSONObject(2), callbackContext); break; case "get-global-setting": getGlobalSetting(arg1, callbackContext); From 43f1d0855378ae92e62e72aba6bd2a0842fc212c Mon Sep 17 00:00:00 2001 From: RohitKushvaha01 Date: Sat, 28 Mar 2026 14:49:11 +0530 Subject: [PATCH 5/5] feat: definition --- src/plugins/system/system.d.ts | 91 +++++++++++++++++----------------- 1 file changed, 46 insertions(+), 45 deletions(-) diff --git a/src/plugins/system/system.d.ts b/src/plugins/system/system.d.ts index 81b4cb20a..aa2ef8bf7 100644 --- a/src/plugins/system/system.d.ts +++ b/src/plugins/system/system.d.ts @@ -27,33 +27,33 @@ interface FileShortcut { uri: string; } -interface Intent { - action: string; - data: string; - type: string; +interface Intent { + action: string; + data: string; + type: string; package: string; extras: { [key: string]: any; }; -} - -interface RewardStatus { - adFreeUntil: number; - lastExpiredRewardUntil: number; - isActive: boolean; - remainingMs: number; - redemptionsToday: number; - remainingRedemptions: number; - maxRedemptionsPerDay: number; - maxActivePassMs: number; - hasPendingExpiryNotice: boolean; - expiryNoticePendingUntil: number; - canRedeem: boolean; - redeemDisabledReason: string; - grantedDurationMs?: number; - appliedDurationMs?: number; - offerId?: string; -} +} + +interface RewardStatus { + adFreeUntil: number; + lastExpiredRewardUntil: number; + isActive: boolean; + remainingMs: number; + redemptionsToday: number; + remainingRedemptions: number; + maxRedemptionsPerDay: number; + maxActivePassMs: number; + hasPendingExpiryNotice: boolean; + expiryNoticePendingUntil: number; + canRedeem: boolean; + redeemDisabledReason: string; + grantedDurationMs?: number; + appliedDurationMs?: number; + offerId?: string; +} type FileAction = 'VIEW' | 'EDIT' | 'SEND' | 'RUN'; type OnFail = (err: string) => void; @@ -226,19 +226,20 @@ interface System { */ openInBrowser(src: string): void; /** - * Launches and app - * @param app the package name of the app - * @param className the full class name of the activity - * @param data Data to pass to the app - * @param onSuccess - * @param onFail + * Launch an Android application activity. + * + * @param app Package name of the application (e.g. `com.example.app`) + * @param className Fully qualified activity class name (e.g. `com.example.app.MainActivity`) + * @param extras Optional key-value pairs passed as Android Intent extras + * @param onSuccess Called when the activity launches successfully + * @param onFail Called if launching the activity fails */ launchApp( app: string, className: string, - data: string, - onSuccess: OnSuccessBool, - onFail: OnFail, + extras?: Record, + onSuccess?: OnSuccessBool, + onFail?: OnFail, ): void; /** @@ -272,19 +273,19 @@ interface System { * @param onSuccess * @param onFail */ - getCordovaIntent(onSuccess: (intent: Intent) => void, onFail: OnFail): void; - getRewardStatus( - onSuccess: (status: RewardStatus | string) => void, - onFail: OnFail, - ): void; - redeemReward( - offerId: string, - onSuccess: (status: RewardStatus | string) => void, - onFail: OnFail, - ): void; - /** - * Enable/disable native WebView long-press context behavior. - * Use this when rendering a custom editor context menu. + getCordovaIntent(onSuccess: (intent: Intent) => void, onFail: OnFail): void; + getRewardStatus( + onSuccess: (status: RewardStatus | string) => void, + onFail: OnFail, + ): void; + redeemReward( + offerId: string, + onSuccess: (status: RewardStatus | string) => void, + onFail: OnFail, + ): void; + /** + * Enable/disable native WebView long-press context behavior. + * Use this when rendering a custom editor context menu. * @param disabled * @param onSuccess * @param onFail