vxrn 2.8.1 → 2.9.0

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 (52) hide show
  1. package/dist/exports/clean.mjs +128 -19
  2. package/dist/exports/clean.mjs.map +1 -1
  3. package/dist/exports/clean.native.js +147 -21
  4. package/dist/exports/clean.native.js.map +1 -1
  5. package/dist/exports/prebuild.mjs +2 -1
  6. package/dist/exports/prebuild.mjs.map +1 -1
  7. package/dist/exports/prebuild.native.js +2 -1
  8. package/dist/exports/prebuild.native.js.map +1 -1
  9. package/dist/exports/prebuildWithoutExpo.mjs +196 -7
  10. package/dist/exports/prebuildWithoutExpo.mjs.map +1 -1
  11. package/dist/exports/prebuildWithoutExpo.native.js +280 -42
  12. package/dist/exports/prebuildWithoutExpo.native.js.map +1 -1
  13. package/dist/plugins/reactNativeDevServer.mjs +1 -1
  14. package/dist/plugins/reactNativeDevServer.mjs.map +1 -1
  15. package/dist/plugins/reactNativeDevServer.native.js +1 -1
  16. package/dist/plugins/reactNativeDevServer.native.js.map +1 -1
  17. package/dist/user-interface/index.mjs +31 -24
  18. package/dist/user-interface/index.mjs.map +1 -1
  19. package/dist/user-interface/index.native.js +32 -25
  20. package/dist/user-interface/index.native.js.map +1 -1
  21. package/dist/utils/createNativeDevEngine.mjs +111 -14
  22. package/dist/utils/createNativeDevEngine.mjs.map +1 -1
  23. package/dist/utils/createNativeDevEngine.native.js +143 -14
  24. package/dist/utils/createNativeDevEngine.native.js.map +1 -1
  25. package/dist/utils/scanDepsToOptimize.mjs +10 -6
  26. package/dist/utils/scanDepsToOptimize.mjs.map +1 -1
  27. package/dist/utils/scanDepsToOptimize.native.js +12 -6
  28. package/dist/utils/scanDepsToOptimize.native.js.map +1 -1
  29. package/expo-plugin.cjs +71 -8
  30. package/package.json +13 -13
  31. package/src/exports/clean.test.ts +502 -5
  32. package/src/exports/clean.ts +176 -19
  33. package/src/exports/expoPlugin.test.mjs +44 -1
  34. package/src/exports/prebuild.ts +6 -0
  35. package/src/exports/prebuildWithoutExpo.test.ts +134 -2
  36. package/src/exports/prebuildWithoutExpo.ts +235 -10
  37. package/src/plugins/reactNativeDevServer.ts +1 -1
  38. package/src/user-interface/index.ts +50 -42
  39. package/src/utils/createNativeDevEngine.test.ts +480 -1
  40. package/src/utils/createNativeDevEngine.ts +220 -17
  41. package/src/utils/imageSizePatch.test.ts +3 -3
  42. package/src/utils/scanDepsToOptimize.test.ts +35 -2
  43. package/src/utils/scanDepsToOptimize.ts +25 -8
  44. package/types/exports/clean.d.ts.map +1 -1
  45. package/types/exports/prebuild.d.ts +2 -1
  46. package/types/exports/prebuild.d.ts.map +1 -1
  47. package/types/exports/prebuildWithoutExpo.d.ts.map +1 -1
  48. package/types/user-interface/index.d.ts.map +1 -1
  49. package/types/utils/createNativeDevEngine.d.ts +1 -1
  50. package/types/utils/createNativeDevEngine.d.ts.map +1 -1
  51. package/types/utils/scanDepsToOptimize.d.ts +25 -0
  52. package/types/utils/scanDepsToOptimize.d.ts.map +1 -1
@@ -3,7 +3,7 @@ import { createHash } from "crypto";
3
3
  import module from "module";
4
4
  import path from "path";
5
5
  import { pathToFileURL } from "url";
6
- import { validateNativeApp } from "@vxrn/utils/nativeAppManifest";
6
+ import { androidIconSuffix, appIconPreviewResources, validateNativeApp } from "@vxrn/utils/nativeAppManifest";
7
7
  import FSExtra from "fs-extra";
8
8
  import sharp from "sharp";
9
9
  import { swiftPackageDirectories } from "../utils/swiftPackageId.native.js";
@@ -1173,20 +1173,70 @@ var IPAD_APP_ICON_SIZES = [
1173
1173
  ["76x76", ["1x", "2x"]],
1174
1174
  ["83.5x83.5", ["2x"]]
1175
1175
  ];
