codeplay-common 4.11.3 → 4.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,77 +1,90 @@
1
1
  # Changelog
2
2
 
3
- ## 4.10.5 — 2026-10-23
4
-
5
- Version name: 4.10.5. Version code/build number: not applicable to this npm package.
6
-
7
- Files changed: `package.json`, `scripts/sync-files.js`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
8
-
9
- - Migrate known legacy filename lookups in an existing app configurator after installing shared scripts.
10
- - Prefer unversioned pre-build and package-ID helpers while retaining the versioned fallback.
11
- - Correct the known old sync-hook folder assignment without replacing app-specific configuration or adding a configurator to apps that do not have one.
12
-
13
- ## 4.10.4 — 2026-10-23
14
-
15
- Version name: 4.10.4. Version code/build number: not applicable to this npm package.
16
-
17
- Files changed: `package.json`, `files/scripts-common/run-codeplay-sync-after.js`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
18
-
19
- - Ship an updated sync-after hook for apps retaining the custom hook command after script migration.
20
- - Run unversioned splash helpers instead of searching for removed versioned filenames.
21
- - Resolve baseline profile setup from `scripts-common/` and preserve the existing native splash when no splash icon is configured.
22
-
23
- ## 4.10.3 — 2026-10-23
24
-
25
- Version name: 4.10.3. Version code/build number: not applicable to this npm package.
26
-
27
- Files changed: `package.json`, `files/finalrelease`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
28
-
29
- - Allow ad-free apps with `plugins.AdMob.ADMOB_ENABLED: false` to pass release validation without an AdMob alias or controller.
30
- - Continue requiring a production AdMob alias when advertising is enabled or the enabled flag is unspecified.
31
- - Preserve rejection of test aliases, commented or duplicate aliases, and missing production controllers for apps with ads enabled.
32
-
33
- ## 4.10.0 — 2026-10-23
34
-
35
- Version name: 4.10.0. Version code/build number: not applicable to this npm package.
36
- Bundled pre-build script: 6.7.
37
-
38
- Files changed: `package.json`, `files/buildCodeplay/project-scripts.cjs`, `scripts/sync-files.js`, `scripts/uninstall.js`, `files/finalrelease`, `files/buildCodeplay/`, `files/scripts-common/`, `files/take-screen-image.js`, `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
39
-
40
- - Copy shared build scripts and the versions manifest into each app; run local scripts with unversioned filenames.
41
- - Rename app helper scripts to scripts-common automatically, migrate command paths, and preserve existing files without overwriting folder conflicts.
42
- - Migrate app build/store/sync paths automatically and remove only superseded versioned helpers; preserve app-owned configuration and screenshot data.
43
- - Resolve app sources/native targets from the consuming app directory while keeping bundled assets inside the plugin.
44
- - Download IAP and AdMob directly from htmlcodeplay.com, without bundling archives or adding a separate fallback.
45
- - Automatically migrate deferred ownership verification, purchase-safe advertising, and Home Pro visibility according to each store IAP flag.
46
- - Copy the full finalrelease implementation so it can be tested from the application folder.
47
- - Preserve working files during preinstall and avoid downgrading local/newer plugin installations to an older registry release.
48
-
49
- ## 4.9.8 — 2026-10-22
50
-
51
- Version name: 4.9.8. Version code/build number: not applicable to this npm package.
52
- Bundled pre-build script: 6.5.
53
-
54
- Files changed: `package.json`, `scripts/sync-files.js`, `files/buildCodeplay/codeplayBeforeBuild-6.5.js`, `files/buildCodeplay/sync-admob-nextgen.js`, `files/buildCodeplay/versions.json`, `files/finalrelease`, `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
55
-
56
- - Install AdMob as `src/js/Ads/admob-nextgen-4.0/` with stable `admob-emi-nextgen.js` and `app-open-state.js` filenames.
57
- - Automatically migrate loose-file references, folder references and Vite aliases during installation and before builds.
58
- - Preserve app-owned ad configuration and select each app's existing IAP analytics module.
59
- - Download every AdMob folder ZIP from htmlcodeplay.com; no AdMob archive is included in this npm package.
60
- - Validate ZIP contents before switching imports; retain the working package when a remote update fails.
61
- - Validate the selected folder controller during final-release checks while continuing to reject test aliases.
62
-
63
- ## 4.7.7 — 2026-10-07
64
-
65
- Version name: 4.7.7. Version code/build number: not applicable to this npm package.
66
- Bundled pre-build script: 6.4.
67
-
68
- Files changed: `package.json`, `scripts/sync-files.js`, `files/buildCodeplay/codeplayBeforeBuild-6.4.js`
69
- (replaces `codeplayBeforeBuild-6.3.js`), `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
70
-
71
- - Keep `npm run build` as the Android default on every host; add `npm run build:ios` automatically during installation.
72
- - Route `build-capacitor-android` through the same pre-build validation before copying the web build.
73
- - Migrate direct save-gallery imports to `@saveGallery` and select the matching platform helper in Vite after one detailed Enter/y confirmation.
74
- - Stop without import writes on cancellation, missing helpers, mixed versions, unsupported query/hash aliases or concurrent source edits.
75
- - Reuse source directory traversal and combine gallery, retired OneSignal import, StatusBar and editor checks in one content pass.
76
- - Automatically remove an installed/declared `onesignal-cordova-plugin` with a warning; skip legacy OneSignal patching/helper downloads and stop on remaining package imports.
77
- - Keep `agent-temp/` ignored and remove existing `buildCodeplay/` ignore entries without adding them in future projects.
3
+ ## 4.11.4 — 2026-10-27
4
+
5
+ Version name: 4.11.4. Version code/build number: not applicable to this npm package.
6
+
7
+ Files changed: `package.json`, `scripts/sync-files.js`, `files/buildCodeplay/fix-optimize-builld/android-r8-rules.cjs`, `files/buildCodeplay/fix-optimize-builld/ffmpeg-jni-rules.cjs`, `files/buildCodeplay/fix-optimize-builld/restore-android-r8-rules.cjs`, `files/buildCodeplay/fix-optimize-builld/fix-optimize-build.gradle`, `files/buildCodeplay/codeplayBeforeBuild.js`, `files/buildCodeplay/manifestModification.js`, `files/buildCodeplay/project-scripts.cjs`, `files/finalrelease`, `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
8
+
9
+ - Preserve Capacitor permission annotations in every consuming Android app, without an app ID or permission-use restriction.
10
+ - Restore the scoped ProGuard rules during installation, Android sync and every Gradle build through a regenerated apply-from hook; keep existing custom rules and avoid duplicates.
11
+ - Ship the helper inside `buildCodeplay` so shared templates do not depend on an app-specific `Scripts` file.
12
+ - Provide `npm run android:r8-rules` and migrate the known previous helper command while preserving custom commands.
13
+ - Keep permission declarations, prompts, minification settings and iOS configuration unchanged; already-distributed binaries require rebuilding.
14
+ - Preserve explicit release minification settings when distributing shared templates, and retain the tested FFmpeg JNI rules when that plugin is installed.
15
+
16
+ ## 4.10.5 — 2026-10-23
17
+
18
+ Version name: 4.10.5. Version code/build number: not applicable to this npm package.
19
+
20
+ Files changed: `package.json`, `scripts/sync-files.js`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
21
+
22
+ - Migrate known legacy filename lookups in an existing app configurator after installing shared scripts.
23
+ - Prefer unversioned pre-build and package-ID helpers while retaining the versioned fallback.
24
+ - Correct the known old sync-hook folder assignment without replacing app-specific configuration or adding a configurator to apps that do not have one.
25
+
26
+ ## 4.10.4 — 2026-10-23
27
+
28
+ Version name: 4.10.4. Version code/build number: not applicable to this npm package.
29
+
30
+ Files changed: `package.json`, `files/scripts-common/run-codeplay-sync-after.js`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
31
+
32
+ - Ship an updated sync-after hook for apps retaining the custom hook command after script migration.
33
+ - Run unversioned splash helpers instead of searching for removed versioned filenames.
34
+ - Resolve baseline profile setup from `scripts-common/` and preserve the existing native splash when no splash icon is configured.
35
+
36
+ ## 4.10.3 — 2026-10-23
37
+
38
+ Version name: 4.10.3. Version code/build number: not applicable to this npm package.
39
+
40
+ Files changed: `package.json`, `files/finalrelease`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
41
+
42
+ - Allow ad-free apps with `plugins.AdMob.ADMOB_ENABLED: false` to pass release validation without an AdMob alias or controller.
43
+ - Continue requiring a production AdMob alias when advertising is enabled or the enabled flag is unspecified.
44
+ - Preserve rejection of test aliases, commented or duplicate aliases, and missing production controllers for apps with ads enabled.
45
+
46
+ ## 4.10.0 — 2026-10-23
47
+
48
+ Version name: 4.10.0. Version code/build number: not applicable to this npm package.
49
+ Bundled pre-build script: 6.7.
50
+
51
+ Files changed: `package.json`, `files/buildCodeplay/project-scripts.cjs`, `scripts/sync-files.js`, `scripts/uninstall.js`, `files/finalrelease`, `files/buildCodeplay/`, `files/scripts-common/`, `files/take-screen-image.js`, `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
52
+
53
+ - Copy shared build scripts and the versions manifest into each app; run local scripts with unversioned filenames.
54
+ - Rename app helper scripts to scripts-common automatically, migrate command paths, and preserve existing files without overwriting folder conflicts.
55
+ - Migrate app build/store/sync paths automatically and remove only superseded versioned helpers; preserve app-owned configuration and screenshot data.
56
+ - Resolve app sources/native targets from the consuming app directory while keeping bundled assets inside the plugin.
57
+ - Download IAP and AdMob directly from htmlcodeplay.com, without bundling archives or adding a separate fallback.
58
+ - Automatically migrate deferred ownership verification, purchase-safe advertising, and Home Pro visibility according to each store IAP flag.
59
+ - Copy the full finalrelease implementation so it can be tested from the application folder.
60
+ - Preserve working files during preinstall and avoid downgrading local/newer plugin installations to an older registry release.
61
+
62
+ ## 4.9.8 — 2026-10-22
63
+
64
+ Version name: 4.9.8. Version code/build number: not applicable to this npm package.
65
+ Bundled pre-build script: 6.5.
66
+
67
+ Files changed: `package.json`, `scripts/sync-files.js`, `files/buildCodeplay/codeplayBeforeBuild-6.5.js`, `files/buildCodeplay/sync-admob-nextgen.js`, `files/buildCodeplay/versions.json`, `files/finalrelease`, `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
68
+
69
+ - Install AdMob as `src/js/Ads/admob-nextgen-4.0/` with stable `admob-emi-nextgen.js` and `app-open-state.js` filenames.
70
+ - Automatically migrate loose-file references, folder references and Vite aliases during installation and before builds.
71
+ - Preserve app-owned ad configuration and select each app's existing IAP analytics module.
72
+ - Download every AdMob folder ZIP from htmlcodeplay.com; no AdMob archive is included in this npm package.
73
+ - Validate ZIP contents before switching imports; retain the working package when a remote update fails.
74
+ - Validate the selected folder controller during final-release checks while continuing to reject test aliases.
75
+
76
+ ## 4.7.7 — 2026-10-07
77
+
78
+ Version name: 4.7.7. Version code/build number: not applicable to this npm package.
79
+ Bundled pre-build script: 6.4.
80
+
81
+ Files changed: `package.json`, `scripts/sync-files.js`, `files/buildCodeplay/codeplayBeforeBuild-6.4.js`
82
+ (replaces `codeplayBeforeBuild-6.3.js`), `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
83
+
84
+ - Keep `npm run build` as the Android default on every host; add `npm run build:ios` automatically during installation.
85
+ - Route `build-capacitor-android` through the same pre-build validation before copying the web build.
86
+ - Migrate direct save-gallery imports to `@saveGallery` and select the matching platform helper in Vite after one detailed Enter/y confirmation.
87
+ - Stop without import writes on cancellation, missing helpers, mixed versions, unsupported query/hash aliases or concurrent source edits.
88
+ - Reuse source directory traversal and combine gallery, retired OneSignal import, StatusBar and editor checks in one content pass.
89
+ - Automatically remove an installed/declared `onesignal-cordova-plugin` with a warning; skip legacy OneSignal patching/helper downloads and stop on remaining package imports.
90
+ - Keep `agent-temp/` ignored and remove existing `buildCodeplay/` ignore entries without adding them in future projects.
package/README.md CHANGED
@@ -9,6 +9,16 @@ Based on store install various IAP plugins
9
9
  Make it to ionic project
10
10
 
11
11
 
12
+ ## Capacitor Android permission metadata (4.11.4)
13
+
14
+ The package preserves the runtime `CapacitorPlugin` and `Permission` annotation members required by optimized Android builds. This applies to every Android consumer, even if the app does not currently use permission-dependent plugins. It does not declare or grant permissions, show prompts, or enable minification.
15
+
16
+ Installation applies the rules to an existing Android project and installs one `apply from` line in `android/app/build.gradle`. The included Gradle script reruns the repair during every Gradle configuration, including direct Android Studio/Gradle and Capacitor `run --no-sync` builds. All repair logic stays in the shared fix folder. Android sync, build preparation and release preparation restore missing rules after platform regeneration. The generated Gradle hook is restored after platform regeneration. Existing custom ProGuard rules are preserved and repeated runs do not add duplicates. Apps without an Android platform are skipped until that platform exists.
17
+
18
+ All fix implementations ship under `buildCodeplay/fix-optimize-builld/`, including the restore command and its Gradle integration; no app-specific `Scripts` file is required. Run `npm run android:r8-rules` to restore the rules manually. Existing custom npm commands are preserved; the known older `restore-android-r8-rules.cjs` command is migrated automatically.
19
+
20
+ After installing this package update, rebuild and test each app's optimized release. Updating build tooling cannot change APKs or app-store releases already distributed to users.
21
+
12
22
  ## App helper folder
13
23
 
14
24
  Application helper scripts are kept in `scripts-common/`. Installation migrates the old `scripts/` folder and package command paths automatically, preserving every existing file. A conflicting destination file stops migration before any files are moved. The plugin’s internal npm lifecycle folder remains `scripts/`.
@@ -213,3 +223,5 @@ Version : 4.0.0 (Previous version 3.2.19)
213
223
  1) In here we are completly remove the admob-emi and use "capacitor-admob-nextgen"
214
224
  2) Removed "modify-plugin-xml.js"
215
225
  3)
226
+
227
+ The fix preserves the metadata behind the release permission-check failure verified in testing. It does not guarantee every native dialog or plugin: required manifest declarations, Android permission policy, device settings and plugin-specific keep rules still apply.
package/RELEASE_NOTES.md CHANGED
@@ -1,75 +1,88 @@
1
1
  # Release notes
2
2
 
3
- ## 4.10.5 — 2026-10-23
4
-
5
- Version name: 4.10.5. Version code/build number: not applicable to this npm package.
6
-
7
- Files changed: `package.json`, `scripts/sync-files.js`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
8
-
9
- - Prevent app postinstall failures after shared scripts switch to unversioned filenames.
10
- - Repair the known old sync-hook path during plugin installation.
11
- - Preserve each app's custom configuration and leave apps without the affected configurator unchanged.
12
-
13
- ## 4.10.4 — 2026-10-23
14
-
15
- Version name: 4.10.4. Version code/build number: not applicable to this npm package.
16
-
17
- Files changed: `package.json`, `files/scripts-common/run-codeplay-sync-after.js`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
18
-
19
- - Fix Android sync failures caused by the old versioned splash script lookup.
20
- - Use the migrated baseline profile setup path.
21
- - Update the custom sync hook automatically during plugin installation.
22
-
23
- ## 4.10.3 — 2026-10-23
24
-
25
- Version name: 4.10.3. Version code/build number: not applicable to this npm package.
26
-
27
- Files changed: `package.json`, `files/finalrelease`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
28
-
29
- - Release ad-free apps without adding an unnecessary AdMob alias or controller.
30
- - Explicitly set `plugins.AdMob.ADMOB_ENABLED` to `false` to use the ad-free release path.
31
- - Keep production AdMob safety checks for apps with advertising enabled.
32
-
33
- ## 4.10.0 — 2026-10-23
34
-
35
- Version name: 4.10.0. Version code/build number: not applicable to this npm package.
36
- Bundled pre-build script: 6.7.
37
-
38
- Files changed: `package.json`, `files/buildCodeplay/project-scripts.cjs`, `scripts/sync-files.js`, `scripts/uninstall.js`, `files/finalrelease`, `files/buildCodeplay/`, `files/scripts-common/`, `files/take-screen-image.js`, `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
39
-
40
- - Copy shared build scripts and the versions manifest into each app; run local scripts with unversioned filenames.
41
- - Rename app helper scripts to scripts-common automatically, migrate command paths, and preserve existing files without overwriting folder conflicts.
42
- - Migrate app build/store/sync paths automatically and remove only superseded versioned helpers; preserve app-owned configuration and screenshot data.
43
- - Resolve app sources/native targets from the consuming app directory while keeping bundled assets inside the plugin.
44
- - Download IAP and AdMob directly from htmlcodeplay.com, without bundling archives or adding a separate fallback.
45
- - Automatically migrate deferred ownership verification, purchase-safe advertising, and Home Pro visibility according to each store IAP flag.
46
- - Copy the full finalrelease implementation so it can be tested from the application folder.
47
- - Preserve working files during preinstall and avoid downgrading local/newer plugin installations to an older registry release.
48
-
49
- ## 4.9.8 — 2026-10-22
50
-
51
- Version name: 4.9.8. Version code/build number: not applicable to this npm package.
52
- Bundled pre-build script: 6.5.
53
-
54
- Files changed: `package.json`, `scripts/sync-files.js`, `files/buildCodeplay/codeplayBeforeBuild-6.5.js`, `files/buildCodeplay/sync-admob-nextgen.js`, `files/buildCodeplay/versions.json`, `files/finalrelease`, `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
55
-
56
- - Install AdMob as `src/js/Ads/admob-nextgen-4.0/` with stable `admob-emi-nextgen.js` and `app-open-state.js` filenames.
57
- - Automatically migrate loose-file references, folder references and Vite aliases during installation and before builds.
58
- - Preserve app-owned ad configuration and select each app's existing IAP analytics module.
59
- - Download every AdMob folder ZIP from htmlcodeplay.com; no AdMob archive is included in this npm package.
60
- - Validate ZIP contents before switching imports; retain the working package when a remote update fails.
61
- - Validate the selected folder controller during final-release checks while continuing to reject test aliases.
62
-
63
- ## 4.7.7 — 2026-10-07
64
-
65
- Version name: 4.7.7. Version code/build number: not applicable to this npm package.
66
-
67
- Files changed: `package.json`, `scripts/sync-files.js`, `files/buildCodeplay/codeplayBeforeBuild-6.4.js`
68
- (replaces `codeplayBeforeBuild-6.3.js`), `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
69
-
70
- - Installation automatically configures Android and iOS build commands in your app's `package.json`.
71
- - Android builds remain the default; use `npm run build:ios` for iOS.
72
- - Save-gallery imports use one alias with a platform-specific helper and a clear confirmation before source changes.
73
- - Shared checks reuse file traversal to reduce repeated scanning.
74
- - Builds warn and automatically uninstall the retired OneSignal Cordova plugin when found.
75
- - `agent-temp/` stays ignored, while `buildCodeplay/` is removed from ignore rules.
3
+ ## 4.11.4 — 2026-10-27
4
+
5
+ Version name: 4.11.4. Version code/build number: not applicable to this npm package.
6
+
7
+ Files changed: `package.json`, `scripts/sync-files.js`, `files/buildCodeplay/fix-optimize-builld/android-r8-rules.cjs`, `files/buildCodeplay/fix-optimize-builld/ffmpeg-jni-rules.cjs`, `files/buildCodeplay/fix-optimize-builld/restore-android-r8-rules.cjs`, `files/buildCodeplay/fix-optimize-builld/fix-optimize-build.gradle`, `files/buildCodeplay/codeplayBeforeBuild.js`, `files/buildCodeplay/manifestModification.js`, `files/buildCodeplay/project-scripts.cjs`, `files/finalrelease`, `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
8
+
9
+ - Fix missing permission-check results caused by release optimization removing Capacitor metadata.
10
+ - Apply protection to all Android apps using this package, including apps with no permission-dependent features.
11
+ - Restore protection after native platform regeneration and package updates, and check it on every Gradle build without overwriting custom ProGuard rules.
12
+ - Keep the fix self-contained in the shared package and provide a manual restore command.
13
+ - No new permissions or prompts are added. Update the package and rebuild each app to include the correction.
14
+ - Preserve existing release minification choices and protect FFmpeg native entry points in apps using that plugin.
15
+
16
+ ## 4.10.5 — 2026-10-23
17
+
18
+ Version name: 4.10.5. Version code/build number: not applicable to this npm package.
19
+
20
+ Files changed: `package.json`, `scripts/sync-files.js`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
21
+
22
+ - Prevent app postinstall failures after shared scripts switch to unversioned filenames.
23
+ - Repair the known old sync-hook path during plugin installation.
24
+ - Preserve each app's custom configuration and leave apps without the affected configurator unchanged.
25
+
26
+ ## 4.10.4 — 2026-10-23
27
+
28
+ Version name: 4.10.4. Version code/build number: not applicable to this npm package.
29
+
30
+ Files changed: `package.json`, `files/scripts-common/run-codeplay-sync-after.js`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
31
+
32
+ - Fix Android sync failures caused by the old versioned splash script lookup.
33
+ - Use the migrated baseline profile setup path.
34
+ - Update the custom sync hook automatically during plugin installation.
35
+
36
+ ## 4.10.3 — 2026-10-23
37
+
38
+ Version name: 4.10.3. Version code/build number: not applicable to this npm package.
39
+
40
+ Files changed: `package.json`, `files/finalrelease`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
41
+
42
+ - Release ad-free apps without adding an unnecessary AdMob alias or controller.
43
+ - Explicitly set `plugins.AdMob.ADMOB_ENABLED` to `false` to use the ad-free release path.
44
+ - Keep production AdMob safety checks for apps with advertising enabled.
45
+
46
+ ## 4.10.0 — 2026-10-23
47
+
48
+ Version name: 4.10.0. Version code/build number: not applicable to this npm package.
49
+ Bundled pre-build script: 6.7.
50
+
51
+ Files changed: `package.json`, `files/buildCodeplay/project-scripts.cjs`, `scripts/sync-files.js`, `scripts/uninstall.js`, `files/finalrelease`, `files/buildCodeplay/`, `files/scripts-common/`, `files/take-screen-image.js`, `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
52
+
53
+ - Copy shared build scripts and the versions manifest into each app; run local scripts with unversioned filenames.
54
+ - Rename app helper scripts to scripts-common automatically, migrate command paths, and preserve existing files without overwriting folder conflicts.
55
+ - Migrate app build/store/sync paths automatically and remove only superseded versioned helpers; preserve app-owned configuration and screenshot data.
56
+ - Resolve app sources/native targets from the consuming app directory while keeping bundled assets inside the plugin.
57
+ - Download IAP and AdMob directly from htmlcodeplay.com, without bundling archives or adding a separate fallback.
58
+ - Automatically migrate deferred ownership verification, purchase-safe advertising, and Home Pro visibility according to each store IAP flag.
59
+ - Copy the full finalrelease implementation so it can be tested from the application folder.
60
+ - Preserve working files during preinstall and avoid downgrading local/newer plugin installations to an older registry release.
61
+
62
+ ## 4.9.8 — 2026-10-22
63
+
64
+ Version name: 4.9.8. Version code/build number: not applicable to this npm package.
65
+ Bundled pre-build script: 6.5.
66
+
67
+ Files changed: `package.json`, `scripts/sync-files.js`, `files/buildCodeplay/codeplayBeforeBuild-6.5.js`, `files/buildCodeplay/sync-admob-nextgen.js`, `files/buildCodeplay/versions.json`, `files/finalrelease`, `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
68
+
69
+ - Install AdMob as `src/js/Ads/admob-nextgen-4.0/` with stable `admob-emi-nextgen.js` and `app-open-state.js` filenames.
70
+ - Automatically migrate loose-file references, folder references and Vite aliases during installation and before builds.
71
+ - Preserve app-owned ad configuration and select each app's existing IAP analytics module.
72
+ - Download every AdMob folder ZIP from htmlcodeplay.com; no AdMob archive is included in this npm package.
73
+ - Validate ZIP contents before switching imports; retain the working package when a remote update fails.
74
+ - Validate the selected folder controller during final-release checks while continuing to reject test aliases.
75
+
76
+ ## 4.7.7 — 2026-10-07
77
+
78
+ Version name: 4.7.7. Version code/build number: not applicable to this npm package.
79
+
80
+ Files changed: `package.json`, `scripts/sync-files.js`, `files/buildCodeplay/codeplayBeforeBuild-6.4.js`
81
+ (replaces `codeplayBeforeBuild-6.3.js`), `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
82
+
83
+ - Installation automatically configures Android and iOS build commands in your app's `package.json`.
84
+ - Android builds remain the default; use `npm run build:ios` for iOS.
85
+ - Save-gallery imports use one alias with a platform-specific helper and a clear confirmation before source changes.
86
+ - Shared checks reuse file traversal to reduce repeated scanning.
87
+ - Builds warn and automatically uninstall the retired OneSignal Cordova plugin when found.
88
+ - `agent-temp/` stays ignored, while `buildCodeplay/` is removed from ignore rules.
@@ -4522,30 +4522,9 @@ function findAndroidBuildBlock(content, name) {
4522
4522
  return null;
4523
4523
  }
