codeplay-common 4.9.9 → 4.10.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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.10.0 — 2026-10-23
4
+
5
+ Version name: 4.10.0. Version code/build number: not applicable to this npm package.
6
+ Bundled pre-build script: 6.7.
7
+
8
+ 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`.
9
+
10
+ - Copy shared build scripts and the versions manifest into each app; run local scripts with unversioned filenames.
11
+ - Rename app helper scripts to scripts-common automatically, migrate command paths, and preserve existing files without overwriting folder conflicts.
12
+ - Migrate app build/store/sync paths automatically and remove only superseded versioned helpers; preserve app-owned configuration and screenshot data.
13
+ - Resolve app sources/native targets from the consuming app directory while keeping bundled assets inside the plugin.
14
+ - Download IAP and AdMob directly from htmlcodeplay.com, without bundling archives or adding a separate fallback.
15
+ - Automatically migrate deferred ownership verification, purchase-safe advertising, and Home Pro visibility according to each store IAP flag.
16
+ - Copy the full finalrelease implementation so it can be tested from the application folder.
17
+ - Preserve working files during preinstall and avoid downgrading local/newer plugin installations to an older registry release.
18
+
3
19
  ## 4.9.8 — 2026-10-22
4
20
 
5
21
  Version name: 4.9.8. Version code/build number: not applicable to this npm package.
package/README.md CHANGED
@@ -9,13 +9,27 @@ Based on store install various IAP plugins
9
9
  Make it to ionic project
10
10
 
11
11
 
12
- ## AdMob folder packages (4.9.8)
12
+ ## App helper folder
13
13
 
14
- Installing this release automatically migrates AdMob to:
14
+ 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/`.
15
15
 
16
- `src/js/Ads/admob-nextgen-4.0/admob-emi-nextgen.js`
16
+ ## Shared unversioned build files (4.10.0)
17
17
 
18
- `src/js/Ads/admob-nextgen-4.0/app-open-state.js`
18
+ The plugin keeps the master build templates in files/buildCodeplay and copies them into each app's buildCodeplay folder during installation/update. Test changes in the application folder, then update these master templates for distribution to other apps.
19
+
20
+ App package scripts run local files: node buildCodeplay/codeplayBeforeBuild.js, node buildCodeplay/packageidBaseModification.js, node buildCodeplay/add-splash-screen.js and node buildCodeplay/setSplashAnimation.js. Filenames have no version suffixes. The versions.json plugin manifest remains alongside these scripts and is copied too.
21
+
22
+ Installation migrates both legacy versioned filenames and the temporary node_modules runner commands to these local paths. It removes only superseded versioned build scripts, preserves app-owned release configuration and splash XML overrides, and keeps screenshot data and custom helpers. The root finalrelease script is also copied as a local implementation.
23
+
24
+ Before-build includes the automatic IAP startup and Home Pro-button migrations. IAP and AdMob ZIPs are downloaded directly from https://htmlcodeplay.com/code-play-plugin/ using the existing update flow. No plugin ZIPs are bundled in this npm package. App-specific configuration and designs remain in the app.
25
+
26
+ ## AdMob folder packages
27
+
28
+ The next before-build automatically migrates AdMob to at least:
29
+
30
+ `src/js/Ads/admob-nextgen-4.1/admob-emi-nextgen.js`
31
+
32
+ `src/js/Ads/admob-nextgen-4.1/app-open-state.js`
19
33
 
20
34
  Existing `@admob` imports continue to work. Direct imports of the controller or
21
35
  lightweight state module are rewritten to the selected folder, including relative
@@ -24,7 +38,7 @@ paths, `@/` paths and static dynamic imports. App-owned
24
38
  installation does not replace its values. The controller's analytics import is
25
39
  aligned with the newest installed IAP folder containing `firebase-analytics.js`.
26
40
 
27
- The postinstall hook and pre-build script use the same migration helper. AdMob archives are downloaded only from the live plugin server; none are stored in this npm package.
41
+ The pre-build script downloads IAP before migrating AdMob so the corresponding imports exist. Postinstall does not independently update AdMob ahead of IAP.
28
42
  ZIPs may contain the files directly or one matching versioned folder. A complete
29
43
  controller and state module are required before imports switch. An unavailable or
30
44
  invalid remote ZIP leaves the installed package in use, with a warning. Unresolved
