codeplay-common 4.11.39 → 4.11.41-alpha.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.
- package/README.md +20 -0
- package/files/buildCodeplay/codeplayBeforeBuild.js +4 -362
- package/files/buildCodeplay/project-scripts.cjs +4 -4
- package/files/buildCodeplay/sync-notification-large-icon.cjs +19 -0
- package/files/scripts-common/run-codeplay-sync-after.js +1 -8
- package/files/take-screen-image.js +106 -7
- package/migration/capacitor-8-to-9-migration.md +49 -0
- package/migration/patches/@byteowls+capacitor-filesharer+7.0.0.patch +12 -0
- package/migration/patches/@capacitor-community+file-opener+8.0.0.patch +12 -0
- package/migration/patches/@capacitor-community+in-app-review+8.0.0.patch +13 -0
- package/migration/patches/@capacitor-community+native-audio+8.0.0.patch +12 -0
- package/migration/patches/@capacitor-community+play-integrity+8.0.0.patch +12 -0
- package/migration/patches/@capacitor-community+privacy-screen+8.0.0.patch +12 -0
- package/migration/patches/@capacitor-community+safe-area+7.0.0-alpha.1.patch +46 -0
- package/migration/patches/@capacitor-community+speech-recognition+7.0.1.patch +12 -0
- package/migration/patches/@capacitor-community+text-to-speech+8.0.0.patch +12 -0
- package/migration/patches/@mozartec+capacitor-microphone+7.1.0.patch +40 -0
- package/migration/patches/@ottimis+capacitor-volumes+7.0.0.patch +12 -0
- package/migration/patches/@whiteguru+capacitor-plugin-media+8.0.1.patch +12 -0
- package/migration/patches/capacitor-admob-nextgen+1.6.0.patch +10 -0
- package/migration/patches/capacitor-music-controls-plugin+8.0.0.patch +12 -0
- package/migration/patches/capacitor-native-biometric+4.2.2.patch +68 -0
- package/migration/patches/capacitor-voice-recorder+7.0.6.patch +12 -0
- package/package.json +6 -4
- package/scripts/prepare-capacitor-9.cjs +82 -0
- package/scripts/sync-files.js +9 -1
package/README.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# codeplay-common
|
|
2
2
|
|
|
3
|
+
## Capacitor 9 migration alpha (4.11.41-alpha.0)
|
|
4
|
+
|
|
5
|
+
Install with `npm install codeplay-common@alpha` in a test branch. Installation places
|
|
6
|
+
`AGENTS/capacitor-8-to-9-migration.md` only if the app does not already have it.
|
|
7
|
+
Follow that guide for each app's dependency, Android, iOS, and device migration.
|
|
8
|
+
The package does not migrate an arbitrary app merely by being installed.
|
|
9
|
+
|
|
10
|
+
After the app uses Capacitor 9, run
|
|
11
|
+
`node node_modules/codeplay-common/scripts/prepare-capacitor-9.cjs` to list
|
|
12
|
+
version-matched compatibility patches. Install `patch-package` in the app and run
|
|
13
|
+
the same command with `--apply` to copy those patches into `patches/active/` and
|
|
14
|
+
append a postinstall command. The shared AdMob patch changes only the removed
|
|
15
|
+
`hasOption()` API; app-specific banner layout changes remain in their own app.
|
|
16
|
+
Review the app's existing active patch before applying a catalog patch.
|
|
17
|
+
|
|
18
|
+
The alpha build helper no longer rewrites Capacitor's `BridgeWebViewClient.java` or
|
|
19
|
+
`SystemBars.java`. In Capacitor 9 apps, the installer leaves the old custom splash
|
|
20
|
+
scripts uninstalled and uses the notification icon sync helper instead. Inspect
|
|
21
|
+
existing scripts and native files as described in the guide before building.
|
|
22
|
+
|
|
3
23
|
Version 4.11.37 adds the `/buildCodeplay` Vite alias during installation and
|
|
4
24
|
before-build setup, including upgrades of existing generated wrappers. This
|
|
5
25
|
lets Huawei privacy startup modules load during Live Reload when the app's
|
|
@@ -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,259 +1404,17 @@ 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
1407
|
|
|
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
1408
|
|
|
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
1409
|
|
|
1507
|
-
if (activity == null || activity.isFinishing() || activity.isDestroyed()) return true;
|
|
1508
1410
|
|
|
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
1411
|
|
|
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
1412
|
|
|
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
1413
|
|
|
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
1414
|
|
|
1609
1415
|
|
|
1610
1416
|
|
|
1611
1417
|
|
|
1612
|
-
// Check and change the "BridgeWebViewClient.java" file END
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
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
1418
|
|
|
1661
1419
|
|
|
1662
1420
|
|
|
@@ -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
|
|
@@ -4726,7 +4367,9 @@ async function main() {
|
|
|
4726
4367
|
buildPackage.scripts = buildScripts;
|
|
4727
4368
|
fs.writeFileSync(packageJsonPath, JSON.stringify(buildPackage, null, 2) + '\n');
|
|
4728
4369
|
}
|
|
4729
|
-
|
|
4370
|
+
if (buildPlatform === 'android' && fs.existsSync(androidPlatformPath)) {
|
|
4371
|
+
require('./sync-notification-large-icon.cjs').syncNotificationLargeIcon(process.cwd());
|
|
4372
|
+
}
|
|
4730
4373
|
require('./setup-ruads.cjs').syncRuAdsSetup(process.cwd());
|
|
4731
4374
|
validateThemeFolderLocation();
|
|
4732
4375
|
validateAndRestoreSignDetails();
|
|
@@ -4744,7 +4387,6 @@ async function main() {
|
|
|
4744
4387
|
const adPackagesChanged = ruAdsBuild.syncAdProviderPackages(process.cwd(), runNpmCommand);
|
|
4745
4388
|
await syncAdmobNextgenMigration();
|
|
4746
4389
|
syncCodeplaySystemBarsPackage();
|
|
4747
|
-
require('./migrate-system-bars.cjs').migrateSystemBars();
|
|
4748
4390
|
const legacyStatusBar = await require('./migrate-system-bars.cjs').migrateLegacyStatusBar();
|
|
4749
4391
|
if (legacyStatusBar.status === 'retained') console.warn('Legacy StatusBar plugin retained:', legacyStatusBar.references.join(', '));
|
|
4750
4392
|
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 };
|
|
@@ -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'));
|
|
@@ -107,6 +107,32 @@ const deviceProfiles = [
|
|
|
107
107
|
orientationSensitive: true,
|
|
108
108
|
mobile: true,
|
|
109
109
|
},
|
|
110
|
+
{
|
|
111
|
+
name: 'ru-store-phone',
|
|
112
|
+
aliases: ['ru-store'],
|
|
113
|
+
label: 'RuStore Russian phone promotion',
|
|
114
|
+
outputDirectory: 'Ru-Store/Phone',
|
|
115
|
+
sourceDirectory: 'Android',
|
|
116
|
+
copyLocale: 'ru',
|
|
117
|
+
frameType: 'android-phone',
|
|
118
|
+
frameless: true,
|
|
119
|
+
framedWidth: 1080,
|
|
120
|
+
framedHeight: 1920,
|
|
121
|
+
width: 360,
|
|
122
|
+
height: 800,
|
|
123
|
+
deviceScaleFactor: 3,
|
|
124
|
+
orientationSensitive: true,
|
|
125
|
+
mobile: true,
|
|
126
|
+
storeRequirements: {
|
|
127
|
+
maxFileSizeBytes: 5 * 1000 * 1000,
|
|
128
|
+
minPixels: 320,
|
|
129
|
+
maxPixels: 3840,
|
|
130
|
+
minAspectRatio: 9 / 16,
|
|
131
|
+
maxAspectRatio: 16 / 9,
|
|
132
|
+
minImages: 3,
|
|
133
|
+
maxImages: 10,
|
|
134
|
+
},
|
|
135
|
+
},
|
|
110
136
|
{
|
|
111
137
|
name: 'vivo-store',
|
|
112
138
|
label: 'Vivo Store portrait screenshot',
|
|
@@ -180,6 +206,30 @@ const deviceProfiles = [
|
|
|
180
206
|
orientationSensitive: true,
|
|
181
207
|
mobile: true,
|
|
182
208
|
},
|
|
209
|
+
{
|
|
210
|
+
name: 'ru-store-tablet',
|
|
211
|
+
label: 'RuStore Russian tablet promotion',
|
|
212
|
+
outputDirectory: 'Ru-Store/Tablet',
|
|
213
|
+
sourceDirectory: 'Android-Tab-10inch',
|
|
214
|
+
copyLocale: 'ru',
|
|
215
|
+
frameType: 'tablet',
|
|
216
|
+
width: 900,
|
|
217
|
+
height: 1600,
|
|
218
|
+
deviceScaleFactor: 2,
|
|
219
|
+
framedWidth: 1800,
|
|
220
|
+
framedHeight: 3200,
|
|
221
|
+
orientationSensitive: true,
|
|
222
|
+
mobile: true,
|
|
223
|
+
storeRequirements: {
|
|
224
|
+
maxFileSizeBytes: 5 * 1000 * 1000,
|
|
225
|
+
minPixels: 320,
|
|
226
|
+
maxPixels: 3840,
|
|
227
|
+
minAspectRatio: 9 / 16,
|
|
228
|
+
maxAspectRatio: 16 / 9,
|
|
229
|
+
minImages: 3,
|
|
230
|
+
maxImages: 10,
|
|
231
|
+
},
|
|
232
|
+
},
|
|
183
233
|
{
|
|
184
234
|
name: 'iphone',
|
|
185
235
|
label: 'iPhone Dynamic Island medium-display App Store viewport',
|
|
@@ -310,6 +360,27 @@ const deviceProfiles = [
|
|
|
310
360
|
deviceScaleFactor: 1,
|
|
311
361
|
mobile: false,
|
|
312
362
|
},
|
|
363
|
+
{
|
|
364
|
+
name: 'ru-store-tv',
|
|
365
|
+
label: 'RuStore Russian TV promotion',
|
|
366
|
+
outputDirectory: 'Ru-Store/TV',
|
|
367
|
+
sourceDirectory: 'Android-TV',
|
|
368
|
+
copyLocale: 'ru',
|
|
369
|
+
frameType: 'tv',
|
|
370
|
+
width: 1920,
|
|
371
|
+
height: 1080,
|
|
372
|
+
deviceScaleFactor: 1,
|
|
373
|
+
mobile: false,
|
|
374
|
+
storeRequirements: {
|
|
375
|
+
maxFileSizeBytes: 5 * 1000 * 1000,
|
|
376
|
+
minPixels: 320,
|
|
377
|
+
maxPixels: 3840,
|
|
378
|
+
minAspectRatio: 16 / 9,
|
|
379
|
+
maxAspectRatio: 16 / 9,
|
|
380
|
+
minImages: 3,
|
|
381
|
+
maxImages: 10,
|
|
382
|
+
},
|
|
383
|
+
},
|
|
313
384
|
{
|
|
314
385
|
name: 'chromebook',
|
|
315
386
|
label: 'Chromebook 4K Play Store viewport',
|
|
@@ -454,7 +525,7 @@ function sanitizeName(input, fallback) {
|
|
|
454
525
|
|
|
455
526
|
function getSelectedOutputDirectories(selectedProfiles) {
|
|
456
527
|
return [...new Set(selectedProfiles.flatMap((profile) => ([
|
|
457
|
-
path.join(screenshotDirectory, profile.outputDirectory),
|
|
528
|
+
path.join(screenshotDirectory, profile.sourceDirectory || profile.outputDirectory),
|
|
458
529
|
...(profile.screenshotOnly ? [] : [path.join(inFrameDirectory, profile.outputDirectory)]),
|
|
459
530
|
])))];
|
|
460
531
|
}
|
|
@@ -484,7 +555,7 @@ function getUniqueFileName(prefix, selectedProfiles) {
|
|
|
484
555
|
|
|
485
556
|
while (selectedProfiles.some((profile) => {
|
|
486
557
|
const profileFileName = getProfileScreenshotFileName(fileName, profile);
|
|
487
|
-
return fs.existsSync(path.join(screenshotDirectory, profile.outputDirectory, profileFileName))
|
|
558
|
+
return fs.existsSync(path.join(screenshotDirectory, profile.sourceDirectory || profile.outputDirectory, profileFileName))
|
|
488
559
|
|| (!profile.screenshotOnly && fs.existsSync(path.join(inFrameDirectory, profile.outputDirectory, profileFileName)));
|
|
489
560
|
})) {
|
|
490
561
|
fileName = `${prefix}-${duplicateNumber}.${extension}`;
|
|
@@ -645,6 +716,7 @@ function printHelp() {
|
|
|
645
716
|
console.log(' node take-screen-image.js --prefix home --profiles android-phone');
|
|
646
717
|
console.log(' node take-screen-image.js --frame-existing');
|
|
647
718
|
console.log(' node take-screen-image.js --reframe-existing --profiles android-phone');
|
|
719
|
+
console.log(' node take-screen-image.js --reframe-existing --profiles ru-store-phone,ru-store-tablet,ru-store-tv');
|
|
648
720
|
console.log(' node take-screen-image.js --reframe-existing --screenshots 1,2');
|
|
649
721
|
console.log(' node take-screen-image.js --refresh-info 1');
|
|
650
722
|
console.log(' node take-screen-image.js --vivo-existing');
|
|
@@ -817,6 +889,17 @@ function removeScreenshotRecords(names) {
|
|
|
817
889
|
removedNames.push(name);
|
|
818
890
|
}
|
|
819
891
|
|
|
892
|
+
if (filePath === screenshotCopyPath) {
|
|
893
|
+
for (const localized of Object.values(source.localizations || {})) {
|
|
894
|
+
for (const name of names) {
|
|
895
|
+
if (localized.screenshots && Object.hasOwn(localized.screenshots, name)) {
|
|
896
|
+
delete localized.screenshots[name];
|
|
897
|
+
if (!removedNames.includes(name)) removedNames.push(name);
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
|
|
820
903
|
if (!removedNames.length) continue;
|
|
821
904
|
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
822
905
|
fs.writeFileSync(filePath, `${JSON.stringify({ ...source, screenshots }, null, 2)}\n`);
|
|
@@ -858,6 +941,11 @@ function reconcileScreenshotRecords() {
|
|
|
858
941
|
? source.screenshots
|
|
859
942
|
: {};
|
|
860
943
|
Object.keys(screenshots).forEach((name) => configuredNames.add(name));
|
|
944
|
+
if (filePath === screenshotCopyPath) {
|
|
945
|
+
for (const localized of Object.values(source.localizations || {})) {
|
|
946
|
+
Object.keys(localized.screenshots || {}).forEach((name) => configuredNames.add(name));
|
|
947
|
+
}
|
|
948
|
+
}
|
|
861
949
|
}
|
|
862
950
|
|
|
863
951
|
const staleNames = new Set(
|
|
@@ -1902,10 +1990,12 @@ async function getScreenshotBarStyle(screenshotBuffer, edge = 'top') {
|
|
|
1902
1990
|
};
|
|
1903
1991
|
}
|
|
1904
1992
|
|
|
1905
|
-
function getScreenshotCopy(screenshotFileName) {
|
|
1993
|
+
function getScreenshotCopy(screenshotFileName, profile = {}) {
|
|
1906
1994
|
screenshotCopyConfig ||= readJsonAssetSource(screenshotCopyPath);
|
|
1907
1995
|
const screenshotKey = path.parse(screenshotFileName).name;
|
|
1908
|
-
const configuredCopy =
|
|
1996
|
+
const configuredCopy = profile.copyLocale
|
|
1997
|
+
? screenshotCopyConfig.localizations?.[profile.copyLocale]?.screenshots?.[screenshotKey]
|
|
1998
|
+
: screenshotCopyConfig.screenshots?.[screenshotKey];
|
|
1909
1999
|
|
|
1910
2000
|
if (!configuredCopy || typeof configuredCopy !== 'object') return null;
|
|
1911
2001
|
|
|
@@ -3512,7 +3602,7 @@ async function captureFramedScreenshot(
|
|
|
3512
3602
|
const navigationBarStyle = statusBarPlatform
|
|
3513
3603
|
? await getScreenshotBarStyle(screenshotBuffer, 'bottom')
|
|
3514
3604
|
: null;
|
|
3515
|
-
const screenshotCopy = getScreenshotCopy(screenshotFileName);
|
|
3605
|
+
const screenshotCopy = getScreenshotCopy(screenshotFileName, profile);
|
|
3516
3606
|
const promotionalPalette = await getPromotionalPalette(screenshotBuffer, screenshotFileName);
|
|
3517
3607
|
const screenshotKey = path.parse(screenshotFileName).name;
|
|
3518
3608
|
|
|
@@ -3520,7 +3610,7 @@ async function captureFramedScreenshot(
|
|
|
3520
3610
|
missingScreenshotCopyWarnings.add(screenshotKey);
|
|
3521
3611
|
console.warn(
|
|
3522
3612
|
`No promotional copy configured for screenshot ${screenshotKey}; `
|
|
3523
|
-
+ `add it to ${screenshotCopyPath}.`,
|
|
3613
|
+
+ `add it to ${screenshotCopyPath}${profile.copyLocale ? ` (localizations.${profile.copyLocale})` : ''}.`,
|
|
3524
3614
|
);
|
|
3525
3615
|
}
|
|
3526
3616
|
|
|
@@ -3650,6 +3740,15 @@ function validateStoreImage(profile, width, height, imageBuffer) {
|
|
|
3650
3740
|
}
|
|
3651
3741
|
|
|
3652
3742
|
async function captureProfile(client, snapshot, profile, screenshotFileName) {
|
|
3743
|
+
if (profile.sourceDirectory) {
|
|
3744
|
+
const sourceFileName = getProfileScreenshotFileName(screenshotFileName, profile);
|
|
3745
|
+
const sourcePath = path.join(screenshotDirectory, profile.sourceDirectory, sourceFileName);
|
|
3746
|
+
if (!fs.existsSync(sourcePath)) {
|
|
3747
|
+
throw new Error(`Capture ${profile.sourceDirectory} before ${profile.label}: ${sourcePath}`);
|
|
3748
|
+
}
|
|
3749
|
+
await captureFramedScreenshot(client, fs.readFileSync(sourcePath), profile, sourceFileName);
|
|
3750
|
+
return;
|
|
3751
|
+
}
|
|
3653
3752
|
await client.send('Emulation.setDeviceMetricsOverride', {
|
|
3654
3753
|
width: profile.width,
|
|
3655
3754
|
height: profile.height,
|
|
@@ -3771,7 +3870,7 @@ async function frameExistingScreenshots(
|
|
|
3771
3870
|
replayClient = await createReplayPage(replayBrowser);
|
|
3772
3871
|
|
|
3773
3872
|
for (const profile of selectedProfiles) {
|
|
3774
|
-
const profileDirectory = path.join(screenshotDirectory, profile.outputDirectory);
|
|
3873
|
+
const profileDirectory = path.join(screenshotDirectory, profile.sourceDirectory || profile.outputDirectory);
|
|
3775
3874
|
|
|
3776
3875
|
if (!fs.existsSync(profileDirectory)) {
|
|
3777
3876
|
continue;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Capacitor 8 to 9 migration playbook
|
|
2
|
+
|
|
3
|
+
Use this checklist separately for each app. Installing `codeplay-common` only installs build helpers, this guide, and a version-specific patch catalog. A Markdown file cannot execute a migration. The developer or coding agent must follow the steps below, review every native diff, and test each app. Do not copy this app's package IDs, store IDs, native customizations, plugin list, or SDK choices into another app without inspecting it first. Source: https://capacitorjs.com/docs/updating/9-0
|
|
4
|
+
|
|
5
|
+
## Shared alpha package and patch preparation
|
|
6
|
+
|
|
7
|
+
1. Install `codeplay-common@alpha` in a disposable branch or test copy. The alpha installer copies this guide into `AGENTS/` only when the file is absent, and preserves an existing app guide. It does **not** run `cap migrate`, edit app native templates, select patches, or build an app automatically. Pin the tested alpha version for each app instead of using a floating range in production.
|
|
8
|
+
2. After updating the app's dependencies and running `npm install`, inspect exact installed versions with `npm ls --depth=0`. Run `node node_modules/codeplay-common/scripts/prepare-capacitor-9.cjs` for a read-only patch selection and legacy native-writer report. The catalog does not apply to absent plugins or different versions. Resolve reported writer call sites before sync/build.
|
|
9
|
+
3. If the selection is correct, install `patch-package` in the app, then run `node node_modules/codeplay-common/scripts/prepare-capacitor-9.cjs --apply`. This copies only exact-version patches to `patches/active/` and adds its command to an existing `postinstall` without deleting that script. Run the postinstall command and check `git diff`; keep app-specific patches that differ from the shared catalog under app ownership. Inspect newer plugin releases before carrying a patch forward. A lower `capacitor-admob-nextgen` version must be upgraded to **1.6.0** before selecting its compatibility patch.
|
|
10
|
+
4. For this Maths app, the existing AdMob patch additionally contains later banner layout fixes. The shared alpha catalog intentionally contains only the two-line Capacitor 9 `hasOption()` API fix. Do not replace this app's active AdMob patch with the shared one.
|
|
11
|
+
|
|
12
|
+
## Preparation
|
|
13
|
+
|
|
14
|
+
1. Read that app's `AGENTS.md` and linked instructions. Record its clean Git status, Node version, Java version, Android SDK path, Gradle/AGP versions, iOS deployment target, and installed Capacitor and Cordova plugins.
|
|
15
|
+
2. Search build, install, and sync scripts for writes to `android/`, `ios/`, and `node_modules/`. Classify each write as app-owned configuration, generated native integration, or a workaround for an older Capacitor version. Preserve app-owned behavior; remove obsolete core/native workarounds. Search every call site before deleting a script.
|
|
16
|
+
3. Record the intended ADB serial and use `adb -s <serial>` for **every** ADB operation. Never use unqualified `adb`, `cap run`, or an install script that chooses a device implicitly when another device is connected.
|
|
17
|
+
4. Keep temporary downloads, build logs, screenshots, and APK copies under `agent-temp/`. Follow that app's native-file authorization rule. Do not edit generated web output by hand.
|
|
18
|
+
|
|
19
|
+
## Upgrade and native sync
|
|
20
|
+
|
|
21
|
+
1. Use Node 24 or later and Java 21. Upgrade `@capacitor/cli`, `core`, `android`, `ios`, and every official `@capacitor/*` plugin to major 9. Check every community plugin's peer range and native Gradle/Swift compatibility; an npm install succeeding is insufficient. Keep the app's lockfile in sync.
|
|
22
|
+
2. Run `npx cap migrate` and read every warning. Review its diff before accepting generated changes. Then run `npx cap sync android` and `npx cap sync ios` after the plugin set is final.
|
|
23
|
+
3. Android: use the Gradle and AGP versions required by the current Capacitor guide, install the matching compile SDK/build tools, set the guide's minimum and target SDKs, and check `android/variables.gradle`, root/app Gradle files, wrapper files, and `gradle.properties`. Remove old direct Cordova module wiring from `settings.gradle` and `app/build.gradle`; Capacitor 9 generates conditional wiring in `capacitor.settings.gradle` and `app/capacitor.build.gradle`. Keep actual Cordova plugins and store-specific billing/ads exclusions.
|
|
24
|
+
4. Check old plugin Gradle files for unsupported `proguard-android.txt`, standalone Kotlin plugin, old `core-ktx`, `jcenter()`, and removed Capacitor APIs. Prefer a compatible plugin release. If none exists and the plugin is used, carry a narrow, reproducible dependency patch with its reason documented. Reapply and verify it after a clean install.
|
|
25
|
+
5. Compare `MainActivity` with the installed Capacitor 9 template and remove obsolete app-specific Java behavior. Search `postinstall`, `capacitor:sync:*`, before-build scripts, and Gradle hooks for old `setSplashAnimation.js`, `add-splash-screen.js`, `splash-setup.cjs`, `BridgeWebViewClient.java`, and `SystemBars.java` writers. Remove or disable their callers so the next install/build/sync does not restore obsolete code. Keep the native launch splash from the Capacitor 9 template unless that app explicitly needs custom behavior. Confirm edge-to-edge and `SystemBars.insetsHandling` together on device. Keep app-owned manifest, notification icon, resource, R8, store, TV, and baseline-profile modifications; update their integration for AGP 9. A baseline-profile Gradle plugin at 1.5.0 or later is needed for this app's AGP 9 build.
|
|
26
|
+
6. iOS: set deployment target 16.0, use Xcode 27 or later, migrate to SwiftUI `App.swift`/`CapacitorView.swift`, adapt `AppDelegate`, empty the old `SceneDelegate` window/URL code, remove `Main.storyboard`, and check Xcode target file references and `Info.plist`. Confirm URL, universal-link, notification, ad consent, orientation, and custom plugin behavior on an iOS device. Windows cannot complete this validation.
|
|
27
|
+
|
|
28
|
+
## Validation and handoff
|
|
29
|
+
|
|
30
|
+
1. Run `npm ls --depth=0`, JavaScript syntax checks, `git diff --check`, and an Android Gradle build. Check warnings and errors from every plugin module. Verify a web build using the relevant store mode without hand-editing `www`.
|
|
31
|
+
2. Inspect merged manifests and packaged assets/classes for each store variant whose billing or ads are excluded. Check that the package ID and signing key match the installed app before upgrading it; preserve app data when possible.
|
|
32
|
+
3. Install only with `adb -s <serial> install -r <apk>`. Confirm startup, native bridge, splash, status/navigation bars and both landscape edges, keyboard, notifications, purchases, ads, and relevant plugin flows. Record any unavailable device or platform checks explicitly.
|
|
33
|
+
4. Before building a Play internal-test AAB, increase the app's `versionCode` beyond every version already uploaded to Play and advance `versionName` using that app's version scheme. Sign with its existing Play upload key; verify the AAB manifest's actual version values, packaged web/Cordova assets, and signing certificate before handing it off. Do not reuse a prior Play build code for a revised migration test.
|
|
34
|
+
5. Save concise durable validation results under `AI-Logs/` and update `Version-history.md` under Unreleased. Do not declare iOS complete until an Xcode build and device check pass.
|
|
35
|
+
|
|
36
|
+
## Findings from this app
|
|
37
|
+
|
|
38
|
+
- Capacitor 9's Cordova wiring is conditional. This app still uses Cordova plugins, so its generated files include that runtime.
|
|
39
|
+
- `@capacitor-community/in-app-review` 8.0.0 has no major-9 release and uses the removed default ProGuard file. `patches/active/@capacitor-community+in-app-review+8.0.0.patch` changes that single Gradle call and `postinstall` reapplies it.
|
|
40
|
+
- For `capacitor-admob-nextgen`, update older installations to 1.6.0 before applying the single `patches/active/capacitor-admob-nextgen+1.6.0.patch`. Version 1.6.0 calls the removed `PluginCall.hasOption()` API; the patch uses `call.getData().has()` for the two optional privacy flags. Recheck whether an upstream release fixes this before patching a newer version.
|
|
41
|
+
- `patches/catalog/` holds version-specific patches for other apps. Select only patches matching an app's installed versions; see `patches/README.md`. The catalog patches passed isolated Capacitor 9 Android debug/release Java compilation but still require each app's native release and runtime checks. Update the owned RuStore ads package upstream instead of copying a patch.
|
|
42
|
+
- The former `setSplashAnimation.js` sync hook replaced all of `MainActivity`; removing every caller avoids restoring Capacitor 8-era native code.
|
|
43
|
+
- This app's `MainActivity.java` matches the Capacitor 9 Android template exactly except for `package maths.formulas;`. Its old custom splash exit animation was removed.
|
|
44
|
+
- The default Capacitor 9 `AppTheme.NoActionBarLaunch`, `styles.xml`, splash.png assets, and Gradle wrapper properties were restored. The custom `Theme.Codeplay.SplashScreen`, its sync script, the manual startup hide timer, and `launchShowDuration: 0` were removed so the stock launch splash can be evaluated. `splash_icon.png` is retained only for LocalNotifications.largeIcon. The TV banner, launcher resources, app identity, plugin-generated Gradle files, and notification assets remain app-specific. Baseline-profile, R8, and store build rules are deliberate exceptions to the template at the user's request.
|
|
45
|
+
- When using a temporary Vite output directory for a test APK, route it through `npx cap copy android` so Cordova's JavaScript runtime and plugin files are generated. Directly copying Vite output into native assets omits those files. Restore the source `webDir` and native generated assets after the APK is built.
|
|
46
|
+
- This app's pre-Android-15 custom inset listener was removed after migration. Capacitor 9 `SystemBars.insetsHandling=css` now provides the inset values, and `src/assets/css/app.less` maps them to the existing layout variables. Keep this mapping when migrating related layouts; test older Android versions separately.
|
|
47
|
+
- Play Console can still show its edge-to-edge recommendation for an optimized release even when the Capacitor 9 template calls `EdgeToEdge.enable(this)`: R8 may inline that call into `MainActivity.onCreate`. Check the release mapping before changing UI code. In this app, a narrow `-keep` rule for `androidx.activity.EdgeToEdge.enable(ComponentActivity)` retained the entry point in release code; the later production 8.1 (89) dashboard screenshot no longer showed those recommendations. This is an observed result, not proof that every device or later dependency build will pass. Do not add the rule to other apps without checking their own release mapping and Play result.
|
|
48
|
+
- Play's deprecated edge-to-edge API warning for version 88 points mainly to AndroidX Activity/Core compatibility code. `WindowCompat.enableEdgeToEdge()` in AndroidX Core 1.19.1 still calls `setStatusBarColor` and `setNavigationBarColor`, so swapping the entry point does not remove that warning. Preserve working Android 14+ insets and bar contrast while assessing future AndroidX updates.
|
|
49
|
+
- If Java's Gradle wrapper download times out, download the specified Gradle distribution with an available HTTP client and regenerate the wrapper from that distribution. Keep the chosen Gradle version aligned with AGP.
|
|
@@ -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 {
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeplay-common",
|
|
3
|
-
"version": "4.11.
|
|
3
|
+
"version": "4.11.41-alpha.0",
|
|
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",
|
|
@@ -13,7 +14,7 @@
|
|
|
13
14
|
},
|
|
14
15
|
"repository": {
|
|
15
16
|
"type": "git",
|
|
16
|
-
"url": "https://github.com/merbin2012/codeplay-common.git"
|
|
17
|
+
"url": "git+https://github.com/merbin2012/codeplay-common.git"
|
|
17
18
|
},
|
|
18
19
|
"author": "Codeplay Technologies",
|
|
19
20
|
"license": "MIT",
|
|
@@ -24,6 +25,7 @@
|
|
|
24
25
|
"CHANGELOG.md",
|
|
25
26
|
"RELEASE_NOTES.md",
|
|
26
27
|
"LICENSE",
|
|
27
|
-
"runtime/"
|
|
28
|
+
"runtime/",
|
|
29
|
+
"migration/"
|
|
28
30
|
]
|
|
29
31
|
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
function prepare(root, apply = false) {
|
|
5
|
+
const packageFile = path.join(root, 'package.json');
|
|
6
|
+
const pkg = JSON.parse(fs.readFileSync(packageFile, 'utf8'));
|
|
7
|
+
const coreFile = path.join(root, 'node_modules/@capacitor/core/package.json');
|
|
8
|
+
const coreVersion = fs.existsSync(coreFile) ? JSON.parse(fs.readFileSync(coreFile, 'utf8')).version : null;
|
|
9
|
+
if (apply && !coreVersion?.startsWith('9.')) throw new Error('Apply patches only after installing Capacitor 9 in this app.');
|
|
10
|
+
const catalog = path.resolve(__dirname, '../migration/patches');
|
|
11
|
+
const active = path.join(root, 'patches/active');
|
|
12
|
+
const selected = [];
|
|
13
|
+
const review = [];
|
|
14
|
+
if (!coreVersion?.startsWith('9.')) review.push(`Capacitor core ${coreVersion || 'not installed'}; upgrade before applying or building.`);
|
|
15
|
+
const nativeWriters = /(?:setSplashAnimation|add-splash-screen|splash-setup)\.\w+|BridgeWebViewClient\.java|plugin\/SystemBars\.java/;
|
|
16
|
+
for (const [key, command] of Object.entries(pkg.scripts || {})) {
|
|
17
|
+
if (nativeWriters.test(command)) review.push(`package.json script ${key} still invokes a legacy native writer: ${command}`);
|
|
18
|
+
}
|
|
19
|
+
for (const file of [
|
|
20
|
+
'scripts-common/run-codeplay-sync-after.js',
|
|
21
|
+
'buildCodeplay/codeplayBeforeBuild.js',
|
|
22
|
+
]) {
|
|
23
|
+
const target = path.join(root, file);
|
|
24
|
+
if (fs.existsSync(target) && nativeWriters.test(fs.readFileSync(target, 'utf8'))) {
|
|
25
|
+
review.push(`${file} mentions a legacy native writer; inspect its active call sites.`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
for (const name of fs.readdirSync(catalog).filter(name => name.endsWith('.patch'))) {
|
|
29
|
+
const match = name.match(/^(.*)\+([^+]+)\.patch$/);
|
|
30
|
+
if (!match) throw new Error(`Invalid patch name: ${name}`);
|
|
31
|
+
const [, encodedDependency, version] = match;
|
|
32
|
+
const dependency = encodedDependency.startsWith('@') ? encodedDependency.replace('+', '/') : encodedDependency;
|
|
33
|
+
const installed = path.join(root, 'node_modules', dependency, 'package.json');
|
|
34
|
+
if (!fs.existsSync(installed)) continue;
|
|
35
|
+
const actual = JSON.parse(fs.readFileSync(installed, 'utf8')).version;
|
|
36
|
+
if (actual !== version) {
|
|
37
|
+
review.push(`${dependency}: installed ${actual}; catalog patch ${version}. Check upstream before changing versions.`);
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
selected.push(name);
|
|
41
|
+
}
|
|
42
|
+
if (apply) {
|
|
43
|
+
if (!fs.existsSync(path.join(root, 'node_modules/patch-package/package.json'))) {
|
|
44
|
+
throw new Error('Install patch-package in this app before --apply.');
|
|
45
|
+
}
|
|
46
|
+
const existing = fs.existsSync(active) ? fs.readdirSync(active) : [];
|
|
47
|
+
for (const name of selected) {
|
|
48
|
+
const target = path.join(active, name);
|
|
49
|
+
const source = path.join(catalog, name);
|
|
50
|
+
const related = existing.filter(file => file !== name && file.startsWith(name.replace(/\+[^+]+\.patch$/, '+')) && file.endsWith('.patch'));
|
|
51
|
+
if (related.length) throw new Error(`Conflicting active patch for ${name}: ${related.join(', ')}`);
|
|
52
|
+
if (fs.existsSync(target) && !fs.readFileSync(target).equals(fs.readFileSync(source))) {
|
|
53
|
+
throw new Error(`Existing app patch differs; preserved ${target}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
fs.mkdirSync(active, { recursive: true });
|
|
57
|
+
for (const name of selected) {
|
|
58
|
+
const target = path.join(active, name);
|
|
59
|
+
if (!fs.existsSync(target)) fs.copyFileSync(path.join(catalog, name), target);
|
|
60
|
+
}
|
|
61
|
+
if (selected.length) {
|
|
62
|
+
const command = 'patch-package --patch-dir patches/active --error-on-fail';
|
|
63
|
+
if (!pkg.scripts) pkg.scripts = {};
|
|
64
|
+
if (!pkg.scripts.postinstall) pkg.scripts.postinstall = command;
|
|
65
|
+
else if (!pkg.scripts.postinstall.includes(command)) pkg.scripts.postinstall += ` && ${command}`;
|
|
66
|
+
fs.writeFileSync(packageFile, JSON.stringify(pkg, null, 2) + '\n');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return { selected, review, apply };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (require.main === module) {
|
|
73
|
+
try {
|
|
74
|
+
const root = process.cwd();
|
|
75
|
+
const result = prepare(root, process.argv.includes('--apply'));
|
|
76
|
+
console.log(`${result.apply ? 'Prepared' : 'Would prepare'} ${result.selected.length} version-matched patches: ${result.selected.join(', ') || 'none'}`);
|
|
77
|
+
for (const item of result.review) console.warn(`Review: ${item}`);
|
|
78
|
+
if (result.apply) console.log('Run npm install (or npx patch-package --patch-dir patches/active --error-on-fail) and verify the native builds.');
|
|
79
|
+
} catch (error) { console.error(error.message); process.exitCode = 1; }
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
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,6 +89,7 @@ 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
|
}
|
|
@@ -97,7 +100,12 @@ function install(options = {}) {
|
|
|
97
100
|
fs.cpSync(path.join(commonFiles, name), path.join(projectRoot, name), { recursive: true });
|
|
98
101
|
}
|
|
99
102
|
}
|
|
100
|
-
|
|
103
|
+
const guide = path.join(projectRoot, 'AGENTS', 'capacitor-8-to-9-migration.md');
|
|
104
|
+
if (!fs.existsSync(guide)) {
|
|
105
|
+
fs.mkdirSync(path.dirname(guide), { recursive: true });
|
|
106
|
+
fs.copyFileSync(path.resolve(__dirname, '../migration/capacitor-8-to-9-migration.md'), guide);
|
|
107
|
+
}
|
|
108
|
+
if (!capacitor9) require('../files/buildCodeplay/splash-setup.cjs').syncSplashSetup(projectRoot);
|
|
101
109
|
require('../files/buildCodeplay/setup-ruads.cjs').syncRuAdsSetup(projectRoot, {
|
|
102
110
|
runtimeRoot: path.resolve(__dirname, '../runtime/vk-ads'),
|
|
103
111
|
});
|