@livx.cc/appwrap 0.39.3 → 0.39.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/runtime/app/shell/devmenu.ts +15 -4
package/package.json
CHANGED
|
@@ -5,9 +5,10 @@ import { SHELL_BUILD, reloadWebView, getReportedWebVersion } from './handlers';
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Shake-to-open developer menu (enabled in prod too, gated by `SHELL_CONFIG.devMenu`).
|
|
8
|
-
* A shake raises a native action sheet
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* A shake raises a native action sheet with: "App Info" — non-sensitive diagnostics (ids, versions,
|
|
9
|
+
* loader, remote host) including the running webapp's version vs. the latest deployed, so you can tell
|
|
10
|
+
* at a glance whether the device got the update; "Reload"; and "Toggle Debug" — a generic hook that
|
|
11
|
+
* dispatches the `appwrap:toggleDebug` DOM event so the web app can flip its OWN debug UI.
|
|
11
12
|
* The web version status is reported via the always-on `app.reportWebVersion` handler
|
|
12
13
|
* (in handlers.ts) — independent of this menu — and read here when the menu is shown.
|
|
13
14
|
*/
|
|
@@ -120,10 +121,11 @@ async function showDevMenu(): Promise<void> {
|
|
|
120
121
|
title: SHELL_CONFIG.name,
|
|
121
122
|
message: 'Developer menu',
|
|
122
123
|
cancelButtonText: 'Cancel',
|
|
123
|
-
actions: ['App Info', 'Reload'],
|
|
124
|
+
actions: ['App Info', 'Reload', 'Toggle Debug'],
|
|
124
125
|
});
|
|
125
126
|
if (action === 'App Info') await showInfo();
|
|
126
127
|
else if (action === 'Reload') reloadWebView();
|
|
128
|
+
else if (action === 'Toggle Debug') toggleWebDebug();
|
|
127
129
|
} finally {
|
|
128
130
|
menuOpen = false;
|
|
129
131
|
}
|
|
@@ -152,6 +154,15 @@ async function showInfo(): Promise<void> {
|
|
|
152
154
|
Dialogs.alert({ title: 'App Info', message: lines.join('\n'), okButtonText: 'Close' });
|
|
153
155
|
}
|
|
154
156
|
|
|
157
|
+
/** Generic dev hook: dispatch a DOM event the running web app can listen for to flip its OWN debug UI
|
|
158
|
+
* (`window.addEventListener('appwrap:toggleDebug', …)`). No-op for apps that don't listen — the shell
|
|
159
|
+
* has no app-specific debug state of its own, so it just relays the intent. */
|
|
160
|
+
function toggleWebDebug(): void {
|
|
161
|
+
bridge
|
|
162
|
+
.evalJs("window.dispatchEvent(new CustomEvent('appwrap:toggleDebug'))")
|
|
163
|
+
.catch((e) => console.log('[appwrap] toggleDebug dispatch failed:', e));
|
|
164
|
+
}
|
|
165
|
+
|
|
155
166
|
/** Read the running page's embedded version directly from the WebView: `window.__APP_VERSION__`,
|
|
156
167
|
* then a `<meta name="app-version">` fallback. '' if neither is present (or eval fails). */
|
|
157
168
|
async function readPageVersion(): Promise<string> {
|