1176
+ async function writeAppearanceIcon(args) {
1177
+ var { root, iconDir, icon, source } = args;
1178
+ var variantSource = function variantSource2(variant) {
1179
+ if (!(variant === null || variant === void 0 ? void 0 : variant.source)) return source;
1180
+ var resolved = path.resolve(root, variant.source);
1181
+ if (!FSExtra.existsSync(resolved)) {
1182
+ throw new Error(`[vxrn] native.app icon appearance source does not exist: ${resolved}`);
1183
+ }
1184
+ return resolved;
1185
+ };
1186
+ var render = async function render2(file, from, background) {
1187
+ var gray = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
1188
+ var image = sharp(from).rotate().resize(1024, 1024, { fit: "cover" });
1189
+ if (background) image = image.flatten({ background });
1190
+ if (gray) image = image.greyscale();
1191
+ await image.png().toFile(path.join(iconDir, file));
1192
+ };
1193
+ var images = [];
1194
+ var entry = function entry2(filename, value) {
1195
+ return {
1196
+ ...value ? { appearances: [{
1197
+ appearance: "luminosity",
1198
+ value
1199
+ }] } : {},
1200
+ filename,
1201
+ idiom: "universal",
1202
+ platform: "ios",
1203
+ size: "1024x1024"
1204
+ };
1205
+ };
1206
+ await render("icon-1024.png", source, icon.backgroundColor);
1207
+ images.push(entry("icon-1024.png"));
1208
+ if (icon.dark) {
1209
+ await render("icon-1024-dark.png", variantSource(icon.dark), icon.dark.backgroundColor);
1210
+ images.push(entry("icon-1024-dark.png", "dark"));
1211
+ }
1212
+ if (icon.tinted) {
1213
+ var _icon_tinted_backgroundColor;
1214
+ await render("icon-1024-tinted.png", variantSource(icon.tinted), (_icon_tinted_backgroundColor = icon.tinted.backgroundColor) !== null && _icon_tinted_backgroundColor !== void 0 ? _icon_tinted_backgroundColor : "#000000", true);
1215
+ images.push(entry("icon-1024-tinted.png", "tinted"));
1216
+ }
1217
+ FSExtra.writeFileSync(path.join(iconDir, "Contents.json"), `${JSON.stringify({
1218
+ images,
1219
+ info: {
1220
+ author: "xcode",
1221
+ version: 1
1222
+ }
1223
+ }, null, 2)}
1224
+ `);
1225
+ }
1176
1226
  async function generateAppIcons(args) {
1227
+ var _app_alternateIcons;
1177
1228
  var { root, dest, platform, app } = args;
1178
1229
  if (!app.icon) return;
1179
1230
  if (platform === "ios") {
1180
- var _ref;
1181
- var _app_ios;
1231
+ var _app_alternateIcons1;
1182
1232
  var assetsDir = path.join(dest, app.name, "Images.xcassets");
1183
1233
  var template = JSON.parse(FSExtra.readFileSync(path.join(assetsDir, "AppIcon.appiconset", "Contents.json"), "utf8"));
1184
- var icons = [["AppIcon", app.icon], ...Object.entries((_ref = (_app_ios = app.ios) === null || _app_ios === void 0 ? void 0 : _app_ios.alternateIcons) !== null && _ref !== void 0 ? _ref : {})];
1234
+ var icons = [["AppIcon", app.icon], ...Object.entries((_app_alternateIcons1 = app.alternateIcons) !== null && _app_alternateIcons1 !== void 0 ? _app_alternateIcons1 : {})];
1185
1235
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
1186
1236
  try {
1187
1237
  for (var _iterator = icons[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
1188
1238
  var [name, icon] = _step.value;
1189
- var _app_ios1;
1239
+ var _app_ios;
1190
1240
  var source = path.resolve(root, icon.source);
1191
1241
  if (!FSExtra.existsSync(source)) {
1192
1242
  throw new Error(`[vxrn] native.app icon source does not exist: ${source}`);
@@ -1197,8 +1247,17 @@ async function generateAppIcons(args) {
1197
1247
  }
1198
1248
  var iconDir = path.join(assetsDir, `${name}.appiconset`);
1199
1249
  FSExtra.mkdirSync(iconDir, { recursive: true });
1250
+ if (icon.dark || icon.tinted) {
1251
+ await writeAppearanceIcon({
1252
+ root,
1253
+ iconDir,
1254
+ icon,
1255
+ source
1256
+ });
1257
+ continue;
1258
+ }
1200
1259
  var contents = structuredClone(template);
1201
- if ((_app_ios1 = app.ios) === null || _app_ios1 === void 0 ? void 0 : _app_ios1.tablet) {
1260
+ if ((_app_ios = app.ios) === null || _app_ios === void 0 ? void 0 : _app_ios.tablet) {
1202
1261
  var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
1203
1262
  try {
1204
1263
  for (var _iterator1 = IPAD_APP_ICON_SIZES[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
@@ -1295,15 +1354,54 @@ async function generateAppIcons(args) {
1295
1354
  if (metadata1.width !== metadata1.height || metadata1.width === void 0 || metadata1.width < 1024) {
1296
1355
  throw new Error("[vxrn] native.app.icon source must be a square image at least 1024px wide");
1297
1356
  }
1357
+ var launchers = [[
1358
+ "ic_launcher",
1359
+ app.icon,
1360
+ source1
1361
+ ], ...await Promise.all(Object.entries((_app_alternateIcons = app.alternateIcons) !== null && _app_alternateIcons !== void 0 ? _app_alternateIcons : {}).map(async function(param) {
1362
+ var [name2, icon2] = param;
1363
+ var alternateSource = path.resolve(root, icon2.source);
1364
+ if (!FSExtra.existsSync(alternateSource)) {
1365
+ throw new Error(`[vxrn] native.app icon source does not exist: ${alternateSource}`);
1366
+ }
1367
+ var alternate = await sharp(alternateSource).metadata();
1368
+ if (alternate.width !== alternate.height || alternate.width === void 0 || alternate.width < 1024) {
1369
+ throw new Error(`[vxrn] native.app icon source must be a square image at least 1024px wide: ${alternateSource}`);
1370
+ }
1371
+ return [
1372
+ androidAliasIconName(name2),
1373
+ icon2,
1374
+ alternateSource
1375
+ ];
1376
+ }))];
1298
1377
  var _iteratorNormalCompletion4 = true, _didIteratorError4 = false, _iteratorError4 = void 0;
1299
1378
  try {
1300
1379
  for (var _iterator4 = Object.entries(ANDROID_DENSITIES)[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
1301
1380
  var [density, multiplier] = _step4.value;
1302
1381
  var pixels1 = 48 * multiplier;
1303
1382
  var iconDir1 = path.join(dest, "app", "src", "main", "res", `mipmap-${density}`);
1304
- for (var _i = 0, _iter = ["ic_launcher.png", "ic_launcher_round.png"]; _i < _iter.length; _i++) {
1305
- var filename1 = _iter[_i];
1306
- await sharp(source1).rotate().resize(pixels1, pixels1, { fit: "cover" }).flatten({ background: app.icon.backgroundColor }).png().toFile(path.join(iconDir1, filename1));
1383
+ var _iteratorNormalCompletion5 = true, _didIteratorError5 = false, _iteratorError5 = void 0;
1384
+ try {
1385
+ for (var _iterator5 = launchers[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
1386
+ var [resource, icon1, iconSource] = _step5.value;
1387
+ for (var _i = 0, _iter = [`${resource}.png`, `${resource}_round.png`]; _i < _iter.length; _i++) {
1388
+ var filename1 = _iter[_i];
1389
+ await sharp(iconSource).rotate().resize(pixels1, pixels1, { fit: "cover" }).flatten({ background: icon1.backgroundColor }).png().toFile(path.join(iconDir1, filename1));
1390
+ }
1391
+ }
1392
+ } catch (err) {
1393
+ _didIteratorError5 = true;
1394
+ _iteratorError5 = err;
1395
+ } finally {
1396
+ try {
1397
+ if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
1398
+ _iterator5.return();
1399
+ }
1400
+ } finally {
1401
+ if (_didIteratorError5) {
1402
+ throw _iteratorError5;
1403
+ }
1404
+ }
1307
1405
  }
1308
1406
  }
1309
1407
  } catch (err) {
@@ -1321,6 +1419,135 @@ async function generateAppIcons(args) {
1321
1419
  }
1322
1420
  }
1323
1421
  }
1422
+ function androidAliasIconName(name) {
1423
+ return `ic_launcher_${androidIconSuffix(name)}`;
1424
+ }
1425
+ var LAUNCHER_FILTER = /[ \t]*<intent-filter>(?:(?!<\/intent-filter>)[\s\S])*android\.intent\.category\.LAUNCHER[\s\S]*?<\/intent-filter>\n?/;
1426
+ function stampAndroidIconAliases(manifest, app) {
1427
+ var _app_alternateIcons;
1428
+ var _manifest_match;
1429
+ var alternates = Object.keys((_app_alternateIcons = app.alternateIcons) !== null && _app_alternateIcons !== void 0 ? _app_alternateIcons : {});
1430
+ var host = (_manifest_match = manifest.match(/<activity\b(?:(?!<\/activity>)[\s\S])*android:name="\.MainActivity"[\s\S]*?<\/activity>/)) === null || _manifest_match === void 0 ? void 0 : _manifest_match[0];
1431
+ if (!host || !LAUNCHER_FILTER.test(host)) {
1432
+ throw new Error("[vxrn] cannot stamp alternate icons: expected the launcher filter on .MainActivity in app/src/main/AndroidManifest.xml");
1433
+ }
1434
+ var alias = function alias2(name, icon, enabled) {
1435
+ return ` <activity-alias
1436
+ android:name=".${name}"
1437
+ android:targetActivity=".AppIconLauncherActivity"
1438
+ android:enabled="${enabled}"
1439
+ android:exported="true"
1440
+ android:icon="@mipmap/${icon}"
1441
+ android:roundIcon="@mipmap/${icon}_round"
1442
+ android:label="@string/app_name">
1443
+ <intent-filter>
1444
+ <action android:name="android.intent.action.MAIN" />
1445
+ <category android:name="android.intent.category.LAUNCHER" />
1446
+ </intent-filter>
1447
+ </activity-alias>`;
1448
+ };
1449
+ var stamps = [
1450
+ ` <activity
1451
+ android:name=".AppIconLauncherActivity"
1452
+ android:exported="false"
1453
+ android:taskAffinity=""
1454
+ android:excludeFromRecents="true"
1455
+ android:theme="@android:style/Theme.NoDisplay" />`,
1456
+ alias("Primary", "ic_launcher", true),
1457
+ ...alternates.map(function(name) {
1458
+ return alias(name, androidAliasIconName(name), false);
1459
+ })
1460
+ ].join("\n");
1461
+ var anchor = " </application>";
1462
+ if (!manifest.includes(anchor)) {
1463
+ throw new Error("[vxrn] cannot stamp alternate icons: expected </application> in app/src/main/AndroidManifest.xml");
1464
+ }
1465
+ return manifest.replace(host, host.replace(LAUNCHER_FILTER, "")).replace(anchor, `${stamps}
1466
+ ${anchor}`);
1467
+ }
1468
+ function generateAndroidIconForwarder(dest, app) {
1469
+ if (!app.alternateIcons || !app.android) return;
1470
+ var packageName = app.android.applicationId;
1471
+ var file = path.join(dest, "app", "src", "main", "java", ...packageName.split("."), "AppIconLauncherActivity.kt");
1472
+ FSExtra.mkdirSync(path.dirname(file), { recursive: true });
1473
+ FSExtra.writeFileSync(file, `package ${packageName}
1474
+
1475
+ import android.app.Activity
1476
+ import android.content.Intent
1477
+ import android.os.Bundle
1478
+
1479
+ // launcher aliases finish before react native mounts in the permanent host.
1480
+ class AppIconLauncherActivity : Activity() {
1481
+ override fun onCreate(savedInstanceState: Bundle?) {
1482
+ super.onCreate(savedInstanceState)
1483
+ startActivity(Intent(intent).setClass(this, MainActivity::class.java)
1484
+ .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP or
1485
+ Intent.FLAG_ACTIVITY_SINGLE_TOP))
1486
+ finish()
1487
+ }
1488
+ }
1489
+ `);
1490
+ }
1491
+ async function generateAppIconPreviews(args) {
1492
+ var { root, dest, platform, app } = args;
1493
+ if (!app.icon || !app.alternateIcons) return;
1494
+ var icons = [[void 0, app.icon], ...Object.entries(app.alternateIcons)];
1495
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
1496
+ try {
1497
+ var _loop = async function() {
1498
+ var [name, icon] = _step.value;
1499
+ var preview = function preview2(scale2) {
1500
+ return sharp(path.resolve(root, icon.source)).rotate().resize(64 * scale2, 64 * scale2, { fit: "cover" }).flatten({ background: icon.backgroundColor }).png();
1501
+ };
1502
+ var resources = appIconPreviewResources(name);
1503
+ if (platform === "android") {
1504
+ var dir = path.join(dest, "app", "src", "main", "res", "drawable-nodpi");
1505
+ FSExtra.mkdirSync(dir, { recursive: true });
1506
+ await preview(3).toFile(path.join(dir, `${resources.android}.png`));
1507
+ return "continue";
1508
+ }
1509
+ var dir1 = path.join(dest, app.name, "Images.xcassets", `${resources.ios}.imageset`);
1510
+ FSExtra.mkdirSync(dir1, { recursive: true });
1511
+ var images = [];
1512
+ for (var _i = 0, _iter = [
1513
+ 1,
1514
+ 2,
1515
+ 3
1516
+ ]; _i < _iter.length; _i++) {
1517
+ var scale = _iter[_i];
1518
+ var filename = `preview@${scale}x.png`;
1519
+ await preview(scale).toFile(path.join(dir1, filename));
1520
+ images.push({
1521
+ filename,
1522
+ idiom: "universal",
1523
+ scale: `${scale}x`
1524
+ });
1525
+ }
1526
+ FSExtra.writeFileSync(path.join(dir1, "Contents.json"), `${JSON.stringify({
1527
+ images,
1528
+ info: {
1529
+ author: "xcode",
1530
+ version: 1
1531
+ }
1532
+ }, null, 2)}
1533
+ `);
1534
+ };
1535
+ for (var _iterator = icons[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) await _loop();
1536
+ } catch (err) {
1537
+ _didIteratorError = true;
1538
+ _iteratorError = err;
1539
+ } finally {
1540
+ try {
1541
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
1542
+ _iterator.return();
1543
+ }
1544
+ } finally {
1545
+ if (_didIteratorError) {
1546
+ throw _iteratorError;
1547
+ }
1548
+ }
1549
+ }
1550
+ }
1324
1551
  async function generateAdaptiveIcon(args) {
1325
1552
  var _app_android;
1326
1553
  var { root, dest, app } = args;
@@ -1717,7 +1944,8 @@ ${background1 ? ` <item>
1717
1944
  </style>`));
1718
1945
  }
1719
1946
  function renderPrebuildFile(args) {
1720
- var { relativePath, content, platform, app, nitroWebImage } = args;
1947
+ var { content, platform, app, nitroWebImage } = args;
1948
+ var relativePath = args.relativePath.replace(/\\/g, "/");
1721
1949
  var appName = app.name;
1722
1950
  var schemes = app.scheme === void 0 ? [] : Array.isArray(app.scheme) ? app.scheme : [app.scheme];
1723
1951
  var destRelativePath = transformPath(relativePath);
@@ -1727,7 +1955,7 @@ function renderPrebuildFile(args) {
1727
1955
  }
1728
1956
  destRelativePath = destRelativePath.replace(/HelloWorld/g, appName).replace(/helloworld/g, appName.toLowerCase());
1729
1957
  if (content !== null) {
1730
- var _app_imagePicker, _app_notifications, _app_ios, _app_android, _app_notifications1, _app_android1, _app_android_permissions, _app_android2, _app_android_blockedPermissions, _app_android3, _app_android_appLinks, _app_android4, _app_ios1, _app_android5, _app_android6, _app_android7;
1958
+ var _app_imagePicker, _app_notifications, _app_ios, _app_android, _app_notifications1, _app_android1, _app_android_permissions, _app_android2, _app_android_blockedPermissions, _app_android3, _app_android_appLinks, _app_android4, _app_android5, _app_android6, _app_android7;
1731
1959
  var rendered = content;
1732
1960
  var replacements = [];
1733
1961
  if (platform === "ios" && app.ios) {
@@ -1759,7 +1987,7 @@ function renderPrebuildFile(args) {
1759
1987
  }
1760
1988
  if (platform === "ios" && relativePath.endsWith("/Info.plist")) {
1761
1989
  var _ref, _ref1, _ref2;
1762
- var _app_ios2, _app_ios3, _app_ios4, _app_photoLibrary, _app_notifications2, _app_ios5, _app_ios_backgroundTasks, _app_ios6, _app_ios_backgroundTasks1, _app_ios7, _app_ios8, _app_audio, _app_location, _app_fonts, _app_ios9;
1990
+ var _app_ios1, _app_ios2, _app_ios3, _app_photoLibrary, _app_notifications2, _app_ios4, _app_ios_backgroundTasks, _app_ios5, _app_ios_backgroundTasks1, _app_ios6, _app_ios7, _app_audio, _app_location, _app_fonts, _app_ios8;
1763
1991
  var stamps = [];
1764
1992
  if (schemes.length) {
1765
1993
  stamps.push(` <key>CFBundleURLTypes</key>
@@ -1776,14 +2004,14 @@ ${schemes.map(function(scheme) {
1776
2004
  </dict>
1777
2005
  </array>`);
1778
2006
  }
1779
- if (((_app_ios2 = app.ios) === null || _app_ios2 === void 0 ? void 0 : _app_ios2.usesNonExemptEncryption) !== void 0) {
2007
+ if (((_app_ios1 = app.ios) === null || _app_ios1 === void 0 ? void 0 : _app_ios1.usesNonExemptEncryption) !== void 0) {
1780
2008
  stamps.push(` <key>ITSAppUsesNonExemptEncryption</key>
1781
2009
  <${app.ios.usesNonExemptEncryption ? "true" : "false"}/>`);
1782
2010
  }
1783
- if ((_app_ios3 = app.ios) === null || _app_ios3 === void 0 ? void 0 : _app_ios3.accentColor) {
2011
+ if ((_app_ios2 = app.ios) === null || _app_ios2 === void 0 ? void 0 : _app_ios2.accentColor) {
1784
2012
  stamps.push(" <key>NSAccentColorName</key>\n <string>AccentColor</string>");
1785
2013
  }
1786
- if ((_app_ios4 = app.ios) === null || _app_ios4 === void 0 ? void 0 : _app_ios4.fileSharing) {
2014
+ if ((_app_ios3 = app.ios) === null || _app_ios3 === void 0 ? void 0 : _app_ios3.fileSharing) {
1787
2015
  stamps.push(` <key>UIFileSharingEnabled</key>
1788
2016
  <true/>
1789
2017
  <key>LSSupportsOpeningDocumentsInPlace</key>
@@ -1800,11 +2028,11 @@ ${schemes.map(function(scheme) {
1800
2028
  stamps.push(` <key>${notificationsHost.pushInfoPlistKey}</key>
1801
2029
  <true/>`);
1802
2030
  }
1803
- if ((_app_ios5 = app.ios) === null || _app_ios5 === void 0 ? void 0 : _app_ios5.widgets) {
2031
+ if ((_app_ios4 = app.ios) === null || _app_ios4 === void 0 ? void 0 : _app_ios4.widgets) {
1804
2032
  stamps.push(" <key>NSSupportsLiveActivities</key>\n <true/>");
1805
2033
  }
1806
- var refreshTasks = (_ref = (_app_ios6 = app.ios) === null || _app_ios6 === void 0 ? void 0 : (_app_ios_backgroundTasks = _app_ios6.backgroundTasks) === null || _app_ios_backgroundTasks === void 0 ? void 0 : _app_ios_backgroundTasks.refresh) !== null && _ref !== void 0 ? _ref : [];
1807
- var processingTasks = (_ref1 = (_app_ios7 = app.ios) === null || _app_ios7 === void 0 ? void 0 : (_app_ios_backgroundTasks1 = _app_ios7.backgroundTasks) === null || _app_ios_backgroundTasks1 === void 0 ? void 0 : _app_ios_backgroundTasks1.processing) !== null && _ref1 !== void 0 ? _ref1 : [];
2034
+ var refreshTasks = (_ref = (_app_ios5 = app.ios) === null || _app_ios5 === void 0 ? void 0 : (_app_ios_backgroundTasks = _app_ios5.backgroundTasks) === null || _app_ios_backgroundTasks === void 0 ? void 0 : _app_ios_backgroundTasks.refresh) !== null && _ref !== void 0 ? _ref : [];
2035
+ var processingTasks = (_ref1 = (_app_ios6 = app.ios) === null || _app_ios6 === void 0 ? void 0 : (_app_ios_backgroundTasks1 = _app_ios6.backgroundTasks) === null || _app_ios_backgroundTasks1 === void 0 ? void 0 : _app_ios_backgroundTasks1.processing) !== null && _ref1 !== void 0 ? _ref1 : [];
1808
2036
  if (refreshTasks.length || processingTasks.length) {
1809
2037
  var plistArray = function plistArray2(key, identifiers) {
1810
2038
  return ` <key>${key}</key>
@@ -1818,7 +2046,7 @@ ${identifiers.map(function(identifier) {
1818
2046
  stamps.push(plistArray("OneBackgroundRefreshTaskIdentifiers", refreshTasks));
1819
2047
  stamps.push(plistArray("OneBackgroundProcessingTaskIdentifiers", processingTasks));
1820
2048
  }
1821
- if ((_app_ios8 = app.ios) === null || _app_ios8 === void 0 ? void 0 : _app_ios8.appIntents) {
2049
+ if ((_app_ios7 = app.ios) === null || _app_ios7 === void 0 ? void 0 : _app_ios7.appIntents) {
1822
2050
  stamps.push(` <key>OneAppIntentIdentifiers</key>
1823
2051
  <array>
1824
2052
  ${app.ios.appIntents.actions.map(function(action) {
@@ -1884,7 +2112,7 @@ ${phoneOrientations.map(function(orientation) {
1884
2112
  }
1885
2113
  stamps.push(renderPlistEntries({ [key]: value2 }, " "));
1886
2114
  };
1887
- for (var _iterator1 = Object.entries((_ref2 = (_app_ios9 = app.ios) === null || _app_ios9 === void 0 ? void 0 : _app_ios9.infoPlist) !== null && _ref2 !== void 0 ? _ref2 : {})[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) _loop();
2115
+ for (var _iterator1 = Object.entries((_ref2 = (_app_ios8 = app.ios) === null || _app_ios8 === void 0 ? void 0 : _app_ios8.infoPlist) !== null && _ref2 !== void 0 ? _ref2 : {})[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) _loop();
1888
2116
  } catch (err) {
1889
2117
  _didIteratorError1 = true;
1890
2118
  _iteratorError1 = err;
@@ -1989,7 +2217,7 @@ ${stamps2.join("\n")}`);
1989
2217
  }
1990
2218
  }
1991
2219
  if (platform === "android" && relativePath === "app/src/main/AndroidManifest.xml" && (app.audio !== void 0 || app.photoLibrary !== void 0 || app.contacts !== void 0 || app.calendar !== void 0 || ((_app_ios = app.ios) === null || _app_ios === void 0 ? void 0 : _app_ios.backgroundTasks) !== void 0)) {
1992
- var _app_audio1, _app_photoLibrary1, _app_photoLibrary2, _app_calendar, _app_calendar1, _app_audio2, _app_calendar2, _app_photoLibrary3, _app_audio3, _app_ios10;
2220
+ var _app_audio1, _app_photoLibrary1, _app_photoLibrary2, _app_calendar, _app_calendar1, _app_audio2, _app_calendar2, _app_photoLibrary3, _app_audio3, _app_ios9;
1993
2221
  var anchor7 = "<uses-permission android:name=\"android.permission.INTERNET\" />";
1994
2222
  if (!rendered.includes(anchor7)) {
1995
2223
  throw new Error("[vxrn] cannot stamp media permissions: expected the INTERNET permission in app/src/main/AndroidManifest.xml");
@@ -2035,7 +2263,7 @@ ${stamps3.join("\n")}`);
2035
2263
  if (((_app_audio3 = app.audio) === null || _app_audio3 === void 0 ? void 0 : _app_audio3.background) === true) {
2036
2264
  appStamps.push(" <meta-data android:name=\"one.audio.background\" android:value=\"true\" />", " <service android:name=\"com.margelo.nitro.one.OneAudioService\" android:exported=\"false\" android:foregroundServiceType=\"mediaPlayback\" />");
2037
2265
  }
2038
- if (((_app_ios10 = app.ios) === null || _app_ios10 === void 0 ? void 0 : _app_ios10.backgroundTasks) !== void 0) {
2266
+ if (((_app_ios9 = app.ios) === null || _app_ios9 === void 0 ? void 0 : _app_ios9.backgroundTasks) !== void 0) {
2039
2267
  var _app_ios_backgroundTasks_refresh, _app_ios_backgroundTasks_processing;
2040
2268
  var refreshTasks1 = (_app_ios_backgroundTasks_refresh = app.ios.backgroundTasks.refresh) !== null && _app_ios_backgroundTasks_refresh !== void 0 ? _app_ios_backgroundTasks_refresh : [];
2041
2269
  var processingTasks1 = (_app_ios_backgroundTasks_processing = app.ios.backgroundTasks.processing) !== null && _app_ios_backgroundTasks_processing !== void 0 ? _app_ios_backgroundTasks_processing : [];
@@ -2173,30 +2401,33 @@ ${schemes.map(function(scheme) {
2173
2401
  </intent-filter>
2174
2402
  </activity>`);
2175
2403
  }
2404
+ if (platform === "android" && relativePath === "app/src/main/AndroidManifest.xml" && app.alternateIcons !== void 0) {
2405
+ rendered = stampAndroidIconAliases(rendered, app);
2406
+ }
2176
2407
  if (platform === "ios" && relativePath.endsWith(".xcodeproj/project.pbxproj")) {
2177
- var _app_ios11;
2178
- rendered = rendered.replace(/TARGETED_DEVICE_FAMILY = "1,2";/g, `TARGETED_DEVICE_FAMILY = "${((_app_ios11 = app.ios) === null || _app_ios11 === void 0 ? void 0 : _app_ios11.tablet) ? "1,2" : "1"}";`);
2408
+ var _app_ios10;
2409
+ rendered = rendered.replace(/TARGETED_DEVICE_FAMILY = "1,2";/g, `TARGETED_DEVICE_FAMILY = "${((_app_ios10 = app.ios) === null || _app_ios10 === void 0 ? void 0 : _app_ios10.tablet) ? "1,2" : "1"}";`);
2179
2410
  }
2180
2411
  if (platform === "ios" && relativePath.endsWith(".xcodeproj/project.pbxproj")) {
2181
- var _app_ios12;
2412
+ var _app_ios11;
2182
2413
  if (app.version !== void 0) {
2183
2414
  rendered = rendered.replace(/MARKETING_VERSION = [^;]+;/g, `MARKETING_VERSION = "${app.version}";`);
2184
2415
  }
2185
- if (((_app_ios12 = app.ios) === null || _app_ios12 === void 0 ? void 0 : _app_ios12.buildNumber) !== void 0) {
2416
+ if (((_app_ios11 = app.ios) === null || _app_ios11 === void 0 ? void 0 : _app_ios11.buildNumber) !== void 0) {
2186
2417
  rendered = rendered.replace(/CURRENT_PROJECT_VERSION = [^;]+;/g, `CURRENT_PROJECT_VERSION = ${app.ios.buildNumber};`);
2187
2418
  }
2188
2419
  }
2189
- if (platform === "ios" && relativePath.endsWith(".xcodeproj/project.pbxproj") && ((_app_ios1 = app.ios) === null || _app_ios1 === void 0 ? void 0 : _app_ios1.alternateIcons) !== void 0) {
2420
+ if (platform === "ios" && relativePath.endsWith(".xcodeproj/project.pbxproj") && app.alternateIcons !== void 0) {
2190
2421
  var anchor13 = "ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;";
2191
2422
  if (!rendered.includes(anchor13)) {
2192
2423
  throw new Error("[vxrn] prebuild template lost its primary app icon build setting");
2193
2424
  }
2194
- var names = Object.keys(app.ios.alternateIcons).sort().join(" ");
2425
+ var names = Object.keys(app.alternateIcons).sort().join(" ");
2195
2426
  rendered = rendered.replaceAll(anchor13, `${anchor13}
2196
2427
  ASSETCATALOG_COMPILER_ALTERNATE_APPICON_NAMES = "${names}";`);
2197
2428
  }
2198
2429
  if (platform === "ios" && relativePath.endsWith("/Info.plist")) {
2199
- var _app_imagePicker2, _app_imagePicker3, _app_ios13, _app_audio4;
2430
+ var _app_imagePicker2, _app_imagePicker3, _app_ios12, _app_audio4;
2200
2431
  var usage = /* @__PURE__ */ new Map();
2201
2432
  if (((_app_imagePicker2 = app.imagePicker) === null || _app_imagePicker2 === void 0 ? void 0 : _app_imagePicker2.camera) !== void 0) {
2202
2433
  usage.set("NSCameraUsageDescription", app.imagePicker.camera);
@@ -2232,7 +2463,7 @@ ${schemes.map(function(scheme) {
2232
2463
  if (app.pedometer !== void 0) {
2233
2464
  usage.set("NSMotionUsageDescription", app.pedometer.usage);
2234
2465
  }
2235
- if (((_app_ios13 = app.ios) === null || _app_ios13 === void 0 ? void 0 : _app_ios13.faceIdUsageDescription) !== void 0) {
2466
+ if (((_app_ios12 = app.ios) === null || _app_ios12 === void 0 ? void 0 : _app_ios12.faceIdUsageDescription) !== void 0) {
2236
2467
  usage.set("NSFaceIDUsageDescription", app.ios.faceIdUsageDescription);
2237
2468
  }
2238
2469
  if (app.speech !== void 0) {
@@ -2286,8 +2517,8 @@ ${schemes.map(function(scheme) {
2286
2517
  rendered = rendered.replace(/\t<key>NS\w+UsageDescription<\/key>\s*<string><\/string>\n/g, "");
2287
2518
  }
2288
2519
  if (platform === "ios" && relativePath.endsWith("/AppDelegate.swift")) {
2289
- var _app_ios14, _app_ios15;
2290
- rendered = patchIosAppDelegateSceneLifecycle(rendered, !!((_app_ios14 = app.ios) === null || _app_ios14 === void 0 ? void 0 : _app_ios14.backgroundTasks), !!((_app_ios15 = app.ios) === null || _app_ios15 === void 0 ? void 0 : _app_ios15.appIntents));
2520
+ var _app_ios13, _app_ios14;
2521
+ rendered = patchIosAppDelegateSceneLifecycle(rendered, !!((_app_ios13 = app.ios) === null || _app_ios13 === void 0 ? void 0 : _app_ios13.backgroundTasks), !!((_app_ios14 = app.ios) === null || _app_ios14 === void 0 ? void 0 : _app_ios14.appIntents));
2291
2522
  rendered = nativeProjectPatches.holdLaunchScreenOverRootView(rendered);
2292
2523
  var bundleURLProvider = "RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: \"index\")";
2293
2524
  if (!rendered.includes(bundleURLProvider)) {
@@ -2304,8 +2535,8 @@ ${schemes.map(function(scheme) {
2304
2535
  }
2305
2536
  if (platform === "ios") {
2306
2537
  var _ref5;
2307
- var _app_ios16;
2308
- var deploymentTarget = (_ref5 = (_app_ios16 = app.ios) === null || _app_ios16 === void 0 ? void 0 : _app_ios16.deploymentTarget) !== null && _ref5 !== void 0 ? _ref5 : "17.0";
2538
+ var _app_ios15;
2539
+ var deploymentTarget = (_ref5 = (_app_ios15 = app.ios) === null || _app_ios15 === void 0 ? void 0 : _app_ios15.deploymentTarget) !== null && _ref5 !== void 0 ? _ref5 : "17.0";
2309
2540
  rendered = rendered.replace("platform :ios, min_ios_version_supported", `platform :ios, '${deploymentTarget}'`).replace(/IPHONEOS_DEPLOYMENT_TARGET = \d+(?:\.\d+)?;/g, `IPHONEOS_DEPLOYMENT_TARGET = ${deploymentTarget};`);
2310
2541
  if (relativePath === "Podfile") {
2311
2542
  rendered = rendered.replace(" )\n end\nend", ` )
@@ -2320,27 +2551,27 @@ end`);
2320
2551
  }
2321
2552
  }
2322
2553
  if (platform === "ios" && relativePath.endsWith(".xcodeproj/project.pbxproj")) {
2323
- var _app_updates, _app_ios17, _app_ios18, _app_ios19;
2554
+ var _app_updates, _app_ios16, _app_ios17, _app_ios18;
2324
2555
  rendered = patchIosBundlePhase(rendered, (_app_updates = app.updates) === null || _app_updates === void 0 ? void 0 : _app_updates.runtimeVersion);
2325
- if ((_app_ios17 = app.ios) === null || _app_ios17 === void 0 ? void 0 : _app_ios17.appIntents) rendered = patchIosPbxprojAppIntents(rendered, appName);
2556
+ if ((_app_ios16 = app.ios) === null || _app_ios16 === void 0 ? void 0 : _app_ios16.appIntents) rendered = patchIosPbxprojAppIntents(rendered, appName);
2326
2557
  rendered = patchIosPbxprojOneBridgingHeader(rendered, appName);
2327
- if (Object.keys(appEntitlements(app)).length && !((_app_ios18 = app.ios) === null || _app_ios18 === void 0 ? void 0 : _app_ios18.widgets)) {
2558
+ if (Object.keys(appEntitlements(app)).length && !((_app_ios17 = app.ios) === null || _app_ios17 === void 0 ? void 0 : _app_ios17.widgets)) {
2328
2559
  rendered = patchIosPbxprojAppEntitlements(rendered, appName);
2329
2560
  }
2330
- if ((_app_ios19 = app.ios) === null || _app_ios19 === void 0 ? void 0 : _app_ios19.widgets) rendered = patchIosPbxprojWidgets(rendered, app);
2561
+ if ((_app_ios18 = app.ios) === null || _app_ios18 === void 0 ? void 0 : _app_ios18.widgets) rendered = patchIosPbxprojWidgets(rendered, app);
2331
2562
  if (iosResourceFiles(app).length) {
2332
2563
  rendered = patchIosPbxprojResources(rendered, appName, iosResourceFiles(app));
2333
2564
  }
2334
2565
  }
2335
2566
  if (platform === "ios" && relativePath === "Podfile") {
2336
- var _app_ios20, _app_ios21, _app_ios22;
2337
- if ((_app_ios20 = app.ios) === null || _app_ios20 === void 0 ? void 0 : _app_ios20.ccache) rendered = `ENV['USE_CCACHE'] ||= '1'
2567
+ var _app_ios19, _app_ios20, _app_ios21;
2568
+ if ((_app_ios19 = app.ios) === null || _app_ios19 === void 0 ? void 0 : _app_ios19.ccache) rendered = `ENV['USE_CCACHE'] ||= '1'
2338
2569
  ${rendered}`;
2339
- if ((_app_ios21 = app.ios) === null || _app_ios21 === void 0 ? void 0 : _app_ios21.useFrameworks) {
2570
+ if ((_app_ios20 = app.ios) === null || _app_ios20 === void 0 ? void 0 : _app_ios20.useFrameworks) {
2340
2571
  rendered = rendered.replace(/^(platform :ios, .+)$/m, `$1
2341
2572
  use_frameworks! :linkage => :${app.ios.useFrameworks}`);
2342
2573
  }
2343
- if ((_app_ios22 = app.ios) === null || _app_ios22 === void 0 ? void 0 : _app_ios22.screensGamma) {
2574
+ if ((_app_ios21 = app.ios) === null || _app_ios21 === void 0 ? void 0 : _app_ios21.screensGamma) {
2344
2575
  rendered = nativeProjectPatches.injectReactNativeScreensGammaIntoPodfile(rendered);
2345
2576
  }
2346
2577
  rendered = nativeProjectPatches.injectFmtCxx17FixIntoPodfile(rendered);
@@ -2530,6 +2761,12 @@ var generateForPlatform = async function generateForPlatform2(root, platform, ap
2530
2761
  platform,
2531
2762
  app
2532
2763
  });
2764
+ await generateAppIconPreviews({
2765
+ root,
2766
+ dest,
2767
+ platform,
2768
+ app
2769
+ });
2533
2770
  if (platform === "android") await generateAdaptiveIcon({
2534
2771
  root,
2535
2772
  dest,
@@ -2563,6 +2800,7 @@ var generateForPlatform = async function generateForPlatform2(root, platform, ap
2563
2800
  root,
2564
2801
  dest
2565
2802
  });
2803
+ if (platform === "android") generateAndroidIconForwarder(dest, app);
2566
2804
  if (platform === "android") await generateKotlinSources({
2567
2805
  root,
2568
2806
  dest