codeplay-common 4.11.40 → 4.11.41-alpha.2
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/README.md +36 -4
- package/files/buildCodeplay/codeplayBeforeBuild.js +9 -362
- package/files/buildCodeplay/project-scripts.cjs +4 -4
- package/files/buildCodeplay/sync-notification-large-icon.cjs +19 -0
- package/files/patches/catalog/@byteowls+capacitor-filesharer+7.0.0.patch +12 -0
- package/files/patches/catalog/@capacitor-community+file-opener+8.0.0.patch +12 -0
- package/files/patches/catalog/@capacitor-community+in-app-review+8.0.0.patch +13 -0
- package/files/patches/catalog/@capacitor-community+native-audio+8.0.0.patch +12 -0
- package/files/patches/catalog/@capacitor-community+play-integrity+8.0.0.patch +12 -0
- package/files/patches/catalog/@capacitor-community+privacy-screen+8.0.0.patch +12 -0
- package/files/patches/catalog/@capacitor-community+safe-area+7.0.0-alpha.1.patch +46 -0
- package/files/patches/catalog/@capacitor-community+speech-recognition+7.0.1.patch +12 -0
- package/files/patches/catalog/@capacitor-community+text-to-speech+8.0.0.patch +12 -0
- package/files/patches/catalog/@mozartec+capacitor-microphone+7.1.0.patch +40 -0
- package/files/patches/catalog/@ottimis+capacitor-volumes+7.0.0.patch +12 -0
- package/files/patches/catalog/@whiteguru+capacitor-plugin-media+8.0.1.patch +12 -0
- package/files/patches/catalog/capacitor-admob-nextgen+1.6.0.patch +10 -0
- package/files/patches/catalog/capacitor-music-controls-plugin+8.0.0.patch +12 -0
- package/files/patches/catalog/capacitor-native-biometric+4.2.2.patch +68 -0
- package/files/patches/catalog/capacitor-voice-recorder+7.0.6.patch +12 -0
- package/files/scripts-common/run-codeplay-sync-after.js +1 -8
- package/package.json +5 -3
- package/scripts/prepare-capacitor-9.cjs +98 -0
- package/scripts/sync-files.js +23 -2
package/README.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# codeplay-common
|
|
2
2
|
|
|
3
|
+
## Capacitor 9 migration
|
|
4
|
+
|
|
5
|
+
Use the current stable release (`codeplay-common@latest`) when it contains the
|
|
6
|
+
migration helpers. Until then, use `codeplay-common@alpha` for testing. Verify
|
|
7
|
+
that `scripts/prepare-capacitor-9.cjs` and `files/patches/catalog/` are present
|
|
8
|
+
in the installed package. A stable publication does not automatically replace
|
|
9
|
+
an app's pinned alpha dependency; update and test that app explicitly. The
|
|
10
|
+
migration guide is delivered separately in the server's versioned
|
|
11
|
+
`agents-<version>.zip`; the npm package does not ship or copy it. Follow that
|
|
12
|
+
guide for each app's dependency, Android, iOS, and device migration.
|
|
13
|
+
The package does not migrate an arbitrary app merely by being installed.
|
|
14
|
+
|
|
15
|
+
After the app uses Capacitor 9, installation copies the full catalog from
|
|
16
|
+
`files/patches/catalog/` to the app's `patches/catalog/`, then selects exact-version
|
|
17
|
+
patches for `patches/active/` and applies them with the
|
|
18
|
+
package-owned `patch-package`, and adds a root postinstall hook for future
|
|
19
|
+
installs. Every build checks and reapplies the active patches before native
|
|
20
|
+
work. Run `node node_modules/codeplay-common/scripts/prepare-capacitor-9.cjs`
|
|
21
|
+
for a read-only report. An active patch for an absent or newer plugin stops the
|
|
22
|
+
install/build with its old and installed versions so the team can review it.
|
|
23
|
+
Existing app-specific patches for the same version are preserved. The shared
|
|
24
|
+
AdMob patch changes only the removed `hasOption()` API; app-specific banner
|
|
25
|
+
layout changes remain in their own app. An older AdMob NextGen installation
|
|
26
|
+
must first be upgraded to 1.6.0; the patch manager stops with that instruction.
|
|
27
|
+
|
|
28
|
+
The migration build helper no longer rewrites Capacitor's `BridgeWebViewClient.java` or
|
|
29
|
+
`SystemBars.java`. In Capacitor 9 apps, the installer leaves the old custom splash
|
|
30
|
+
scripts uninstalled and uses the notification icon sync helper instead. Inspect
|
|
31
|
+
existing scripts and native files as described in the guide before building.
|
|
32
|
+
|
|
3
33
|
Version 4.11.37 adds the `/buildCodeplay` Vite alias during installation and
|
|
4
34
|
before-build setup, including upgrades of existing generated wrappers. This
|
|
5
35
|
lets Huawei privacy startup modules load during Live Reload when the app's
|
|
@@ -287,10 +317,12 @@ The build script reads the `agents` version from
|
|
|
287
317
|
`agents-<version>.zip` archive when the project has no agent instructions or the
|
|
288
318
|
server version is newer.
|
|
289
319
|
|
|
290
|
-
The ZIP root must contain `AGENTS.md` and
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
320
|
+
The ZIP root must contain `AGENTS.md` and at least one supporting instruction
|
|
321
|
+
file; supporting files can be at the ZIP root or under `AGENTS/`. They are installed
|
|
322
|
+
in the project's `AGENTS/` directory. The installed version is stored in
|
|
323
|
+
`AGENTS/.codeplay-version`.
|
|
324
|
+
On a version update, the existing `AGENTS/` directory is replaced by the ZIP's
|
|
325
|
+
contents. Include every instruction file that consuming apps need in that archive.
|
|
294
326
|
|
|
295
327
|
For example, publish `agents-1.1.zip` and add this entry to the server's
|
|
296
328
|
`versions.json`:
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// Version 8.7: leave Capacitor's Android source files untouched during builds.
|
|
1
2
|
// Version 8.6: recover interrupted codeplay-common installations without uninstalling first.
|
|
2
3
|
// Version 8.5: require the Squeezeback native plugin only for explicitly enabled apps.
|
|
3
4
|
// Version 8.4: migrate Squeezeback and coarse-location configuration defaults.
|
|
@@ -14,7 +15,6 @@
|
|
|
14
15
|
// Version 7.3: select RuAds for Huawei/RuStore and isolate native advertising providers.
|
|
15
16
|
// Version 7.2: migrate Android 15 navigation-bar colors and remove unused legacy StatusBar plugins.
|
|
16
17
|
// Version 7.1: require confirmation before continuing with local versions when the server check fails.
|
|
17
|
-
// Version 7.0: prepare shared splash readiness and migrate the legacy splash theme.
|
|
18
18
|
// Version 6.9: preserve configured notification icons during Android resource shrinking.
|
|
19
19
|
// Version 6.8: preserve Capacitor permission annotations for Love Calculator Android builds.
|
|
20
20
|
// Version 6.7: deferred IAP startup, ownership-safe ads, and unified store preparation.
|
|
@@ -1404,212 +1404,10 @@ const routes = [
|
|
|
1404
1404
|
|
|
1405
1405
|
|
|
1406
1406
|
|
|
1407
|
-
// Check and change the "BridgeWebViewClient.java" file START
|
|
1408
|
-
/*
|
|
1409
|
-
For crash issue due to low memory problem, we need to modify the onRenderProcessGone method in BridgeWebViewClient.java.
|
|
1410
|
-
*/
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
const bridgeWebViewClientFilePath = path.join(process.cwd(), 'node_modules', '@capacitor/android/capacitor/src/main/java/com/getcapacitor', 'BridgeWebViewClient.java');
|
|
1414
|
-
|
|
1415
|
-
// Read the file
|
|
1416
|
-
if (!fs.existsSync(bridgeWebViewClientFilePath)) {
|
|
1417
|
-
console.error('❌ Error: BridgeWebViewClient.java not found.');
|
|
1418
|
-
process.exit(1);
|
|
1419
|
-
}
|
|
1420
|
-
|
|
1421
|
-
let fileContent = fs.readFileSync(bridgeWebViewClientFilePath, 'utf8');
|
|
1422
|
-
const bridgeWebViewLineEnding = fileContent.includes('\r\n') ? '\r\n' : '\n';
|
|
1423
|
-
fileContent = fileContent.replace(/\r\n/g, '\n');
|
|
1424
|
-
|
|
1425
|
-
// Define old and new code
|
|
1426
|
-
const oldCodeStart = `@Override
|
|
1427
|
-
public boolean onRenderProcessGone(WebView view, RenderProcessGoneDetail detail) {
|
|
1428
|
-
super.onRenderProcessGone(view, detail);
|
|
1429
|
-
boolean result = false;
|
|
1430
|
-
|
|
1431
|
-
List<WebViewListener> webViewListeners = bridge.getWebViewListeners();
|
|
1432
|
-
if (webViewListeners != null) {
|
|
1433
|
-
for (WebViewListener listener : bridge.getWebViewListeners()) {
|
|
1434
|
-
result = listener.onRenderProcessGone(view, detail) || result;
|
|
1435
|
-
}
|
|
1436
|
-
}
|
|
1437
|
-
|
|
1438
|
-
return result;
|
|
1439
|
-
}`;
|
|
1440
|
-
|
|
1441
|
-
// Match the previous patch so existing projects migrate without reinstalling Capacitor.
|
|
1442
|
-
const legacyReloadCode = `@Override
|
|
1443
|
-
public boolean onRenderProcessGone(WebView view, RenderProcessGoneDetail detail) {
|
|
1444
|
-
super.onRenderProcessGone(view, detail);
|
|
1445
|
-
|
|
1446
|
-
boolean result = false;
|
|
1447
|
-
|
|
1448
|
-
List<WebViewListener> webViewListeners = bridge.getWebViewListeners();
|
|
1449
|
-
if (webViewListeners != null) {
|
|
1450
|
-
for (WebViewListener listener : bridge.getWebViewListeners()) {
|
|
1451
|
-
result = listener.onRenderProcessGone(view, detail) || result;
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
|
|
1455
|
-
if (!result) {
|
|
1456
|
-
// If no one handled it, handle it ourselves!
|
|
1457
|
-
|
|
1458
|
-
/*if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
1459
|
-
if (detail.didCrash()) {
|
|
1460
|
-
//Log.e("CapacitorWebView", "WebView crashed internally!");
|
|
1461
|
-
} else {
|
|
1462
|
-
//Log.w("CapacitorWebView", "WebView was killed by system (low memory) internally!");
|
|
1463
|
-
}
|
|
1464
|
-
}*/
|
|
1465
|
-
|
|
1466
|
-
view.post(() -> {
|
|
1467
|
-
Toast.makeText(view.getContext(), "Reloading due to low memory issue", Toast.LENGTH_SHORT).show();
|
|
1468
|
-
});
|
|
1469
|
-
|
|
1470
|
-
view.reload(); // Safely reload WebView
|
|
1471
|
-
|
|
1472
|
-
return true; // We handled it
|
|
1473
|
-
}
|
|
1474
|
-
|
|
1475
|
-
return result;
|
|
1476
|
-
}`;
|
|
1477
|
-
|
|
1478
|
-
const newCode = `// Codeplay WebView renderer recovery (before-build 6.5).
|
|
1479
|
-
private boolean codeplayRendererRecoveryPending = false;
|
|
1480
|
-
private static long codeplayRendererRecoveryWindowStart = -1L;
|
|
1481
|
-
private static int codeplayRendererRecoveryCount = 0;
|
|
1482
|
-
|
|
1483
|
-
@Override
|
|
1484
|
-
public boolean onRenderProcessGone(WebView view, RenderProcessGoneDetail detail) {
|
|
1485
|
-
if (codeplayRendererRecoveryPending) return true;
|
|
1486
|
-
|
|
1487
|
-
boolean handled = false;
|
|
1488
|
-
List<WebViewListener> webViewListeners = bridge.getWebViewListeners();
|
|
1489
|
-
if (webViewListeners != null) {
|
|
1490
|
-
for (WebViewListener listener : webViewListeners) {
|
|
1491
|
-
handled = listener.onRenderProcessGone(view, detail) || handled;
|
|
1492
|
-
}
|
|
1493
|
-
}
|
|
1494
|
-
if (handled) return true;
|
|
1495
|
-
|
|
1496
|
-
codeplayRendererRecoveryPending = true;
|
|
1497
|
-
final androidx.appcompat.app.AppCompatActivity activity = bridge.getActivity();
|
|
1498
|
-
final boolean wasInForeground = activity != null && activity.getLifecycle()
|
|
1499
|
-
.getCurrentState().isAtLeast(androidx.lifecycle.Lifecycle.State.STARTED);
|
|
1500
|
-
|
|
1501
|
-
// A terminated renderer's WebView must never be loaded or reloaded again.
|
|
1502
|
-
if (view.getParent() instanceof android.view.ViewGroup) {
|
|
1503
|
-
((android.view.ViewGroup) view.getParent()).removeView(view);
|
|
1504
|
-
}
|
|
1505
|
-
view.destroy();
|
|
1506
|
-
|
|
1507
|
-
if (activity == null || activity.isFinishing() || activity.isDestroyed()) return true;
|
|
1508
|
-
|
|
1509
|
-
final android.os.Handler mainHandler = new android.os.Handler(android.os.Looper.getMainLooper());
|
|
1510
|
-
final Runnable recover = () -> {
|
|
1511
|
-
if (activity.isFinishing() || activity.isDestroyed()) return;
|
|
1512
|
-
|
|
1513
|
-
// Static counters survive Activity recreation and prevent an automatic restart loop.
|
|
1514
|
-
long now = android.os.SystemClock.elapsedRealtime();
|
|
1515
|
-
if (codeplayRendererRecoveryWindowStart < 0L ||
|
|
1516
|
-
now - codeplayRendererRecoveryWindowStart >= 60000L) {
|
|
1517
|
-
codeplayRendererRecoveryWindowStart = now;
|
|
1518
|
-
codeplayRendererRecoveryCount = 0;
|
|
1519
|
-
}
|
|
1520
|
-
|
|
1521
|
-
if (codeplayRendererRecoveryCount >= 3) {
|
|
1522
|
-
new android.app.AlertDialog.Builder(activity)
|
|
1523
|
-
.setTitle("Unable to restore the app")
|
|
1524
|
-
.setMessage("The app could not recover automatically. Please try again.")
|
|
1525
|
-
.setCancelable(false)
|
|
1526
|
-
.setPositiveButton("Try again", (dialog, which) -> {
|
|
1527
|
-
codeplayRendererRecoveryWindowStart = -1L;
|
|
1528
|
-
codeplayRendererRecoveryCount = 0;
|
|
1529
|
-
if (!activity.isFinishing() && !activity.isDestroyed()) activity.recreate();
|
|
1530
|
-
})
|
|
1531
|
-
.setNegativeButton("Close", (dialog, which) -> activity.finish())
|
|
1532
|
-
.show();
|
|
1533
|
-
return;
|
|
1534
|
-
}
|
|
1535
|
-
|
|
1536
|
-
codeplayRendererRecoveryCount++;
|
|
1537
|
-
if (!wasInForeground) {
|
|
1538
|
-
Toast.makeText(activity.getApplicationContext(), "Restoring your app…", Toast.LENGTH_SHORT).show();
|
|
1539
|
-
}
|
|
1540
|
-
activity.recreate();
|
|
1541
|
-
};
|
|
1542
|
-
|
|
1543
|
-
if (wasInForeground) {
|
|
1544
|
-
mainHandler.post(recover);
|
|
1545
|
-
} else {
|
|
1546
|
-
// Do not allocate another renderer while the app is hidden and memory may still be low.
|
|
1547
|
-
activity.getLifecycle().addObserver(new androidx.lifecycle.LifecycleEventObserver() {
|
|
1548
|
-
@Override
|
|
1549
|
-
public void onStateChanged(
|
|
1550
|
-
androidx.lifecycle.LifecycleOwner source,
|
|
1551
|
-
androidx.lifecycle.Lifecycle.Event event
|
|
1552
|
-
) {
|
|
1553
|
-
if (event == androidx.lifecycle.Lifecycle.Event.ON_RESUME) {
|
|
1554
|
-
source.getLifecycle().removeObserver(this);
|
|
1555
|
-
mainHandler.post(recover);
|
|
1556
|
-
} else if (event == androidx.lifecycle.Lifecycle.Event.ON_DESTROY) {
|
|
1557
|
-
source.getLifecycle().removeObserver(this);
|
|
1558
|
-
}
|
|
1559
|
-
}
|
|
1560
|
-
});
|
|
1561
|
-
}
|
|
1562
|
-
return true;
|
|
1563
|
-
}`;
|
|
1564
|
-
|
|
1565
|
-
// Step 1: Update the stock method or migrate the previous reload-based patch.
|
|
1566
|
-
let updated = false;
|
|
1567
|
-
|
|
1568
|
-
if (fileContent.includes(newCode)) {
|
|
1569
|
-
console.log('ℹ️ Method already updated. No changes needed in "BridgeWebViewClient.java".');
|
|
1570
|
-
} else if (fileContent.includes(legacyReloadCode)) {
|
|
1571
|
-
fileContent = fileContent.replace(legacyReloadCode, newCode);
|
|
1572
|
-
updated = true;
|
|
1573
|
-
} else if (fileContent.includes(oldCodeStart)) {
|
|
1574
|
-
fileContent = fileContent.replace(oldCodeStart, newCode);
|
|
1575
|
-
updated = true;
|
|
1576
|
-
} else {
|
|
1577
|
-
console.error('❌ Error: Neither old nor new code found. Unexpected content.');
|
|
1578
|
-
process.exit(1);
|
|
1579
|
-
}
|
|
1580
|
-
|
|
1581
|
-
// Step 2: Check and add import if missing
|
|
1582
|
-
const importToast = 'import android.widget.Toast;';
|
|
1583
|
-
if (!fileContent.includes(importToast)) {
|
|
1584
|
-
console.log('✅ Adding missing import for Toast...');
|
|
1585
|
-
const importRegex = /import\s+[^;]+;/g;
|
|
1586
|
-
const matches = [...fileContent.matchAll(importRegex)];
|
|
1587
|
-
|
|
1588
|
-
if (matches.length > 0) {
|
|
1589
|
-
const lastImport = matches[matches.length - 1];
|
|
1590
|
-
const insertPosition = lastImport.index + lastImport[0].length;
|
|
1591
|
-
fileContent = fileContent.slice(0, insertPosition) + `\n${importToast}` + fileContent.slice(insertPosition);
|
|
1592
|
-
updated = true;
|
|
1593
|
-
} else {
|
|
1594
|
-
console.error('❌ Error: No import section found in file.');
|
|
1595
|
-
process.exit(1);
|
|
1596
|
-
}
|
|
1597
|
-
} else {
|
|
1598
|
-
console.log('ℹ️ Import for Toast already exists. No changes needed.');
|
|
1599
|
-
}
|
|
1600
|
-
|
|
1601
|
-
// Step 3: Save if updated
|
|
1602
|
-
if (updated) {
|
|
1603
|
-
fs.writeFileSync(bridgeWebViewClientFilePath, fileContent.replace(/\n/g, bridgeWebViewLineEnding), 'utf8');
|
|
1604
|
-
console.log('✅ File updated successfully.');
|
|
1605
|
-
} else {
|
|
1606
|
-
console.log('ℹ️ No changes needed.');
|
|
1607
|
-
}
|
|
1608
1407
|
|
|
1609
1408
|
|
|
1610
1409
|
|
|
1611
1410
|
|
|
1612
|
-
// Check and change the "BridgeWebViewClient.java" file END
|
|
1613
1411
|
|
|
1614
1412
|
|
|
1615
1413
|
|
|
@@ -1618,46 +1416,6 @@ if (updated) {
|
|
|
1618
1416
|
|
|
1619
1417
|
|
|
1620
1418
|
|
|
1621
|
-
/*
|
|
1622
|
-
// To resolve the kotlin version issue, we need to update the kotlin version in the build.gradle file START
|
|
1623
|
-
|
|
1624
|
-
// Build the path dynamically like you requested
|
|
1625
|
-
const gradlePath = path.join(
|
|
1626
|
-
process.cwd(),
|
|
1627
|
-
'android',
|
|
1628
|
-
'build.gradle'
|
|
1629
|
-
);
|
|
1630
|
-
|
|
1631
|
-
// Read the existing build.gradle
|
|
1632
|
-
let gradleContent = fs.readFileSync(gradlePath, 'utf8');
|
|
1633
|
-
|
|
1634
|
-
// Add `ext.kotlin_version` if it's not already there
|
|
1635
|
-
if (!gradleContent.includes('ext.kotlin_version')) {
|
|
1636
|
-
gradleContent = gradleContent.replace(
|
|
1637
|
-
/buildscript\s*{/,
|
|
1638
|
-
`buildscript {\n ext.kotlin_version = '2.1.0'`
|
|
1639
|
-
);
|
|
1640
|
-
}
|
|
1641
|
-
|
|
1642
|
-
// Add Kotlin classpath if it's not already there
|
|
1643
|
-
if (!gradleContent.includes('org.jetbrains.kotlin:kotlin-gradle-plugin')) {
|
|
1644
|
-
gradleContent = gradleContent.replace(
|
|
1645
|
-
/dependencies\s*{([\s\S]*?)classpath 'com.android.tools.build:gradle:8.7.2'/,
|
|
1646
|
-
`dependencies {\n classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")\n$1classpath 'com.android.tools.build:gradle:8.7.2'`
|
|
1647
|
-
);
|
|
1648
|
-
}
|
|
1649
|
-
|
|
1650
|
-
// Write back the modified content
|
|
1651
|
-
fs.writeFileSync(gradlePath, gradleContent, 'utf8');
|
|
1652
|
-
|
|
1653
|
-
console.log('✅ Kotlin version updated in build.gradle.');
|
|
1654
|
-
|
|
1655
|
-
// To resolve the kotlin version issue, we need to update the kotlin version in the build.gradle file END
|
|
1656
|
-
*/
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
1419
|
|
|
1662
1420
|
|
|
1663
1421
|
|
|
@@ -4478,115 +4236,6 @@ const validateAndRestoreSignDetails=()=>{
|
|
|
4478
4236
|
|
|
4479
4237
|
}
|
|
4480
4238
|
|
|
4481
|
-
//################################## SystemBars.java update for "@capacitor/android": "^8.3.0" plugin START ###############################
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
const filePath = path.join(
|
|
4485
|
-
process.cwd(),
|
|
4486
|
-
"node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/plugin/SystemBars.java"
|
|
4487
|
-
);
|
|
4488
|
-
|
|
4489
|
-
const SYSTEM_BARS_PATCH_MARKER = "CODEPLAY_KEYBOARD_INSET_FIX";
|
|
4490
|
-
|
|
4491
|
-
function getSystemBarsPatchedBlock(originalBlock, content) {
|
|
4492
|
-
const isCapacitor842OrNewer = content.includes("private String insetsHandling = INSETS_HANDLING_CSS;");
|
|
4493
|
-
const safeAreaCondition = isCapacitor842OrNewer
|
|
4494
|
-
? "INSETS_HANDLING_CSS.equals(insetsHandling)"
|
|
4495
|
-
: "Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM && hasViewportCover && insetHandlingEnabled";
|
|
4496
|
-
|
|
4497
|
-
return `if (shouldPassthroughInsets) {
|
|
4498
|
-
/* ${SYSTEM_BARS_PATCH_MARKER}
|
|
4499
|
-
${originalBlock.split("\n").map(line => " " + line).join("\n")}
|
|
4500
|
-
*/
|
|
4501
|
-
|
|
4502
|
-
// Codeplay fix: avoid adding IME height as WebView parent padding.
|
|
4503
|
-
v.setPadding(0, 0, 0, 0);
|
|
4504
|
-
|
|
4505
|
-
if (${safeAreaCondition}) {
|
|
4506
|
-
Insets safeAreaInsets = calcSafeAreaInsets(insets);
|
|
4507
|
-
injectSafeAreaCSS(safeAreaInsets.top, safeAreaInsets.right, safeAreaInsets.bottom, safeAreaInsets.left);
|
|
4508
|
-
}
|
|
4509
|
-
|
|
4510
|
-
return insets; // WebView handles keyboard and safe-area sizing.
|
|
4511
|
-
}`;
|
|
4512
|
-
}
|
|
4513
|
-
|
|
4514
|
-
function findShouldPassthroughInsetsBlock(content) {
|
|
4515
|
-
const start = content.indexOf(" if (shouldPassthroughInsets) {");
|
|
4516
|
-
if (start === -1) return null;
|
|
4517
|
-
|
|
4518
|
-
const endMarker = "\n\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM)";
|
|
4519
|
-
const end = content.indexOf(endMarker, start);
|
|
4520
|
-
if (end === -1) return null;
|
|
4521
|
-
|
|
4522
|
-
return {
|
|
4523
|
-
start,
|
|
4524
|
-
end,
|
|
4525
|
-
text: content.slice(start, end)
|
|
4526
|
-
};
|
|
4527
|
-
}
|
|
4528
|
-
|
|
4529
|
-
// 🚨 ERROR MESSAGE
|
|
4530
|
-
const ERROR_MSG = `
|
|
4531
|
-
❌ Capacitor SystemBars.java structure changed!
|
|
4532
|
-
|
|
4533
|
-
Plugin: @capacitor/android
|
|
4534
|
-
Path : node_modules\@capacitor\android\capacitor\src\main\java\com\getcapacitor\plugin\SystemBars.java
|
|
4535
|
-
|
|
4536
|
-
Check version of "@capacitor/android": in package.json
|
|
4537
|
-
|
|
4538
|
-
👉 Expected code block not found.
|
|
4539
|
-
|
|
4540
|
-
This usually means Capacitor updated internally.
|
|
4541
|
-
|
|
4542
|
-
Please:
|
|
4543
|
-
1. Open SystemBars.java
|
|
4544
|
-
2. Update patch script
|
|
4545
|
-
3. Re-run build
|
|
4546
|
-
|
|
4547
|
-
⛔ Build stopped.
|
|
4548
|
-
`;
|
|
4549
|
-
|
|
4550
|
-
function patchFile() {
|
|
4551
|
-
if (!fs.existsSync(filePath)) {
|
|
4552
|
-
console.error("❌ SystemBars.java not found!");
|
|
4553
|
-
process.exit(1);
|
|
4554
|
-
}
|
|
4555
|
-
|
|
4556
|
-
const capacitorConfig = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
4557
|
-
if (capacitorConfig.plugins?.SystemBars?.insetsHandling === "disable") {
|
|
4558
|
-
console.log('ℹ️ SystemBars.insetsHandling is "disable"; skipping SystemBars.java keyboard inset patch.');
|
|
4559
|
-
return;
|
|
4560
|
-
}
|
|
4561
|
-
|
|
4562
|
-
let content = fs.readFileSync(filePath, "utf8");
|
|
4563
|
-
|
|
4564
|
-
// ✅ Already patched?
|
|
4565
|
-
if (content.includes(SYSTEM_BARS_PATCH_MARKER) || content.includes("🔴 ORIGINAL CODE (COMMENTED FOR SAFETY)")) {
|
|
4566
|
-
console.log("✅ Already SystemBars.java patched. Skipping...");
|
|
4567
|
-
return;
|
|
4568
|
-
}
|
|
4569
|
-
|
|
4570
|
-
const block = findShouldPassthroughInsetsBlock(content);
|
|
4571
|
-
if (!block) {
|
|
4572
|
-
console.error(ERROR_MSG);
|
|
4573
|
-
process.exit(1);
|
|
4574
|
-
}
|
|
4575
|
-
|
|
4576
|
-
// 🔁 Replace
|
|
4577
|
-
const updated =
|
|
4578
|
-
content.slice(0, block.start) +
|
|
4579
|
-
getSystemBarsPatchedBlock(block.text, content) +
|
|
4580
|
-
content.slice(block.end);
|
|
4581
|
-
|
|
4582
|
-
fs.writeFileSync(filePath, updated, "utf8");
|
|
4583
|
-
|
|
4584
|
-
console.log("✅ SystemBars.java patched with Codeplay keyboard inset fix!");
|
|
4585
|
-
}
|
|
4586
|
-
|
|
4587
|
-
//patchFile();
|
|
4588
|
-
|
|
4589
|
-
//################################## SystemBars.java update for "@capacitor/android": "^8.3.0" plugin END ###############################
|
|
4590
4239
|
|
|
4591
4240
|
// Android build optimization START
|
|
4592
4241
|
function findAndroidBuildBlock(content, name) {
|
|
@@ -4670,14 +4319,6 @@ function syncAndroidBuildOptimization() {
|
|
|
4670
4319
|
const next = original.slice(0, androidBlock.start) + androidContent + original.slice(androidBlock.end);
|
|
4671
4320
|
if (next !== original) fs.writeFileSync(androidAppBuildGradlePath, next, 'utf8');
|
|
4672
4321
|
|
|
4673
|
-
const propertiesPath = path.join(androidPlatformPath, 'gradle.properties');
|
|
4674
|
-
const properties = fs.existsSync(propertiesPath) ? fs.readFileSync(propertiesPath, 'utf8') : '';
|
|
4675
|
-
const property = 'android.r8.optimizedResourceShrinking=true';
|
|
4676
|
-
const propertyPattern = /^[ \t]*[#!]?[ \t]*android\.r8\.optimizedResourceShrinking(?:[ \t]*[=:]|[ \t]+|[ \t]*$)/m;
|
|
4677
|
-
const nextProperties = propertyPattern.test(properties)
|
|
4678
|
-
? properties
|
|
4679
|
-
: `${properties.trimEnd()}${newline}${property}${newline}`;
|
|
4680
|
-
if (nextProperties !== properties) fs.writeFileSync(propertiesPath, nextProperties, 'utf8');
|
|
4681
4322
|
console.log('✅ Android build optimization checked; minifyEnabled and shrinkResources boolean values set to true.');
|
|
4682
4323
|
}
|
|
4683
4324
|
// Android build optimization END
|
|
@@ -4721,12 +4362,19 @@ function syncAndroidCordovaResourceKeep() {
|
|
|
4721
4362
|
async function main() {
|
|
4722
4363
|
require('./saf-mediastore-dependency.cjs').syncSafMediastoreDependency(process.cwd());
|
|
4723
4364
|
const buildPackage = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
4365
|
+
const capacitorCore = require('@capacitor/core/package.json').version;
|
|
4366
|
+
if (Number(capacitorCore.split('.')[0]) >= 9) {
|
|
4367
|
+
const patchResult = require('codeplay-common/scripts/prepare-capacitor-9.cjs').prepare(process.cwd(), true);
|
|
4368
|
+
for (const item of patchResult.review) console.warn(`codeplay-common patch review: ${item}`);
|
|
4369
|
+
}
|
|
4724
4370
|
const buildScripts = updateBuildEntrypoints(buildPackage.scripts || {});
|
|
4725
4371
|
if (JSON.stringify(buildScripts) !== JSON.stringify(buildPackage.scripts)) {
|
|
4726
4372
|
buildPackage.scripts = buildScripts;
|
|
4727
4373
|
fs.writeFileSync(packageJsonPath, JSON.stringify(buildPackage, null, 2) + '\n');
|
|
4728
4374
|
}
|
|
4729
|
-
|
|
4375
|
+
if (buildPlatform === 'android' && fs.existsSync(androidPlatformPath)) {
|
|
4376
|
+
require('./sync-notification-large-icon.cjs').syncNotificationLargeIcon(process.cwd());
|
|
4377
|
+
}
|
|
4730
4378
|
require('./setup-ruads.cjs').syncRuAdsSetup(process.cwd());
|
|
4731
4379
|
validateThemeFolderLocation();
|
|
4732
4380
|
validateAndRestoreSignDetails();
|
|
@@ -4744,7 +4392,6 @@ async function main() {
|
|
|
4744
4392
|
const adPackagesChanged = ruAdsBuild.syncAdProviderPackages(process.cwd(), runNpmCommand);
|
|
4745
4393
|
await syncAdmobNextgenMigration();
|
|
4746
4394
|
syncCodeplaySystemBarsPackage();
|
|
4747
|
-
require('./migrate-system-bars.cjs').migrateSystemBars();
|
|
4748
4395
|
const legacyStatusBar = await require('./migrate-system-bars.cjs').migrateLegacyStatusBar();
|
|
4749
4396
|
if (legacyStatusBar.status === 'retained') console.warn('Legacy StatusBar plugin retained:', legacyStatusBar.references.join(', '));
|
|
4750
4397
|
syncSystemBarsSafeAreaMigration();
|
|
@@ -3,21 +3,21 @@ const path = require('path');
|
|
|
3
3
|
const tasks = {
|
|
4
4
|
'before-build': 'node buildCodeplay/codeplayBeforeBuild.js',
|
|
5
5
|
'package-id': 'node buildCodeplay/packageidBaseModification.js',
|
|
6
|
-
'splash': 'node buildCodeplay/
|
|
7
|
-
'splash-animation': 'node buildCodeplay/setSplashAnimation.js',
|
|
6
|
+
'splash': 'node buildCodeplay/sync-notification-large-icon.cjs',
|
|
8
7
|
'manifest': 'node buildCodeplay/manifestModification.js',
|
|
9
8
|
'admob-sync': 'node buildCodeplay/sync-admob-nextgen.js',
|
|
10
9
|
'apk': 'node buildCodeplay/apk-store-builder.js',
|
|
11
10
|
'final-release': 'node finalrelease',
|
|
12
11
|
};
|
|
13
|
-
const syncAfter = `${tasks.splash} && ${tasks
|
|
12
|
+
const syncAfter = `${tasks.splash} && ${tasks.manifest} && node scripts-common/setup-baseline-profile.js`;
|
|
14
13
|
function updateBuildScripts(scripts) {
|
|
15
14
|
const next = { ...scripts };
|
|
16
15
|
for (const key of Object.keys(next)) {
|
|
17
16
|
if (typeof next[key] !== 'string') continue;
|
|
18
17
|
next[key] = next[key].replace(/(^|[\s"'=])(\.\/)?scripts\//g, '$1$2scripts-common/');
|
|
19
18
|
next[key] = next[key].replace(/node\s+node_modules\/codeplay-common\/scripts\/run\.cjs\s+([\w-]+)/g, (match, task) => tasks[task] || (task === 'sync-after' ? syncAfter : match))
|
|
20
|
-
.replace(/buildCodeplay\/(codeplayBeforeBuild|packageidBaseModification
|
|
19
|
+
.replace(/buildCodeplay\/(codeplayBeforeBuild|packageidBaseModification)-\d+(?:\.\d+)*\.(?:js|mjs)/g, 'buildCodeplay/$1.js')
|
|
20
|
+
.replace(/buildCodeplay\/add-splash-screen(?:-\d+(?:\.\d+)*)?\.(?:js|mjs)/g, 'buildCodeplay/sync-notification-large-icon.cjs')
|
|
21
21
|
.replace(/node\s+iap-install-\d+(?:\.\d+)*\.js/g, tasks['before-build']);
|
|
22
22
|
}
|
|
23
23
|
if (!next.build) next.build = `${tasks['before-build']} && ${tasks['package-id']} && cross-env NODE_ENV=production vite build --logLevel warn`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
function syncNotificationLargeIcon(projectRoot) {
|
|
5
|
+
const source = path.join(projectRoot, 'resources', 'splash_icon.png');
|
|
6
|
+
const destination = path.join(projectRoot, 'android', 'app', 'src', 'main', 'res', 'drawable-nodpi', 'splash_icon.png');
|
|
7
|
+
if (!fs.existsSync(source)) return false;
|
|
8
|
+
fs.mkdirSync(path.dirname(destination), { recursive: true });
|
|
9
|
+
if (fs.existsSync(destination) && fs.readFileSync(destination).equals(fs.readFileSync(source))) return false;
|
|
10
|
+
fs.copyFileSync(source, destination);
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (require.main === module) {
|
|
15
|
+
const changed = syncNotificationLargeIcon(path.resolve(__dirname, '..'));
|
|
16
|
+
console.log(changed ? 'Notification large icon copied.' : 'Notification large icon unchanged.');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = { syncNotificationLargeIcon };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
diff --git a/node_modules/@byteowls/capacitor-filesharer/android/build.gradle b/node_modules/@byteowls/capacitor-filesharer/android/build.gradle
|
|
2
|
+
--- a/node_modules/@byteowls/capacitor-filesharer/android/build.gradle
|
|
3
|
+
+++ b/node_modules/@byteowls/capacitor-filesharer/android/build.gradle
|
|
4
|
+
@@ -35,7 +35,7 @@
|
|
5
|
+
buildTypes {
|
|
6
|
+
release {
|
|
7
|
+
minifyEnabled false
|
|
8
|
+
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
9
|
+
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
lintOptions {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
diff --git a/node_modules/@capacitor-community/file-opener/android/build.gradle b/node_modules/@capacitor-community/file-opener/android/build.gradle
|
|
2
|
+
--- a/node_modules/@capacitor-community/file-opener/android/build.gradle
|
|
3
|
+
+++ b/node_modules/@capacitor-community/file-opener/android/build.gradle
|
|
4
|
+
@@ -30,7 +30,7 @@
|
|
5
|
+
buildTypes {
|
|
6
|
+
release {
|
|
7
|
+
minifyEnabled false
|
|
8
|
+
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
9
|
+
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
lintOptions {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
diff --git a/node_modules/@capacitor-community/in-app-review/android/build.gradle b/node_modules/@capacitor-community/in-app-review/android/build.gradle
|
|
2
|
+
index 7b96179..988e168 100644
|
|
3
|
+
--- a/node_modules/@capacitor-community/in-app-review/android/build.gradle
|
|
4
|
+
+++ b/node_modules/@capacitor-community/in-app-review/android/build.gradle
|
|
5
|
+
@@ -31,7 +31,7 @@ android {
|
|
6
|
+
buildTypes {
|
|
7
|
+
release {
|
|
8
|
+
minifyEnabled false
|
|
9
|
+
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
10
|
+
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
lintOptions {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
diff --git a/node_modules/@capacitor-community/native-audio/android/build.gradle b/node_modules/@capacitor-community/native-audio/android/build.gradle
|
|
2
|
+
--- a/node_modules/@capacitor-community/native-audio/android/build.gradle
|
|
3
|
+
+++ b/node_modules/@capacitor-community/native-audio/android/build.gradle
|
|
4
|
+
@@ -30,7 +30,7 @@
|
|
5
|
+
buildTypes {
|
|
6
|
+
release {
|
|
7
|
+
minifyEnabled false
|
|
8
|
+
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
9
|
+
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
lintOptions {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
diff --git a/node_modules/@capacitor-community/play-integrity/android/build.gradle b/node_modules/@capacitor-community/play-integrity/android/build.gradle
|
|
2
|
+
--- a/node_modules/@capacitor-community/play-integrity/android/build.gradle
|
|
3
|
+
+++ b/node_modules/@capacitor-community/play-integrity/android/build.gradle
|
|
4
|
+
@@ -31,7 +31,7 @@
|
|
5
|
+
buildTypes {
|
|
6
|
+
release {
|
|
7
|
+
minifyEnabled false
|
|
8
|
+
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
9
|
+
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
lintOptions {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
diff --git a/node_modules/@capacitor-community/privacy-screen/android/build.gradle b/node_modules/@capacitor-community/privacy-screen/android/build.gradle
|
|
2
|
+
--- a/node_modules/@capacitor-community/privacy-screen/android/build.gradle
|
|
3
|
+
+++ b/node_modules/@capacitor-community/privacy-screen/android/build.gradle
|
|
4
|
+
@@ -30,7 +30,7 @@
|
|
5
|
+
buildTypes {
|
|
6
|
+
release {
|
|
7
|
+
minifyEnabled false
|
|
8
|
+
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
9
|
+
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
lintOptions {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
diff --git a/node_modules/@capacitor-community/safe-area/android/build.gradle b/node_modules/@capacitor-community/safe-area/android/build.gradle
|
|
2
|
+
--- a/node_modules/@capacitor-community/safe-area/android/build.gradle
|
|
3
|
+
+++ b/node_modules/@capacitor-community/safe-area/android/build.gradle
|
|
4
|
+
@@ -3,23 +3,20 @@
|
|
5
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
|
|
6
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
|
|
7
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
|
|
8
|
+
- androidxCoreKTXVersion = project.hasProperty('androidxCoreKTXVersion') ? rootProject.ext.androidxCoreKTXVersion : '1.6.0'
|
|
9
|
+
+ androidxCoreVersion = project.hasProperty('androidxCoreVersion') ? rootProject.ext.androidxCoreVersion : '1.19.1'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
buildscript {
|
|
13
|
+
- ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.9.25'
|
|
14
|
+
repositories {
|
|
15
|
+
google()
|
|
16
|
+
mavenCentral()
|
|
17
|
+
}
|
|
18
|
+
dependencies {
|
|
19
|
+
classpath 'com.android.tools.build:gradle:8.7.2'
|
|
20
|
+
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
apply plugin: 'com.android.library'
|
|
25
|
+
-apply plugin: 'kotlin-android'
|
|
26
|
+
|
|
27
|
+
android {
|
|
28
|
+
namespace "com.getcapacitor.community.safearea"
|
|
29
|
+
@@ -34,7 +31,7 @@
|
|
30
|
+
buildTypes {
|
|
31
|
+
release {
|
|
32
|
+
minifyEnabled false
|
|
33
|
+
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
34
|
+
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
lintOptions {
|
|
38
|
+
@@ -56,7 +53,7 @@
|
|
39
|
+
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
40
|
+
implementation project(':capacitor-android')
|
|
41
|
+
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
42
|
+
- implementation "androidx.core:core-ktx:$androidxCoreKTXVersion"
|
|
43
|
+
+ implementation "androidx.core:core:$androidxCoreVersion"
|
|
44
|
+
testImplementation "junit:junit:$junitVersion"
|
|
45
|
+
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
46
|
+
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
diff --git a/node_modules/@capacitor-community/speech-recognition/android/build.gradle b/node_modules/@capacitor-community/speech-recognition/android/build.gradle
|
|
2
|
+
--- a/node_modules/@capacitor-community/speech-recognition/android/build.gradle
|
|
3
|
+
+++ b/node_modules/@capacitor-community/speech-recognition/android/build.gradle
|
|
4
|
+
@@ -30,7 +30,7 @@
|
|
5
|
+
buildTypes {
|
|
6
|
+
release {
|
|
7
|
+
minifyEnabled false
|
|
8
|
+
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
9
|
+
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
lintOptions {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
diff --git a/node_modules/@capacitor-community/text-to-speech/android/build.gradle b/node_modules/@capacitor-community/text-to-speech/android/build.gradle
|
|
2
|
+
--- a/node_modules/@capacitor-community/text-to-speech/android/build.gradle
|
|
3
|
+
+++ b/node_modules/@capacitor-community/text-to-speech/android/build.gradle
|
|
4
|
+
@@ -30,7 +30,7 @@
|
|
5
|
+
buildTypes {
|
|
6
|
+
release {
|
|
7
|
+
minifyEnabled false
|
|
8
|
+
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
9
|
+
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
lintOptions {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
diff --git a/node_modules/@mozartec/capacitor-microphone/android/build.gradle b/node_modules/@mozartec/capacitor-microphone/android/build.gradle
|
|
2
|
+
--- a/node_modules/@mozartec/capacitor-microphone/android/build.gradle
|
|
3
|
+
+++ b/node_modules/@mozartec/capacitor-microphone/android/build.gradle
|
|
4
|
+
@@ -7,19 +7,16 @@
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
buildscript {
|
|
8
|
+
- ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.9.25'
|
|
9
|
+
repositories {
|
|
10
|
+
google()
|
|
11
|
+
mavenCentral()
|
|
12
|
+
}
|
|
13
|
+
dependencies {
|
|
14
|
+
classpath 'com.android.tools.build:gradle:8.7.2'
|
|
15
|
+
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
apply plugin: 'com.android.library'
|
|
20
|
+
-apply plugin: 'kotlin-android'
|
|
21
|
+
|
|
22
|
+
android {
|
|
23
|
+
namespace "com.mozartec.capacitor.microphone"
|
|
24
|
+
@@ -34,7 +31,7 @@
|
|
25
|
+
buildTypes {
|
|
26
|
+
release {
|
|
27
|
+
minifyEnabled false
|
|
28
|
+
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
29
|
+
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
lintOptions {
|
|
33
|
+
@@ -59,6 +56,5 @@
|
|
34
|
+
testImplementation "junit:junit:$junitVersion"
|
|
35
|
+
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
36
|
+
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
37
|
+
- implementation "androidx.core:core-ktx:$androidxCoreVersion"
|
|
38
|
+
- implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
39
|
+
+ implementation "androidx.core:core:$androidxCoreVersion"
|
|
40
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
diff --git a/node_modules/@ottimis/capacitor-volumes/android/build.gradle b/node_modules/@ottimis/capacitor-volumes/android/build.gradle
|
|
2
|
+
--- a/node_modules/@ottimis/capacitor-volumes/android/build.gradle
|
|
3
|
+
+++ b/node_modules/@ottimis/capacitor-volumes/android/build.gradle
|
|
4
|
+
@@ -30,7 +30,7 @@
|
|
5
|
+
buildTypes {
|
|
6
|
+
release {
|
|
7
|
+
minifyEnabled false
|
|
8
|
+
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
9
|
+
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
lintOptions {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
diff --git a/node_modules/@whiteguru/capacitor-plugin-media/android/build.gradle b/node_modules/@whiteguru/capacitor-plugin-media/android/build.gradle
|
|
2
|
+
--- a/node_modules/@whiteguru/capacitor-plugin-media/android/build.gradle
|
|
3
|
+
+++ b/node_modules/@whiteguru/capacitor-plugin-media/android/build.gradle
|
|
4
|
+
@@ -30,7 +30,7 @@
|
|
5
|
+
buildTypes {
|
|
6
|
+
release {
|
|
7
|
+
minifyEnabled false
|
|
8
|
+
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
9
|
+
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
lintOptions {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
diff --git a/node_modules/capacitor-admob-nextgen/android/src/main/java/com/emi/plugins/admob/AdMobNextGenPlugin.java b/node_modules/capacitor-admob-nextgen/android/src/main/java/com/emi/plugins/admob/AdMobNextGenPlugin.java
|
|
2
|
+
--- a/node_modules/capacitor-admob-nextgen/android/src/main/java/com/emi/plugins/admob/AdMobNextGenPlugin.java
|
|
3
|
+
+++ b/node_modules/capacitor-admob-nextgen/android/src/main/java/com/emi/plugins/admob/AdMobNextGenPlugin.java
|
|
4
|
+
@@ -185,4 +185,4 @@ public class AdMobNextGenPlugin extends Plugin {
|
|
5
|
+
String maxAdContentRating = call.getString("maxAdContentRating", "");
|
|
6
|
+
- Boolean tagForChildDirectedTreatment = call.hasOption("tagForChildDirectedTreatment") ? call.getBoolean("tagForChildDirectedTreatment") : null;
|
|
7
|
+
- Boolean tagForUnderAgeOfConsent = call.hasOption("tagForUnderAgeOfConsent") ? call.getBoolean("tagForUnderAgeOfConsent") : null;
|
|
8
|
+
+ Boolean tagForChildDirectedTreatment = call.getData().has("tagForChildDirectedTreatment") ? call.getBoolean("tagForChildDirectedTreatment") : null;
|
|
9
|
+
+ Boolean tagForUnderAgeOfConsent = call.getData().has("tagForUnderAgeOfConsent") ? call.getBoolean("tagForUnderAgeOfConsent") : null;
|
|
10
|
+
Boolean isTesting = call.getBoolean("isTesting", false);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
diff --git a/node_modules/capacitor-music-controls-plugin/android/build.gradle b/node_modules/capacitor-music-controls-plugin/android/build.gradle
|
|
2
|
+
--- a/node_modules/capacitor-music-controls-plugin/android/build.gradle
|
|
3
|
+
+++ b/node_modules/capacitor-music-controls-plugin/android/build.gradle
|
|
4
|
+
@@ -33,7 +33,7 @@
|
|
5
|
+
buildTypes {
|
|
6
|
+
release {
|
|
7
|
+
minifyEnabled false
|
|
8
|
+
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
9
|
+
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
lintOptions {
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
diff --git a/node_modules/capacitor-native-biometric/android/build.gradle b/node_modules/capacitor-native-biometric/android/build.gradle
|
|
2
|
+
--- a/node_modules/capacitor-native-biometric/android/build.gradle
|
|
3
|
+
+++ b/node_modules/capacitor-native-biometric/android/build.gradle
|
|
4
|
+
@@ -7,10 +7,10 @@
|
|
5
|
+
buildscript {
|
|
6
|
+
repositories {
|
|
7
|
+
google()
|
|
8
|
+
- jcenter()
|
|
9
|
+
+ mavenCentral()
|
|
10
|
+
}
|
|
11
|
+
dependencies {
|
|
12
|
+
- classpath 'com.android.tools.build:gradle:3.6.1'
|
|
13
|
+
+ classpath 'com.android.tools.build:gradle:9.4.1'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@@ -29,7 +29,7 @@
|
|
18
|
+
buildTypes {
|
|
19
|
+
release {
|
|
20
|
+
minifyEnabled false
|
|
21
|
+
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
22
|
+
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
lintOptions {
|
|
26
|
+
@@ -39,13 +39,14 @@
|
|
27
|
+
|
|
28
|
+
repositories {
|
|
29
|
+
google()
|
|
30
|
+
- jcenter()
|
|
31
|
+
+ mavenCentral()
|
|
32
|
+
mavenCentral()
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
dependencies {
|
|
37
|
+
implementation 'androidx.biometric:biometric:1.0.1'
|
|
38
|
+
+ implementation 'androidx.activity:activity:1.13.0'
|
|
39
|
+
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
40
|
+
implementation project(':capacitor-android')
|
|
41
|
+
implementation 'androidx.appcompat:appcompat:1.1.0'
|
|
42
|
+
diff --git a/node_modules/capacitor-native-biometric/android/src/main/java/com/epicshaggy/biometric/NativeBiometric.java b/node_modules/capacitor-native-biometric/android/src/main/java/com/epicshaggy/biometric/NativeBiometric.java
|
|
43
|
+
--- a/node_modules/capacitor-native-biometric/android/src/main/java/com/epicshaggy/biometric/NativeBiometric.java
|
|
44
|
+
+++ b/node_modules/capacitor-native-biometric/android/src/main/java/com/epicshaggy/biometric/NativeBiometric.java
|
|
45
|
+
@@ -140,19 +140,19 @@
|
|
46
|
+
|
|
47
|
+
intent.putExtra("title", call.getString("title", "Authenticate"));
|
|
48
|
+
|
|
49
|
+
- if (call.hasOption("subtitle")) {
|
|
50
|
+
+ if (call.getData().has("subtitle")) {
|
|
51
|
+
intent.putExtra("subtitle", call.getString("subtitle"));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
- if (call.hasOption("description")) {
|
|
55
|
+
+ if (call.getData().has("description")) {
|
|
56
|
+
intent.putExtra("description", call.getString("description"));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
- if (call.hasOption("negativeButtonText")) {
|
|
60
|
+
+ if (call.getData().has("negativeButtonText")) {
|
|
61
|
+
intent.putExtra("negativeButtonText", call.getString("negativeButtonText"));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
- if (call.hasOption("maxAttempts")) {
|
|
65
|
+
+ if (call.getData().has("maxAttempts")) {
|
|
66
|
+
intent.putExtra("maxAttempts", call.getInt("maxAttempts"));
|
|
67
|
+
}
|
|
68
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
diff --git a/node_modules/capacitor-voice-recorder/android/build.gradle b/node_modules/capacitor-voice-recorder/android/build.gradle
|
|
2
|
+
--- a/node_modules/capacitor-voice-recorder/android/build.gradle
|
|
3
|
+
+++ b/node_modules/capacitor-voice-recorder/android/build.gradle
|
|
4
|
+
@@ -30,7 +30,7 @@
|
|
5
|
+
buildTypes {
|
|
6
|
+
release {
|
|
7
|
+
minifyEnabled false
|
|
8
|
+
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
9
|
+
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
lintOptions {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
1
|
const path = require('path');
|
|
3
2
|
const { execFileSync } = require('child_process');
|
|
4
3
|
|
|
@@ -9,13 +8,7 @@ function run(scriptPath) {
|
|
|
9
8
|
execFileSync(process.execPath, [scriptPath], { cwd: root, stdio: 'inherit' });
|
|
10
9
|
}
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
if (fs.existsSync(splashIcon)) {
|
|
14
|
-
run(path.join(buildDir, 'add-splash-screen.js'));
|
|
15
|
-
run(path.join(buildDir, 'setSplashAnimation.js'));
|
|
16
|
-
} else {
|
|
17
|
-
console.log('ℹ️ Keeping the existing native splash because resources/splash_icon.png is not configured.');
|
|
18
|
-
}
|
|
11
|
+
run(path.join(buildDir, 'sync-notification-large-icon.cjs'));
|
|
19
12
|
|
|
20
13
|
run(path.join(buildDir, 'manifestModification.js'));
|
|
21
14
|
run(path.join(__dirname, 'setup-baseline-profile.js'));
|
package/package.json
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeplay-common",
|
|
3
|
-
"version": "4.11.
|
|
3
|
+
"version": "4.11.41-alpha.2",
|
|
4
4
|
"description": "Common build scripts and files",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"postinstall": "node scripts/sync-files.js",
|
|
7
|
-
"preinstall": "node scripts/uninstall.js"
|
|
7
|
+
"preinstall": "node scripts/uninstall.js",
|
|
8
|
+
"cap9:prepare": "node scripts/prepare-capacitor-9.cjs"
|
|
8
9
|
},
|
|
9
10
|
"dependencies": {
|
|
10
11
|
"adm-zip": "^0.6.1",
|
|
12
|
+
"patch-package": "^8.0.1",
|
|
11
13
|
"plist": "^3.1.0",
|
|
12
14
|
"terser": "^5.51.4"
|
|
13
15
|
},
|
|
14
16
|
"repository": {
|
|
15
17
|
"type": "git",
|
|
16
|
-
"url": "https://github.com/merbin2012/codeplay-common.git"
|
|
18
|
+
"url": "git+https://github.com/merbin2012/codeplay-common.git"
|
|
17
19
|
},
|
|
18
20
|
"author": "Codeplay Technologies",
|
|
19
21
|
"license": "MIT",
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { execFileSync } = require('child_process');
|
|
4
|
+
|
|
5
|
+
function prepare(root, apply = false) {
|
|
6
|
+
const packageFile = path.join(root, 'package.json');
|
|
7
|
+
const pkg = JSON.parse(fs.readFileSync(packageFile, 'utf8'));
|
|
8
|
+
const coreFile = path.join(root, 'node_modules/@capacitor/core/package.json');
|
|
9
|
+
const coreVersion = fs.existsSync(coreFile) ? JSON.parse(fs.readFileSync(coreFile, 'utf8')).version : null;
|
|
10
|
+
if (apply && !coreVersion?.startsWith('9.')) throw new Error('Apply patches only after installing Capacitor 9 in this app.');
|
|
11
|
+
const catalog = path.resolve(__dirname, '../files/patches/catalog');
|
|
12
|
+
const active = path.join(root, 'patches/active');
|
|
13
|
+
const selected = [];
|
|
14
|
+
const review = [];
|
|
15
|
+
if (!coreVersion?.startsWith('9.')) review.push(`Capacitor core ${coreVersion || 'not installed'}; upgrade before applying or building.`);
|
|
16
|
+
const nativeWriters = /(?:setSplashAnimation|add-splash-screen|splash-setup)\.\w+|BridgeWebViewClient\.java|plugin\/SystemBars\.java/;
|
|
17
|
+
for (const [key, command] of Object.entries(pkg.scripts || {})) {
|
|
18
|
+
if (nativeWriters.test(command)) review.push(`package.json script ${key} still invokes a legacy native writer: ${command}`);
|
|
19
|
+
}
|
|
20
|
+
for (const file of [
|
|
21
|
+
'scripts-common/run-codeplay-sync-after.js',
|
|
22
|
+
'buildCodeplay/codeplayBeforeBuild.js',
|
|
23
|
+
]) {
|
|
24
|
+
const target = path.join(root, file);
|
|
25
|
+
if (fs.existsSync(target) && nativeWriters.test(fs.readFileSync(target, 'utf8'))) {
|
|
26
|
+
review.push(`${file} mentions a legacy native writer; inspect its active call sites.`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
for (const name of fs.readdirSync(catalog).filter(name => name.endsWith('.patch'))) {
|
|
30
|
+
const match = name.match(/^(.*)\+([^+]+)\.patch$/);
|
|
31
|
+
if (!match) throw new Error(`Invalid patch name: ${name}`);
|
|
32
|
+
const [, encodedDependency, version] = match;
|
|
33
|
+
const dependency = encodedDependency.startsWith('@') ? encodedDependency.replace('+', '/') : encodedDependency;
|
|
34
|
+
const installed = path.join(root, 'node_modules', dependency, 'package.json');
|
|
35
|
+
if (!fs.existsSync(installed)) continue;
|
|
36
|
+
const actual = JSON.parse(fs.readFileSync(installed, 'utf8')).version;
|
|
37
|
+
if (actual !== version) {
|
|
38
|
+
if (apply && dependency === 'capacitor-admob-nextgen' && /^\d+\.\d+\.\d+/.test(actual)) {
|
|
39
|
+
const [major, minor] = actual.split('.').map(Number);
|
|
40
|
+
if (major < 1 || (major === 1 && minor < 6)) {
|
|
41
|
+
throw new Error(`capacitor-admob-nextgen ${actual} must be upgraded to 1.6.0 before the Capacitor 9 patch can be applied. Update package.json and the lockfile, then run npm install again.`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
review.push(`${dependency}: installed ${actual}; catalog patch ${version}. Check upstream before changing versions.`);
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
selected.push(name);
|
|
48
|
+
}
|
|
49
|
+
if (apply) {
|
|
50
|
+
const patchPackage = require.resolve('patch-package/index.js', { paths: [__dirname] });
|
|
51
|
+
const existing = fs.existsSync(active) ? fs.readdirSync(active) : [];
|
|
52
|
+
for (const name of existing.filter(name => name.endsWith('.patch'))) {
|
|
53
|
+
const match = name.match(/^(.*)\+([^+]+)\.patch$/);
|
|
54
|
+
if (!match) throw new Error(`Invalid active patch name: ${name}`);
|
|
55
|
+
const dependency = match[1].startsWith('@') ? match[1].replace('+', '/') : match[1];
|
|
56
|
+
const installed = path.join(root, 'node_modules', dependency, 'package.json');
|
|
57
|
+
const installedVersion = fs.existsSync(installed) ? JSON.parse(fs.readFileSync(installed, 'utf8')).version : null;
|
|
58
|
+
if (installedVersion !== match[2]) {
|
|
59
|
+
throw new Error(`Active patch ${name} targets ${match[2]}, but ${dependency} is ${installedVersion || 'not installed'}. Review the newer plugin and remove or regenerate this patch before continuing.`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
for (const name of selected) {
|
|
63
|
+
const target = path.join(active, name);
|
|
64
|
+
const source = path.join(catalog, name);
|
|
65
|
+
const related = existing.filter(file => file !== name && file.startsWith(name.replace(/\+[^+]+\.patch$/, '+')) && file.endsWith('.patch'));
|
|
66
|
+
if (related.length) throw new Error(`Conflicting active patch for ${name}: ${related.join(', ')}`);
|
|
67
|
+
if (fs.existsSync(target) && !fs.readFileSync(target).equals(fs.readFileSync(source))) {
|
|
68
|
+
review.push(`Preserved app-specific active patch: ${target}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
fs.mkdirSync(active, { recursive: true });
|
|
72
|
+
for (const name of selected) {
|
|
73
|
+
const target = path.join(active, name);
|
|
74
|
+
if (!fs.existsSync(target)) fs.copyFileSync(path.join(catalog, name), target);
|
|
75
|
+
}
|
|
76
|
+
if (fs.readdirSync(active).some(name => name.endsWith('.patch'))) {
|
|
77
|
+
const command = 'node node_modules/codeplay-common/scripts/prepare-capacitor-9.cjs --apply';
|
|
78
|
+
if (!pkg.scripts) pkg.scripts = {};
|
|
79
|
+
if (!pkg.scripts.postinstall) pkg.scripts.postinstall = command;
|
|
80
|
+
else if (!pkg.scripts.postinstall.includes(command)) pkg.scripts.postinstall = `${command} && ${pkg.scripts.postinstall}`;
|
|
81
|
+
fs.writeFileSync(packageFile, JSON.stringify(pkg, null, 2) + '\n');
|
|
82
|
+
execFileSync(process.execPath, [patchPackage, '--patch-dir', 'patches/active', '--error-on-fail'], { cwd: root, stdio: 'inherit' });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return { selected, review, apply };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (require.main === module) {
|
|
89
|
+
try {
|
|
90
|
+
const root = process.cwd();
|
|
91
|
+
const result = prepare(root, process.argv.includes('--apply'));
|
|
92
|
+
console.log(`${result.apply ? 'Prepared' : 'Would prepare'} ${result.selected.length} version-matched patches: ${result.selected.join(', ') || 'none'}`);
|
|
93
|
+
for (const item of result.review) console.warn(`Review: ${item}`);
|
|
94
|
+
if (result.apply) console.log('Installed matching patches in patches/active and applied them before the native build.');
|
|
95
|
+
} catch (error) { console.error(error.message); process.exitCode = 1; }
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
module.exports = { prepare };
|
package/scripts/sync-files.js
CHANGED
|
@@ -79,6 +79,8 @@ function install(options = {}) {
|
|
|
79
79
|
const packagePath = path.join(projectRoot, 'package.json');
|
|
80
80
|
if (!fs.existsSync(packagePath)) throw new Error('Consuming application package.json was not found.');
|
|
81
81
|
const pkg = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
|
|
82
|
+
const capacitorVersion = pkg.dependencies?.['@capacitor/core'] || pkg.devDependencies?.['@capacitor/core'] || '';
|
|
83
|
+
const capacitor9 = Number(capacitorVersion.match(/\d+/)?.[0]) >= 9;
|
|
82
84
|
const scripts = updateBuildScripts(pkg.scripts || {});
|
|
83
85
|
migrateAppScripts(projectRoot);
|
|
84
86
|
// Copy the common templates into each application for local testing.
|
|
@@ -87,17 +89,30 @@ function install(options = {}) {
|
|
|
87
89
|
fs.mkdirSync(buildTarget, { recursive: true });
|
|
88
90
|
for (const name of fs.readdirSync(buildSource)) {
|
|
89
91
|
const target = path.join(buildTarget, name);
|
|
92
|
+
if (capacitor9 && ['add-splash-screen.js', 'setSplashAnimation.js', 'splash-setup.cjs', 'splashxml'].includes(name)) continue;
|
|
90
93
|
if ((name === 'release-sync.config.json' || name === 'splashxml') && fs.existsSync(target)) continue;
|
|
91
94
|
fs.cpSync(path.join(buildSource, name), target, { recursive: true });
|
|
92
95
|
}
|
|
93
96
|
fs.copyFileSync(path.join(commonFiles, 'finalrelease'), path.join(projectRoot, 'finalrelease'));
|
|
94
97
|
if (options.copyAssets !== false) {
|
|
95
98
|
for (const name of fs.readdirSync(commonFiles)) {
|
|
96
|
-
if (name === 'buildCodeplay' || name === 'scripts-screenshot') continue;
|
|
99
|
+
if (name === 'buildCodeplay' || name === 'scripts-screenshot' || name === 'patches') continue;
|
|
97
100
|
fs.cpSync(path.join(commonFiles, name), path.join(projectRoot, name), { recursive: true });
|
|
98
101
|
}
|
|
102
|
+
const patchCatalog = path.join(commonFiles, 'patches', 'catalog');
|
|
103
|
+
const appCatalog = path.join(projectRoot, 'patches', 'catalog');
|
|
104
|
+
fs.mkdirSync(appCatalog, { recursive: true });
|
|
105
|
+
for (const name of fs.readdirSync(patchCatalog)) {
|
|
106
|
+
const source = path.join(patchCatalog, name);
|
|
107
|
+
const target = path.join(appCatalog, name);
|
|
108
|
+
if (!fs.statSync(source).isFile()) continue;
|
|
109
|
+
if (!fs.existsSync(target)) fs.copyFileSync(source, target);
|
|
110
|
+
else if (!fs.statSync(target).isFile() || !fs.readFileSync(target).equals(fs.readFileSync(source))) {
|
|
111
|
+
console.warn(`codeplay-common: preserved app-specific catalog patch ${target}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
99
114
|
}
|
|
100
|
-
require('../files/buildCodeplay/splash-setup.cjs').syncSplashSetup(projectRoot);
|
|
115
|
+
if (!capacitor9) require('../files/buildCodeplay/splash-setup.cjs').syncSplashSetup(projectRoot);
|
|
101
116
|
require('../files/buildCodeplay/setup-ruads.cjs').syncRuAdsSetup(projectRoot, {
|
|
102
117
|
runtimeRoot: path.resolve(__dirname, '../runtime/vk-ads'),
|
|
103
118
|
});
|
|
@@ -108,6 +123,12 @@ function install(options = {}) {
|
|
|
108
123
|
pkg.scripts = scripts;
|
|
109
124
|
require('../files/buildCodeplay/saf-mediastore-dependency.cjs').syncSafMediastoreDependency(projectRoot);
|
|
110
125
|
fs.writeFileSync(packagePath, JSON.stringify(pkg, null, 2) + '\n');
|
|
126
|
+
if (capacitor9 && fs.existsSync(path.join(projectRoot, 'node_modules', '@capacitor', 'core', 'package.json'))) {
|
|
127
|
+
const result = require('./prepare-capacitor-9.cjs').prepare(projectRoot, true);
|
|
128
|
+
for (const item of result.review) console.warn(`codeplay-common patch review: ${item}`);
|
|
129
|
+
} else if (capacitor9) {
|
|
130
|
+
console.warn('codeplay-common: Capacitor core is not installed yet; patch setup will run before the next build.');
|
|
131
|
+
}
|
|
111
132
|
// Cleanup happens only after replacement assets and package commands exist.
|
|
112
133
|
removeVersionedBuildScripts(projectRoot);
|
|
113
134
|
console.log('codeplay-common: unversioned build scripts copied to app buildCodeplay; app-owned settings preserved.');
|