@@ -35,15 +49,15 @@ For future AdMob releases, upload `admob-nextgen-X.Y.zip` to
35
49
  in that server's `versions.json`. Version the folder, and keep module filenames
36
50
  stable. The previous `admob-emi-nextgen` manifest key is accepted for versions
37
51
  4.0 and later during the transition. Apps automatically select a newer ZIP during
38
- installation or their next normal pre-build; no per-app import changes are needed.
52
+ their next normal pre-build; no per-app import changes are needed.
39
53
  For older manifests without a folder release entry, migration checks the required
40
- `admob-nextgen-4.0.zip` directly on the same server. If offline, an existing complete
41
- folder remains usable; first migration stops with the legacy files preserved.
54
+ `admob-nextgen-4.1.zip` directly from the same server. If offline, an existing compatible
55
+ installation is preserved; a missing required package stops the build.
42
56
 
43
57
  ## Platform builds and shared validation
44
58
 
45
59
  Installing or updating `codeplay-common` updates the consuming project's `package.json`
46
- to use the latest bundled pre-build script and adds these commands:
60
+ to use the copied unversioned pre-build script and adds these commands:
47
61
 
48
62
  - `npm run build`: Android by default, including on macOS.
49
63
  - `npm run build:ios`: sets `CODEPLAY_BUILD_PLATFORM=ios` and runs the same build pipeline.
@@ -67,7 +81,7 @@ package imports remain. Legacy OneSignal patching and helper downloads are disab
67
81
 
68
82
  ## Screenshot data
69
83
 
70
- Shared screenshot helpers are installed into `scripts/screenshot/` and updated with
84
+ Shared screenshot helpers are installed into `scripts-common/screenshot/` and updated with
71
85
  the package. App-specific data is not bundled with the package.
72
86
  During an upgrade, cleanup removes only the two legacy helpers `frame-samples.js`
73
87
  and `background-decorations.js` from `scripts-screenshot/screenshot/`, preserving
package/RELEASE_NOTES.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Release notes
2
2
 