4524
4524
 
4525
- function syncAndroidCapacitorPermissionRules() {
4526
- if (buildPlatform !== 'android' || !fs.existsSync(androidAppBuildGradlePath)) return;
4527
- const capacitorConfig = JSON.parse(fs.readFileSync(configPath, 'utf8'));
4528
- if (capacitorConfig.appId !== 'codeplay.love.calculator') return;
4529
-
4530
- const rulesPath = path.join(androidPlatformPath, 'app', 'proguard-rules.pro');
4531
- const original = fs.existsSync(rulesPath) ? fs.readFileSync(rulesPath, 'utf8') : '';
4532
- const newline = original.includes('\r\n') ? '\r\n' : '\n';
4533
- const rules = [
4534
- '-keepattributes RuntimeVisibleAnnotations,AnnotationDefault',
4535
- '-keep @interface com.getcapacitor.annotation.CapacitorPlugin { *; }',
4536
- '-keep @interface com.getcapacitor.annotation.Permission { *; }'
4537
- ];
4538
- const existingRules = original.split(/\r?\n/).map(line => line.trim());
4539
- const missingRules = rules.filter(rule => !existingRules.includes(rule));
4540
- if (!missingRules.length) return;
4541
-
4542
- const next = `${original.trimEnd()}${newline}${newline}# Preserve Capacitor permission metadata used at runtime.${newline}${missingRules.join(newline)}${newline}`;
4543
- fs.writeFileSync(rulesPath, next, 'utf8');
4544
- }
4545
-
4546
4525
  function syncAndroidBuildOptimization() {
4547
4526
  if (buildPlatform !== 'android' || !fs.existsSync(androidAppBuildGradlePath)) return;
4548
- syncAndroidCapacitorPermissionRules();
4527
+ require('./fix-optimize-builld/restore-android-r8-rules.cjs').syncAndroidR8Rules(process.cwd(), { installGradleHook: true });
4549
4528
 
4550
4529
  const original = fs.readFileSync(androidAppBuildGradlePath, 'utf8');
4551
4530
  const newline = original.includes('\r\n') ? '\r\n' : '\n';
@@ -0,0 +1,31 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ function syncCapacitorPermissionRules(projectRoot = path.resolve(__dirname, '../..')) {
5
+ const appPath = path.join(projectRoot, 'android', 'app');
6
+ if (!fs.existsSync(path.join(appPath, 'build.gradle'))) return false;
7
+
8
+ const rulesPath = path.join(appPath, 'proguard-rules.pro');
9
+ const original = fs.existsSync(rulesPath) ? fs.readFileSync(rulesPath, 'utf8') : '';
10
+ const rules = [
11
+ '-keepattributes RuntimeVisibleAnnotations,AnnotationDefault',
12
+ '-keep @interface com.getcapacitor.annotation.CapacitorPlugin { *; }',
13
+ '-keep @interface com.getcapacitor.annotation.Permission { *; }',
14
+ ];
15
+ const existing = new Set(original.split(/\r?\n/).map(line => line.trim()));
16
+ const missing = rules.filter(rule => !existing.has(rule));
17
+ if (!missing.length) return false;
18
+
19
+ const newline = original.includes('\r\n') ? '\r\n' : '\n';
20
+ fs.writeFileSync(rulesPath, `${original.trimEnd()}${newline}${newline}`
21
+ + `# Preserve Capacitor permission metadata used at runtime.${newline}`
22
+ + `${missing.join(newline)}${newline}`, 'utf8');
23
+ return true;
24
+ }
25
+
26
+ if (require.main === module) {
27
+ const changed = syncCapacitorPermissionRules();
28
+ console.log(changed ? 'Capacitor R8 permission rules restored.' : 'Capacitor R8 permission rules unchanged.');
29
+ }
30
+
31
+ module.exports = { syncCapacitorPermissionRules };
@@ -0,0 +1,28 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ // FFmpegKit's JNI library looks up these Java members by name at runtime.
5
+ const FFMPEG_JNI_RULES = [
6
+ '-keep class com.antonkarpenko.ffmpegkit.** { *; }',
7
+ '-keep interface com.antonkarpenko.ffmpegkit.** { *; }',
8
+ ];
9
+
10
+ function syncFfmpegJniRules(projectRoot) {
11
+ const pluginPath = path.join(projectRoot, 'node_modules', 'codeplay-fmpg', 'plugin.xml');
12
+ const appPath = path.join(projectRoot, 'android', 'app');
13
+ if (!fs.existsSync(pluginPath) || !fs.existsSync(appPath)) return false;
14
+
15
+ const rulesPath = path.join(appPath, 'proguard-rules.pro');
16
+ const original = fs.existsSync(rulesPath) ? fs.readFileSync(rulesPath, 'utf8') : '';
17
+ const existing = new Set(original.split(/\r?\n/).map(line => line.trim()));
18
+ const missing = FFMPEG_JNI_RULES.filter(rule => !existing.has(rule));
19
+ if (!missing.length) return false;
20
+
21
+ const newline = original.includes('\r\n') ? '\r\n' : '\n';
22
+ fs.writeFileSync(rulesPath, `${original.trimEnd()}${newline}${newline}`
23
+ + `# Preserve FFmpegKit JNI entry points and callbacks.${newline}`
24
+ + `${missing.join(newline)}${newline}`, 'utf8');
25
+ return true;
26
+ }
27
+
28
+ module.exports = { syncFfmpegJniRules };
@@ -0,0 +1,9 @@
1
+ // Restore native metadata before Gradle configures an optimized Android build.
2
+ def codeplayAppRoot = rootProject.projectDir.parentFile
3
+ def codeplayRepairScript = new File(codeplayAppRoot, 'buildCodeplay/fix-optimize-builld/restore-android-r8-rules.cjs')
4
+ def codeplayNodeBinary = project.findProperty('codeplayNodeBinary') ?: 'node'
5
+
6
+ providers.exec {
7
+ workingDir codeplayAppRoot
8
+ commandLine codeplayNodeBinary, codeplayRepairScript.absolutePath
9
+ }.result.get().assertNormalExitValue()
@@ -0,0 +1,30 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const { syncFfmpegJniRules } = require('./ffmpeg-jni-rules.cjs');
4
+ const { syncCapacitorPermissionRules } = require('./android-r8-rules.cjs');
5
+
6
+ function syncAndroidR8Rules(projectRoot = path.resolve(__dirname, '../..'), { installGradleHook = false } = {}) {
7
+ const buildPath = path.join(projectRoot, 'android', 'app', 'build.gradle');
8
+ if (!fs.existsSync(buildPath)) return false;
9
+ const capacitorChanged = syncCapacitorPermissionRules(projectRoot);
10
+ const ffmpegChanged = syncFfmpegJniRules(projectRoot);
11
+ let hookChanged = false;
12
+ if (installGradleHook) {
13
+ const original = fs.readFileSync(buildPath, 'utf8');
14
+ const hook = "apply from: '../../buildCodeplay/fix-optimize-builld/fix-optimize-build.gradle'";
15
+ const existingHook = /^[ \t]*apply\s+from:\s*(['"])\.\.\/\.\.\/buildCodeplay\/fix-optimize-builld\/fix-optimize-build\.gradle\1[ \t]*;?[ \t]*$/m;
16
+ if (!existingHook.test(original)) {
17
+ const newline = original.includes('\r\n') ? '\r\n' : '\n';
18
+ fs.writeFileSync(buildPath, `${original.trimEnd()}${newline}${newline}${hook}${newline}`, 'utf8');
19
+ hookChanged = true;
20
+ }
21
+ }
22
+ return capacitorChanged || ffmpegChanged || hookChanged;
23
+ }
24
+
25
+ if (require.main === module) {
26
+ const changed = syncAndroidR8Rules(undefined, { installGradleHook: process.argv.includes('--install-gradle-hook') });
27
+ console.log(changed ? 'Android R8 keep rules restored.' : 'Android R8 keep rules unchanged; no Android app or rules already present.');
28
+ }
29
+
30
+ module.exports = { syncAndroidR8Rules };
@@ -1,14 +1,14 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
-
4
- const replaceEmiPluginCode=()=>
5
- {
6
- // path to your .m file
7
- const filePath = path.join(__dirname, '../ios/capacitor-cordova-ios-plugins/sourcesstatic/EmiIndoCordovaPluginAdmob/emiAdmobPlugin.m');
8
- const nextGenPackagePath = path.join(__dirname, '../node_modules/capacitor-admob-nextgen/package.json');
9
-
10
-
11
- if (fs.existsSync(filePath)) {
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const replaceEmiPluginCode=()=>
5
+ {
6
+ // path to your .m file
7
+ const filePath = path.join(__dirname, '../ios/capacitor-cordova-ios-plugins/sourcesstatic/EmiIndoCordovaPluginAdmob/emiAdmobPlugin.m');
8
+ const nextGenPackagePath = path.join(__dirname, '../node_modules/capacitor-admob-nextgen/package.json');
9
+
10
+
11
+ if (fs.existsSync(filePath)) {
12
12
  let fileContent = fs.readFileSync(filePath, 'utf8');
13
13
 
14
14
  // match the hideBannerAd method
@@ -33,17 +33,17 @@ const replaceEmiPluginCode=()=>
33
33
  fileContent.slice(match.index + match[0].length);
34
34
 
35
35
  fs.writeFileSync(filePath, updatedFileContent, 'utf8');
36
- console.log(
37
- '✅ Successfully ensured [self resetWebViewHeight]; is commented only inside hideBannerAd in emiAdmobPlugin.m'
38
- );
39
- } else {
40
- console.log('⚠️ hideBannerAd method not found.');
41
- }
42
- } else if (fs.existsSync(nextGenPackagePath)) {
43
- console.log('ℹ️ Skipping legacy iOS EMI AdMob patch. capacitor-admob-nextgen does not use emiAdmobPlugin.m.');
44
- } else {
45
- console.log('ℹ️ emiAdmobPlugin.m file not found, skipping modification.');
46
- }
47
- }
48
-
49
- replaceEmiPluginCode();
36
+ console.log(
37
+ '✅ Successfully ensured [self resetWebViewHeight]; is commented only inside hideBannerAd in emiAdmobPlugin.m'
38
+ );
39
+ } else {
40
+ console.log('⚠️ hideBannerAd method not found.');
41
+ }
42
+ } else if (fs.existsSync(nextGenPackagePath)) {
43
+ console.log('ℹ️ Skipping legacy iOS EMI AdMob patch. capacitor-admob-nextgen does not use emiAdmobPlugin.m.');
44
+ } else {
45
+ console.log('ℹ️ emiAdmobPlugin.m file not found, skipping modification.');
46
+ }
47
+ }
48
+
49
+ replaceEmiPluginCode();
@@ -1,6 +1,9 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
3
  const plist = require('plist');
4
+ const { syncAndroidR8Rules } = require('./fix-optimize-builld/restore-android-r8-rules.cjs');
5
+
6
+ syncAndroidR8Rules(process.cwd(), { installGradleHook: true });
4
7
 
5
8
  const { readFileSync } = require("fs");
6
9
 
@@ -1,90 +1,90 @@
1
- Note: This changes are added with my old(current) code. Might we need to integrate this features into our new optimized code.
2
-
3
- 1) If no import(saveToGalleryAndSaveAnyFile) found it through error issue is fixed
4
- // iOS Checks
5
- /* if (isMac && !iosImportFound) {
6
- console.warn(`⚠️ WARNING: You're on macOS but no iOS version (saveToGalleryAndSaveAnyFile-x.x-ios.js) found.`);
7
- process.exit(1);
8
- } else if (isMac && iosImportFound) {
9
- console.log('✅ iOS version detected for macOS build.');
10
- } else if (!iosImportFound) {
11
- console.log('✅ No iOS-specific imports detected for non-macOS.');
12
- } */
13
-
14
- // ✅ Only care if iOS import is found in NON-mac systems
15
- if (iosImportFound && !isMac) {
16
- console.error(`\n❌ ERROR: iOS-specific file is imported in non-macOS environment.`);
17
- process.exit(1);
18
- } else if (iosImportFound && isMac) {
19
- console.log('✅ iOS import detected (valid for macOS build).');
20
- } else {
21
- console.log('✅ No iOS-specific imports found (this is totally fine).');
22
- }
23
-
24
-
25
- 2) Statusbar color set in app startup is checked and through erro
26
-
27
- const STATUSBAR_FILE = path.resolve(__dirname, '../src/js/common-configuration.js');
28
- const STATUSBAR_REGEX = /^(?!\s*\/\/).*Capacitor\.Plugins\.StatusBar\.setStyle/m;
29
-
30
-
31
- const ONESIGNAL_OLD_FILES = [
32
- path.resolve(__dirname, '../src/js/onesignal-settings.js')
33
- ];
34
- const ONESIGNAL_VERSION_REGEX = /^onesignal-\d+(\.\d+)*\.js$/;
35
-
36
- ....
37
- ....
38
- ....
39
-
40
-
41
- const JS_ROOT = path.resolve(__dirname, '../src/js');
42
- const ONESIGNAL_DIR = path.join(JS_ROOT, 'onesignal');
43
-
44
- // 🚨 Block old OneSignal file locations (ONLY in src/js root)
45
- if (path.dirname(dir) === JS_ROOT) {
46
-
47
- // ❌ onesignal-settings.js
48
- if (ONESIGNAL_OLD_FILES.includes(dir)) {
49
- console.error(`\n❌ ERROR: onesignal-settings.js should not be in src/js/`);
50
- console.error(`📁 Move it to: src/js/onesignal/`);
51
- console.error(`📄 File: ${dir}\n`);
52
- process.exit(1);
53
- }
54
-
55
- // ❌ onesignal-x.x.js
56
- if (ONESIGNAL_VERSION_REGEX.test(baseName)) {
57
- console.error(`\n❌ ERROR: ${baseName} should not be in src/js/`);
58
- console.error(`📁 Move it to: src/js/onesignal/`);
59
- console.error(`📄 File: ${dir}\n`);
60
- process.exit(1);
61
- }
62
- }
63
-
64
- // 🚨 Special check ONLY for common-configuration.js
65
- if (dir === STATUSBAR_FILE) {
66
- let content = fs.readFileSync(dir, 'utf8');
67
-
68
- // 🧹 Remove ALL comments (single-line + multi-line)
69
- const contentWithoutComments = content
70
- .replace(/\/\/.*$/gm, '') // remove // comments
71
- .replace(/\/\*[\s\S]*?\*\//g, ''); // remove /* */ comments
72
-
73
- // ✅ Now check only real code
74
- if (contentWithoutComments.includes('Capacitor.Plugins.StatusBar.setStyle')) {
75
- console.error(`\n❌ ERROR: StatusBar.setStyle should NOT be used in common-configuration.js`);
76
- console.error(`🚫 iOS status bar is controlled via other methods. Remove this line.`);
77
- console.error(`📄 File: ${dir}\n`);
78
- process.exit(1);
79
- }
80
- }
81
-
82
-
83
- 3) Modification in "fix-onesignal-plugin.js" file
84
- Search following and that whole block added for add permission to "info.plist" file
85
- INFO.PLIST START
86
-
87
- 4) In "codeplayBeforeBuild-6.1.js" file following whole method is replaced. Due to add ads related permission to info.plist file
88
- updateInfoPlist()
89
-
1
+ Note: This changes are added with my old(current) code. Might we need to integrate this features into our new optimized code.
2
+
3
+ 1) If no import(saveToGalleryAndSaveAnyFile) found it through error issue is fixed
4
+ // iOS Checks
5
+ /* if (isMac && !iosImportFound) {
6
+ console.warn(`⚠️ WARNING: You're on macOS but no iOS version (saveToGalleryAndSaveAnyFile-x.x-ios.js) found.`);
7
+ process.exit(1);
8
+ } else if (isMac && iosImportFound) {
9
+ console.log('✅ iOS version detected for macOS build.');
10
+ } else if (!iosImportFound) {
11
+ console.log('✅ No iOS-specific imports detected for non-macOS.');
12
+ } */
13
+
14
+ // ✅ Only care if iOS import is found in NON-mac systems
15
+ if (iosImportFound && !isMac) {
16
+ console.error(`\n❌ ERROR: iOS-specific file is imported in non-macOS environment.`);
17
+ process.exit(1);
18
+ } else if (iosImportFound && isMac) {
19
+ console.log('✅ iOS import detected (valid for macOS build).');
20
+ } else {
21
+ console.log('✅ No iOS-specific imports found (this is totally fine).');
22
+ }
23
+
24
+
25
+ 2) Statusbar color set in app startup is checked and through erro
26
+
27
+ const STATUSBAR_FILE = path.resolve(__dirname, '../src/js/common-configuration.js');
28
+ const STATUSBAR_REGEX = /^(?!\s*\/\/).*Capacitor\.Plugins\.StatusBar\.setStyle/m;
29
+
30
+
31
+ const ONESIGNAL_OLD_FILES = [
32
+ path.resolve(__dirname, '../src/js/onesignal-settings.js')
33
+ ];
34
+ const ONESIGNAL_VERSION_REGEX = /^onesignal-\d+(\.\d+)*\.js$/;
35
+
36
+ ....
37
+ ....
38
+ ....
39
+
40
+
41
+ const JS_ROOT = path.resolve(__dirname, '../src/js');
42
+ const ONESIGNAL_DIR = path.join(JS_ROOT, 'onesignal');
43
+
44
+ // 🚨 Block old OneSignal file locations (ONLY in src/js root)
45
+ if (path.dirname(dir) === JS_ROOT) {
46
+
47
+ // ❌ onesignal-settings.js
48
+ if (ONESIGNAL_OLD_FILES.includes(dir)) {
49
+ console.error(`\n❌ ERROR: onesignal-settings.js should not be in src/js/`);
50
+ console.error(`📁 Move it to: src/js/onesignal/`);
51
+ console.error(`📄 File: ${dir}\n`);
52
+ process.exit(1);
53
+ }
54
+
55
+ // ❌ onesignal-x.x.js
56
+ if (ONESIGNAL_VERSION_REGEX.test(baseName)) {
57
+ console.error(`\n❌ ERROR: ${baseName} should not be in src/js/`);
58
+ console.error(`📁 Move it to: src/js/onesignal/`);
59
+ console.error(`📄 File: ${dir}\n`);
60
+ process.exit(1);
61
+ }
62
+ }
63
+
64
+ // 🚨 Special check ONLY for common-configuration.js
65
+ if (dir === STATUSBAR_FILE) {
66
+ let content = fs.readFileSync(dir, 'utf8');
67
+
68
+ // 🧹 Remove ALL comments (single-line + multi-line)
69
+ const contentWithoutComments = content
70
+ .replace(/\/\/.*$/gm, '') // remove // comments
71
+ .replace(/\/\*[\s\S]*?\*\//g, ''); // remove /* */ comments
72
+
73
+ // ✅ Now check only real code
74
+ if (contentWithoutComments.includes('Capacitor.Plugins.StatusBar.setStyle')) {
75
+ console.error(`\n❌ ERROR: StatusBar.setStyle should NOT be used in common-configuration.js`);
76
+ console.error(`🚫 iOS status bar is controlled via other methods. Remove this line.`);
77
+ console.error(`📄 File: ${dir}\n`);
78
+ process.exit(1);
79
+ }
80
+ }
81
+
82
+
83
+ 3) Modification in "fix-onesignal-plugin.js" file
84
+ Search following and that whole block added for add permission to "info.plist" file
85
+ INFO.PLIST START
86
+
87
+ 4) In "codeplayBeforeBuild-6.1.js" file following whole method is replaced. Due to add ads related permission to info.plist file
88
+ updateInfoPlist()
89
+
90
90
  5) The "checkPackageVersion()" metod is updated. Now check the "codeplay-common" latest version and uninstall/install automatically.
