@livx.cc/appwrap 0.39.14 → 0.39.16

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cli.ts +15 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livx.cc/appwrap",
3
- "version": "0.39.14",
3
+ "version": "0.39.16",
4
4
  "description": "Wrap any PWA into a native app with native capabilities (appwrap runtime + @livx.cc/native-kit).",
5
5
  "license": "MIT",
6
6
  "author": "Elya Livshitz",
package/src/cli.ts CHANGED
@@ -1891,11 +1891,23 @@ async function deployAndroid(cwd: string, flags: Record<string, string>): Promis
1891
1891
 
1892
1892
  console.log(`▶ installing → ${device}`);
1893
1893
  try {
1894
- execFileSync(adb, ['-s', device, 'install', '-r', apk], { stdio: 'inherit' });
1894
+ // `--user 0` (primary user) is the robust install target: on MIUI/Xiaomi a BARE `adb install` is
1895
+ // silently auto-denied ("user is restricted from installing apps" — no popup), but scoping it to
1896
+ // user 0 succeeds. On normal single-user devices it's a no-op (install already targets user 0).
1897
+ // Capture (not inherit) so we can still surface guidance if it fails for another reason.
1898
+ const out = execFileSync(adb, ['-s', device, 'install', '-r', '--user', '0', apk], { encoding: 'utf8', stdio: ['inherit', 'pipe', 'pipe'] });
1899
+ process.stdout.write(out);
1895
1900
  } catch (e: unknown) {
1896
1901
  const log = execErrText(e);
1897
- if (/INSTALL_FAILED_USER_RESTRICTED|user is restricted/i.test(log)) {
1898
- console.error('\n✖ Install blocked by the device. On MIUI/Xiaomi: Developer options → enable "Install via USB" (may need mobile data + a SIM, no VPN).');
1902
+ process.stderr.write(log);
1903
+ if (/INSTALL_FAILED_USER_RESTRICTED|user is restricted|canceled by user/i.test(log)) {
1904
+ console.error(
1905
+ '\n✖ Install blocked/canceled by the device (MIUI/Xiaomi restriction — NOT a build problem).\n' +
1906
+ ' → Unlock the phone and watch for the "Install via USB?" prompt → tap OK/Install.\n' +
1907
+ ' → Developer options: enable "Install via USB" AND "USB debugging (Security settings)".\n' +
1908
+ ' (Toggling these pings Xiaomi servers — needs mobile data + a SIM, no VPN.)\n' +
1909
+ ` The built APK is ready: ${apk}`
1910
+ );
1899
1911
  }
1900
1912
  process.exit(1);
1901
1913
  }