3
+ ## 4.10.0 — 2026-10-23
4
+
5
+ Version name: 4.10.0. Version code/build number: not applicable to this npm package.
6
+ Bundled pre-build script: 6.7.
7
+
8
+ 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`.
9
+
10
+ - Copy shared build scripts and the versions manifest into each app; run local scripts with unversioned filenames.
11
+ - Rename app helper scripts to scripts-common automatically, migrate command paths, and preserve existing files without overwriting folder conflicts.
12
+ - Migrate app build/store/sync paths automatically and remove only superseded versioned helpers; preserve app-owned configuration and screenshot data.
13
+ - Resolve app sources/native targets from the consuming app directory while keeping bundled assets inside the plugin.
14
+ - Download IAP and AdMob directly from htmlcodeplay.com, without bundling archives or adding a separate fallback.
15
+ - Automatically migrate deferred ownership verification, purchase-safe advertising, and Home Pro visibility according to each store IAP flag.
16
+ - Copy the full finalrelease implementation so it can be tested from the application folder.
17
+ - Preserve working files during preinstall and avoid downgrading local/newer plugin installations to an older registry release.
18
+
3
19
  ## 4.9.8 — 2026-10-22
4
20
 
5
21
  Version name: 4.9.8. Version code/build number: not applicable to this npm package.
@@ -1,254 +1,255 @@
1
- const fs = require("fs");
2
- const path = require("path");
3
- const { isStringObject } = require("util/types");
4
-
5
- const configPath = path.join(process.cwd(), 'capacitor.config.json');
6
-
7
- // Define file paths
8
- const projectFolder = path.resolve(".");
9
- const sourceSplashIcon = path.join(projectFolder, "resources", "splash_icon.png");
10
- const destinationSplashIcon = path.join(
11
- projectFolder,
12
- "android",
13
- "app",
14
- "src",
15
- "main",
16
- "res",
17
- "drawable-nodpi",
18
- "splash_icon.png"
19
- );
20
-
21
-
22
-
23
-
24
-
25
- const sourceSplashXML = path.join(projectFolder,"buildCodeplay", "splashxml", "codeplay_splashScreen.xml");
26
- const destinationSplashXML = path.join(
27
- projectFolder,
28
- "android",
29
- "app",
30
- "src",
31
- "main",
32
- "res",
33
- "values",
34
- "codeplay_splashScreen.xml"
35
- );
36
- const androidManifestPath = path.join(
37
- projectFolder,
38
- "android",
39
- "app",
40
- "src",
41
- "main",
42
- "AndroidManifest.xml"
43
- );
44
-
45
- // Helper function to copy files
46
- function copyFile(source, destination) {
47
- if (!fs.existsSync(source)) {
48
- throw new Error(`Source file not found: ${source}`);
49
- }
50
- fs.mkdirSync(path.dirname(destination), { recursive: true });
51
- fs.copyFileSync(source, destination);
52
- console.log(`Copied: ${source} -> ${destination}`);
53
- }
54
-
55
- // Helper function to update AndroidManifest.xml
56
- function updateAndroidManifest() {
57
- if (!fs.existsSync(androidManifestPath)) {
58
- throw new Error(`AndroidManifest.xml not found: ${androidManifestPath}`);
59
- }
60
-
61
-
62
-
63
-
64
-
65
- const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
66
-
67
-
68
- let logErrorMessage="";
69
-
70
- const RESIZEABLE_ACTIVITY = config.android?.RESIZEABLE_ACTIVITY;
71
- const orientation = config.android?.ORIENTATION;
72
-
73
- // 1️⃣ Check if it’s missing
74
- if (RESIZEABLE_ACTIVITY === undefined) {
75
- logErrorMessage+='❌ Missing android.RESIZEABLE_ACTIVITY option in capacitor.config.json.\n';
76
- }
77
-
78
- // 2️⃣ Check if it’s not boolean (true/false only)
79
- else if (typeof RESIZEABLE_ACTIVITY !== 'boolean') {
80
- logErrorMessage+='❌ Invalid android.RESIZEABLE_ACTIVITY value. Please use only true or false (without quotes).\n';
81
- }
82
-
83
-
84
-
85
- if (!orientation) {
86
- logErrorMessage+='❌ Missing android.ORIENTATION option in capacitor.config.json.\n';
87
- }
88
-
89
- else if(orientation!="portrait" && orientation!="landscape" && orientation!="auto")
90
- {
91
- logErrorMessage+='❌ Spelling mistake in android.ORIENTATION option in capacitor.config.json. Please use only ["portrait" "landscape" "auto"]\n';
92
- }
93
-
94
- if(logErrorMessage!="")
95
- {
96
- console.error(logErrorMessage);
97
- process.exit(1)
98
- }
99
-
100
-
101
- let manifestContent = fs.readFileSync(androidManifestPath, "utf-8");
102
-
103
- manifestContent = manifestContent.replace(
104
- /<activity[^>]*?>/,
105
- (match) => {
106
- let updated = match;
107
-
108
- // If android:theme is already present, update it
109
- if (updated.includes('android:theme=')) {
110
- updated = updated.replace(
111
- /android:theme="[^"]*"/,
112
- 'android:theme="@style/Theme.Codeplay.SplashScreen"'
113
- );
114
- }
115
-
116
- // If android:resizeableActivity is already present, update it
117
- if (updated.includes('android:resizeableActivity=')) {
118
- updated = updated.replace(
119
- /android:resizeableActivity="[^"]*"/,
120
- `android:resizeableActivity="${RESIZEABLE_ACTIVITY}"`
121
- );
122
- } else {
123
- // Add resizeableActivity attribute
124
- updated = updated.replace(`<activity`, `<activity android:resizeableActivity="${RESIZEABLE_ACTIVITY}"`);
125
- }
126
-
127
-
128
- //const admobConfig = getAdMobConfig();
129
-
130
-
131
-
132
-
133
-
134
- if(orientation=="portrait"){
135
- // If android:screenOrientation is already present, update it
136
- if (updated.includes('android:screenOrientation=')) {
137
- updated = updated.replace(
138
- /android:screenOrientation="[^"]*"/,
139
- 'android:screenOrientation="portrait"'
140
- );
141
- } else {
142
- updated = updated.replace(
143
- '<activity',
144
- '<activity android:screenOrientation="portrait"'
145
- );
146
- }
147
- }
148
-
149
-
150
-
151
- if(orientation=="landscape"){
152
- // If android:screenOrientation is already present, update it
153
- if (updated.includes('android:screenOrientation=')) {
154
- updated = updated.replace(
155
- /android:screenOrientation="[^"]*"/,
156
- 'android:screenOrientation="landscape"'
157
- );
158
- } else {
159
- updated = updated.replace(
160
- '<activity',
161
- '<activity android:screenOrientation="landscape"'
162
- );
163
- }
164
- }
165
-
166
-
167
- if (orientation === "auto") {
168
- // Remove android:screenOrientation attribute if present
169
- updated = updated.replace(/\s*android:screenOrientation="[^"]*"/, '');
170
- }
171
-
172
-
173
-
174
- return updated;
175
- }
176
- );
177
-
178
- fs.writeFileSync(androidManifestPath, manifestContent, "utf-8");
179
- console.log(`Updated AndroidManifest.xml: ensured resizeableActivity="false" and updated theme if present.`);
180
- }
181
-
182
-
183
- function removeOldSplashImages() {
184
- /* const drawableFolders = [
185
- "drawable",
186
- "drawable-land-hdpi",
187
- "drawable-land-mdpi",
188
- "drawable-land-xhdpi",
189
- "drawable-land-xxhdpi",
190
- "drawable-land-xxxhdpi",
191
- "drawable-port-hdpi",
192
- "drawable-port-mdpi",
193
- "drawable-port-xhdpi",
194
- "drawable-port-xxhdpi",
195
- "drawable-port-xxxhdpi"
196
- ]; */
197
-
198
- //In previous build we have removed all splash image, but now it through error like splash.png missing, so we are not removing the splash screen
199
- //If we want to remove, un comment the "const drawableFolders=.." first line of this method
200
- const drawableFolders=[];
201
-
202
- drawableFolders.forEach((folder) => {
203
-
204
- const filePath = path.join(projectFolder, "android", "app", "src", "main", "res", folder, "splash.png");
205
- if (fs.existsSync(filePath)) {
206
- fs.unlinkSync(filePath);
207
- console.log(`Removed: ${filePath}`);
208
- } else {
209
- console.log(`Not found (skipped): ${filePath}`);
210
- }
211
- });
212
-
213
- }
214
-
215
- function removeOldSplashStyle() {
216
- const stylesPath = path.join(projectFolder, "android", "app", "src", "main", "res", "values", "styles.xml");
217
-
218
- if (!fs.existsSync(stylesPath)) {
219
- console.log(`styles.xml not found: ${stylesPath}`);
220
- return;
221
- }
222
-
223
- let content = fs.readFileSync(stylesPath, "utf-8");
224
-
225
- // Remove the <style name="AppTheme.NoActionBarLaunch">...</style> block
226
- const regex = /<style\s+name="AppTheme\.NoActionBarLaunch"[\s\S]*?<\/style>/g;
227
- if (regex.test(content)) {
228
- content = content.replace(regex, "");
229
- fs.writeFileSync(stylesPath, content, "utf-8");
230
- console.log("Removed AppTheme.NoActionBarLaunch from styles.xml");
231
- } else {
232
- console.log("AppTheme.NoActionBarLaunch style not found, skipped");
233
- }
234
- }
235
-
236
- // Perform the tasks
237
- try {
238
- console.log("Starting splash screen setup...");
239
- copyFile(sourceSplashIcon, destinationSplashIcon);
240
- copyFile(sourceSplashXML, destinationSplashXML);
241
- updateAndroidManifest();
242
- console.log("Splash screen setup completed.");
243
-
244
- console.log("Removing default splash.png files...");
245
- removeOldSplashImages()
246
- removeOldSplashStyle()
247
-
248
- } catch (error) {
249
- console.error(`Error: ${error.message}`);
250
- process.exit(1);
251
- }
252
-
253
-
254
-
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+ const { isStringObject } = require("util/types");
4
+
5
+ const configPath = path.join(process.cwd(), 'capacitor.config.json');
6
+
7
+ // Define file paths
8
+ const projectFolder = path.resolve(".");
9
+ const sourceSplashIcon = path.join(projectFolder, "resources", "splash_icon.png");
10
+ const destinationSplashIcon = path.join(
11
+ projectFolder,
12
+ "android",
13
+ "app",
14
+ "src",
15
+ "main",
16
+ "res",
17
+ "drawable-nodpi",
18
+ "splash_icon.png"
19
+ );
20
+
21
+
22
+
23
+
24
+
25
+ const appSplashXML = path.join(projectFolder, "buildCodeplay", "splashxml", "codeplay_splashScreen.xml");
26
+ const sourceSplashXML = fs.existsSync(appSplashXML) ? appSplashXML : path.join(__dirname, "splashxml", "codeplay_splashScreen.xml");
27
+ const destinationSplashXML = path.join(
28
+ projectFolder,
29
+ "android",
30
+ "app",
31
+ "src",
32
+ "main",
33
+ "res",
34
+ "values",
35
+ "codeplay_splashScreen.xml"
36
+ );
37
+ const androidManifestPath = path.join(
38
+ projectFolder,
39
+ "android",
40
+ "app",
41
+ "src",
42
+ "main",
43
+ "AndroidManifest.xml"
44
+ );
45
+
46
+ // Helper function to copy files
47
+ function copyFile(source, destination) {
48
+ if (!fs.existsSync(source)) {
49
+ throw new Error(`Source file not found: ${source}`);
50
+ }
51
+ fs.mkdirSync(path.dirname(destination), { recursive: true });
52
+ fs.copyFileSync(source, destination);
53
+ console.log(`Copied: ${source} -> ${destination}`);
54
+ }
55
+
56
+ // Helper function to update AndroidManifest.xml
57
+ function updateAndroidManifest() {
58
+ if (!fs.existsSync(androidManifestPath)) {
59
+ throw new Error(`AndroidManifest.xml not found: ${androidManifestPath}`);
60
+ }
61
+
62
+
63
+
64
+
65
+
66
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
67
+
68
+
69
+ let logErrorMessage="";
70
+
71
+ const RESIZEABLE_ACTIVITY = config.android?.RESIZEABLE_ACTIVITY;
72
+ const orientation = config.android?.ORIENTATION;
73
+
74
+ // 1️⃣ Check if it’s missing
75
+ if (RESIZEABLE_ACTIVITY === undefined) {
76
+ logErrorMessage+='❌ Missing android.RESIZEABLE_ACTIVITY option in capacitor.config.json.\n';
77
+ }
78
+
79
+ // 2️⃣ Check if it’s not boolean (true/false only)
80
+ else if (typeof RESIZEABLE_ACTIVITY !== 'boolean') {
81
+ logErrorMessage+='❌ Invalid android.RESIZEABLE_ACTIVITY value. Please use only true or false (without quotes).\n';
82
+ }
83
+
84
+
85
+
86
+ if (!orientation) {
87
+ logErrorMessage+='❌ Missing android.ORIENTATION option in capacitor.config.json.\n';
88
+ }
89
+
90
+ else if(orientation!="portrait" && orientation!="landscape" && orientation!="auto")
91
+ {
92
+ logErrorMessage+='❌ Spelling mistake in android.ORIENTATION option in capacitor.config.json. Please use only ["portrait" "landscape" "auto"]\n';
93
+ }
94
+
95
+ if(logErrorMessage!="")
96
+ {
97
+ console.error(logErrorMessage);
98
+ process.exit(1)
99
+ }
100
+
101
+
102
+ let manifestContent = fs.readFileSync(androidManifestPath, "utf-8");
103
+
104
+ manifestContent = manifestContent.replace(
105
+ /<activity[^>]*?>/,
106
+ (match) => {
107
+ let updated = match;
108
+
109
+ // If android:theme is already present, update it
110
+ if (updated.includes('android:theme=')) {
111
+ updated = updated.replace(
112
+ /android:theme="[^"]*"/,
113
+ 'android:theme="@style/Theme.Codeplay.SplashScreen"'
114
+ );
115
+ }
116
+
117
+ // If android:resizeableActivity is already present, update it
118
+ if (updated.includes('android:resizeableActivity=')) {
119
+ updated = updated.replace(
120
+ /android:resizeableActivity="[^"]*"/,
121
+ `android:resizeableActivity="${RESIZEABLE_ACTIVITY}"`
122
+ );
123
+ } else {
124
+ // Add resizeableActivity attribute
125
+ updated = updated.replace(`<activity`, `<activity android:resizeableActivity="${RESIZEABLE_ACTIVITY}"`);
126
+ }
127
+
128
+
129
+ //const admobConfig = getAdMobConfig();
130
+
131
+
132
+
133
+
134
+
135
+ if(orientation=="portrait"){
136
+ // If android:screenOrientation is already present, update it
137
+ if (updated.includes('android:screenOrientation=')) {
138
+ updated = updated.replace(
139
+ /android:screenOrientation="[^"]*"/,
140
+ 'android:screenOrientation="portrait"'
141
+ );
142
+ } else {
143
+ updated = updated.replace(
144
+ '<activity',
145
+ '<activity android:screenOrientation="portrait"'
146
+ );
147
+ }
148
+ }
149
+
150
+
151
+
152
+ if(orientation=="landscape"){
153
+ // If android:screenOrientation is already present, update it
154
+ if (updated.includes('android:screenOrientation=')) {
155
+ updated = updated.replace(
156
+ /android:screenOrientation="[^"]*"/,
157
+ 'android:screenOrientation="landscape"'
158
+ );
159
+ } else {
160
+ updated = updated.replace(
161
+ '<activity',
162
+ '<activity android:screenOrientation="landscape"'
163
+ );
164
+ }
165
+ }
166
+
167
+
168
+ if (orientation === "auto") {
169
+ // Remove android:screenOrientation attribute if present
170
+ updated = updated.replace(/\s*android:screenOrientation="[^"]*"/, '');
171
+ }
172
+
173
+
174
+
175
+ return updated;
176
+ }
177
+ );
178
+
179
+ fs.writeFileSync(androidManifestPath, manifestContent, "utf-8");
180
+ console.log(`Updated AndroidManifest.xml: ensured resizeableActivity="false" and updated theme if present.`);
181
+ }
182
+
183
+
184
+ function removeOldSplashImages() {
185
+ /* const drawableFolders = [
186
+ "drawable",
187
+ "drawable-land-hdpi",
188
+ "drawable-land-mdpi",
189
+ "drawable-land-xhdpi",
190
+ "drawable-land-xxhdpi",
191
+ "drawable-land-xxxhdpi",
192
+ "drawable-port-hdpi",
193
+ "drawable-port-mdpi",
194
+ "drawable-port-xhdpi",
195
+ "drawable-port-xxhdpi",
196
+ "drawable-port-xxxhdpi"
197
+ ]; */
198
+
199
+ //In previous build we have removed all splash image, but now it through error like splash.png missing, so we are not removing the splash screen
200
+ //If we want to remove, un comment the "const drawableFolders=.." first line of this method
201
+ const drawableFolders=[];
202
+
203
+ drawableFolders.forEach((folder) => {
204
+
205
+ const filePath = path.join(projectFolder, "android", "app", "src", "main", "res", folder, "splash.png");
206
+ if (fs.existsSync(filePath)) {
207
+ fs.unlinkSync(filePath);
208
+ console.log(`Removed: ${filePath}`);
209
+ } else {
210
+ console.log(`Not found (skipped): ${filePath}`);
211
+ }
212
+ });
213
+
214
+ }
215
+
216
+ function removeOldSplashStyle() {
217
+ const stylesPath = path.join(projectFolder, "android", "app", "src", "main", "res", "values", "styles.xml");
218
+
219
+ if (!fs.existsSync(stylesPath)) {
220
+ console.log(`styles.xml not found: ${stylesPath}`);
221
+ return;
222
+ }
223
+
224
+ let content = fs.readFileSync(stylesPath, "utf-8");
225
+
226
+ // Remove the <style name="AppTheme.NoActionBarLaunch">...</style> block
227
+ const regex = /<style\s+name="AppTheme\.NoActionBarLaunch"[\s\S]*?<\/style>/g;
228
+ if (regex.test(content)) {
229
+ content = content.replace(regex, "");
230
+ fs.writeFileSync(stylesPath, content, "utf-8");
231
+ console.log("Removed AppTheme.NoActionBarLaunch from styles.xml");
232
+ } else {
233
+ console.log("AppTheme.NoActionBarLaunch style not found, skipped");
234
+ }
235
+ }
236
+
237
+ // Perform the tasks
238
+ try {
239
+ console.log("Starting splash screen setup...");
240
+ copyFile(sourceSplashIcon, destinationSplashIcon);
241
+ copyFile(sourceSplashXML, destinationSplashXML);
242
+ updateAndroidManifest();
243
+ console.log("Splash screen setup completed.");
244
+
245
+ console.log("Removing default splash.png files...");
246
+ removeOldSplashImages()
247
+ removeOldSplashStyle()
248
+
249
+ } catch (error) {
250
+ console.error(`Error: ${error.message}`);
251
+ process.exit(1);
252
+ }
253
+
254
+
255
+