@@ -38,6 +38,10 @@ function updateBuildScripts(scripts) {
38
38
  next['ionic:build'] = next['ionic:build'] || 'npm run build';
39
39
  next['ionic:serve'] = next['ionic:serve'] || 'cross-env NODE_ENV=development vite';
40
40
  next['baseline-profile:setup'] = next['baseline-profile:setup'] || 'node scripts-common/setup-baseline-profile.js';
41
+ const r8Command = next['android:r8-rules'];
42
+ if (!r8Command || r8Command === 'node buildCodeplay/android-r8-rules.cjs' || /^node\s+(?:\.\/)?(?:Scripts|scripts|scripts-common)\/restore-android-r8-rules\.cjs$/.test(r8Command)) {
43
+ next['android:r8-rules'] = 'node buildCodeplay/fix-optimize-builld/restore-android-r8-rules.cjs';
44
+ }
41
45
  if (!next['baseline-profile:generate'] || next['baseline-profile:generate'] === 'cd android && gradlew.bat :app:generateBaselineProfile --console=plain') {
42
46
  next['baseline-profile:generate'] = 'node scripts-common/generate-baseline-profile.js';
43
47
  }
@@ -1,43 +1,43 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
-
4
- const legacyPluginXmlPath = path.resolve(
5
- __dirname,
6
- '../node_modules/emi-indo-cordova-plugin-admob/plugin.xml'
7
- );
8
-
9
- const nextGenPackagePath = path.resolve(
10
- __dirname,
11
- '../node_modules/capacitor-admob-nextgen/package.json'
12
- );
13
-
14
- if (!fs.existsSync(legacyPluginXmlPath)) {
15
- if (fs.existsSync(nextGenPackagePath)) {
16
- console.log('ℹ️ Skipping legacy Kotlin patch. capacitor-admob-nextgen is installed and does not use plugin.xml.');
17
- process.exit(0);
18
- }
19
-
20
- console.log('ℹ️ Legacy AdMob plugin.xml not found, skipping Kotlin patch.');
21
- process.exit(0);
22
- }
23
-
24
- fs.readFile(legacyPluginXmlPath, 'utf8', (err, data) => {
25
- if (err) {
26
- console.error('Error reading plugin.xml:', err);
27
- process.exit(1);
28
- }
29
-
30
- const modifiedData = data.replace(
31
- /<framework\s+src="src\/android\/force-kotlin\.gradle"\s+custom="true"\s+type="gradleReference"\s*\/>\s*\n?/g,
32
- ''
33
- );
34
-
35
- fs.writeFile(legacyPluginXmlPath, modifiedData, 'utf8', (writeErr) => {
36
- if (writeErr) {
37
- console.error('Error writing plugin.xml:', writeErr);
38
- process.exit(1);
39
- }
40
-
41
- console.log('plugin.xml updated successfully.');
42
- });
43
- });
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const legacyPluginXmlPath = path.resolve(
5
+ __dirname,
6
+ '../node_modules/emi-indo-cordova-plugin-admob/plugin.xml'
7
+ );
8
+
9
+ const nextGenPackagePath = path.resolve(
10
+ __dirname,
11
+ '../node_modules/capacitor-admob-nextgen/package.json'
12
+ );
13
+
14
+ if (!fs.existsSync(legacyPluginXmlPath)) {
15
+ if (fs.existsSync(nextGenPackagePath)) {
16
+ console.log('ℹ️ Skipping legacy Kotlin patch. capacitor-admob-nextgen is installed and does not use plugin.xml.');
17
+ process.exit(0);
18
+ }
19
+
20
+ console.log('ℹ️ Legacy AdMob plugin.xml not found, skipping Kotlin patch.');
21
+ process.exit(0);
22
+ }
23
+
24
+ fs.readFile(legacyPluginXmlPath, 'utf8', (err, data) => {
25
+ if (err) {
26
+ console.error('Error reading plugin.xml:', err);
27
+ process.exit(1);
28
+ }
29
+
30
+ const modifiedData = data.replace(
31
+ /<framework\s+src="src\/android\/force-kotlin\.gradle"\s+custom="true"\s+type="gradleReference"\s*\/>\s*\n?/g,
32
+ ''
33
+ );
34
+
35
+ fs.writeFile(legacyPluginXmlPath, modifiedData, 'utf8', (writeErr) => {
36
+ if (writeErr) {
37
+ console.error('Error writing plugin.xml:', writeErr);
38
+ process.exit(1);
39
+ }
40
+
41
+ console.log('plugin.xml updated successfully.');
42
+ });
43
+ });
@@ -12,6 +12,7 @@ import { createInterface } from 'readline';
12
12
 
13
13
  import { fileURLToPath } from 'url';
14
14
  import { dirname } from 'path';
15
+ import { syncAndroidR8Rules } from './buildCodeplay/fix-optimize-builld/restore-android-r8-rules.cjs';
15
16
 
16
17
  /* const path = require('path');
17
18
  const fs = require('fs'); */
@@ -744,6 +745,7 @@ function findGradleBlock(content, headerPattern) {
744
745
  }
745
746
 
746
747
  function ensureReleaseCodeOptimization() {
748
+ syncAndroidR8Rules(process.cwd(), { installGradleHook: true });
747
749
  const currentContent = readFileSync(gradleFilePath, 'utf8');
748
750
  const releaseBlock = findGradleBlock(currentContent, /buildTypes\s*\{[\s\S]*?\brelease\s*/);
749
751
  if (!releaseBlock) throw new Error('Release build configuration was not found.');
@@ -957,11 +959,7 @@ rl.question('Enter new versionCode (press enter to keep current): ', (newVersion
957
959
  throw new Error('Release build configuration was not found.');
958
960
  }
959
961
  let minificationContent = updatedGradleContent.slice(minificationBlock.start, minificationBlock.end);
960
- if (/\bminifyEnabled\s*(?:=\s*)?(true|false)\b/.test(minificationContent)) {
961
- // Replace existing value with desired
962
- minificationContent = minificationContent.replace(/\bminifyEnabled\s*(?:=\s*)?(true|false)\b/, `minifyEnabled ${desiredMinify}`);
963
- console.log(`Replaced minifyEnabled with ${desiredMinify}.`);
964
- } else {
962
+ if (!/\bminifyEnabled\b/.test(minificationContent)) {
965
963
  // Insert minifyEnabled if not present
966
964
  minificationContent = `\n minifyEnabled ${desiredMinify}${minificationContent}`;
967
965
  console.log(`✅ Inserted minifyEnabled ${desiredMinify} into release block.`);
@@ -993,7 +991,7 @@ rl.question('Enter new versionCode (press enter to keep current): ', (newVersion
993
991
 
994
992
  // Write the updated gradle content back to build.gradle
995
993
  writeFileSync(gradleFilePath, updatedGradleContent, 'utf8');
996
- console.log(`✅ Updated build.gradle with versionCode: ${finalVersionCode}, versionName: ${finalVersionName}, resConfigs "en" and "minifyEnabled true"`);
994
+ console.log(`✅ Updated build.gradle with versionCode: ${finalVersionCode}, versionName: ${finalVersionName}, resConfigs "en"; existing minification settings preserved.`);
997
995
 
998
996
  let baselineProfileChecked = false;
999
997
  for (const id of storeIds) {
@@ -1,46 +1,46 @@
1
- const { execFileSync, spawnSync } = require('child_process');
2
- const path = require('path');
3
- const { syncGeneratedProfileBackup } = require('./setup-baseline-profile.js');
4
-
5
- function main() {
6
- const devices = execFileSync('adb', ['devices'], { encoding: 'utf8' })
7
- .split(/\r?\n/)
8
- .map(line => line.match(/^(.+?)\tdevice\s*$/))
9
- .filter(Boolean)
10
- .map(match => match[1]);
11
- const requestedSerial = process.env.ANDROID_SERIAL?.trim();
12
- if (requestedSerial?.includes(',')) {
13
- throw new Error('Set ANDROID_SERIAL to one device connection for Baseline Profile generation.');
14
- }
15
- const serial = requestedSerial || devices[0];
16
- if (!serial || !devices.includes(serial)) {
17
- throw new Error(requestedSerial
18
- ? `ADB device is not online: ${requestedSerial}`
19
- : 'No online ADB device. Connect an Android device before generating a Baseline Profile.');
20
- }
21
-
22
- console.log(`Generating Baseline Profile using one ADB connection: ${serial}`);
23
- const args = [':app:generateBaselineProfile', '--console=plain'];
24
- const result = spawnSync(
25
- process.platform === 'win32' ? 'cmd.exe' : './gradlew',
26
- process.platform === 'win32' ? ['/d', '/s', '/c', `gradlew.bat ${args.join(' ')}`] : args,
27
- {
28
- cwd: path.resolve(__dirname, '..', 'android'),
29
- env: { ...process.env, ANDROID_SERIAL: serial },
30
- stdio: 'inherit',
31
- }
32
- );
33
- if (result.error) throw result.error;
34
- if (result.signal) throw new Error(`Baseline Profile generation stopped by ${result.signal}.`);
35
- process.exitCode = result.status ?? 1;
36
- if (process.exitCode === 0) {
37
- syncGeneratedProfileBackup({ backupOnly: true });
38
- }
39
- }
40
-
41
- try {
42
- main();
43
- } catch (error) {
44
- console.error(`Baseline Profile generation failed: ${error.message}`);
45
- process.exitCode = 1;
46
- }
1
+ const { execFileSync, spawnSync } = require('child_process');
2
+ const path = require('path');
3
+ const { syncGeneratedProfileBackup } = require('./setup-baseline-profile.js');
4
+
5
+ function main() {
6
+ const devices = execFileSync('adb', ['devices'], { encoding: 'utf8' })
7
+ .split(/\r?\n/)
8
+ .map(line => line.match(/^(.+?)\tdevice\s*$/))
9
+ .filter(Boolean)
10
+ .map(match => match[1]);
11
+ const requestedSerial = process.env.ANDROID_SERIAL?.trim();
12
+ if (requestedSerial?.includes(',')) {
13
+ throw new Error('Set ANDROID_SERIAL to one device connection for Baseline Profile generation.');
14
+ }
15
+ const serial = requestedSerial || devices[0];
16
+ if (!serial || !devices.includes(serial)) {
17
+ throw new Error(requestedSerial
18
+ ? `ADB device is not online: ${requestedSerial}`
19
+ : 'No online ADB device. Connect an Android device before generating a Baseline Profile.');
20
+ }
21
+
22
+ console.log(`Generating Baseline Profile using one ADB connection: ${serial}`);
23
+ const args = [':app:generateBaselineProfile', '--console=plain'];
24
+ const result = spawnSync(
25
+ process.platform === 'win32' ? 'cmd.exe' : './gradlew',
26
+ process.platform === 'win32' ? ['/d', '/s', '/c', `gradlew.bat ${args.join(' ')}`] : args,
27
+ {
28
+ cwd: path.resolve(__dirname, '..', 'android'),
29
+ env: { ...process.env, ANDROID_SERIAL: serial },
30
+ stdio: 'inherit',
31
+ }
32
+ );
33
+ if (result.error) throw result.error;
34
+ if (result.signal) throw new Error(`Baseline Profile generation stopped by ${result.signal}.`);
35
+ process.exitCode = result.status ?? 1;
36
+ if (process.exitCode === 0) {
37
+ syncGeneratedProfileBackup({ backupOnly: true });
38
+ }
39
+ }
40
+
41
+ try {
42
+ main();
43
+ } catch (error) {
44
+ console.error(`Baseline Profile generation failed: ${error.message}`);
45
+ process.exitCode = 1;
46
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeplay-common",
3
- "version": "4.11.3",
3
+ "version": "4.11.4",
4
4
  "description": "Common build scripts and files",
5
5
  "scripts": {
6
6
  "postinstall": "node scripts/sync-files.js",
@@ -1,6 +1,7 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
3
  const { updateBuildScripts, removeVersionedBuildScripts } = require('../files/buildCodeplay/project-scripts.cjs');
4
+ const { syncAndroidR8Rules } = require('../files/buildCodeplay/fix-optimize-builld/restore-android-r8-rules.cjs');
4
5
 
5
6
  function migrateAppScripts(projectRoot) {
6
7
  const root = path.resolve(projectRoot);
@@ -97,6 +98,7 @@ function install(options = {}) {
97
98
  }
98
99
  }
99
100
  migrateAppConfigurator(projectRoot);
101
+ syncAndroidR8Rules(projectRoot, { installGradleHook: true });
100
102
  pkg.scripts = scripts;
101
103
  fs.writeFileSync(packagePath, JSON.stringify(pkg, null, 2) + '\n');
102
104
  // Cleanup happens only after replacement assets and package commands exist.