codeplay-common 4.10.4 → 4.10.6

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/RELEASE_NOTES.md CHANGED
@@ -1,65 +1,75 @@
1
- # Release notes
2
-
3
- ## 4.10.4 — 2026-10-23
4
-
5
- Version name: 4.10.4. Version code/build number: not applicable to this npm package.
6
-
7
- Files changed: `package.json`, `files/scripts-common/run-codeplay-sync-after.js`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
8
-
9
- - Fix Android sync failures caused by the old versioned splash script lookup.
10
- - Use the migrated baseline profile setup path.
11
- - Update the custom sync hook automatically during plugin installation.
12
-
13
- ## 4.10.3 — 2026-10-23
14
-
15
- Version name: 4.10.3. Version code/build number: not applicable to this npm package.
16
-
17
- Files changed: `package.json`, `files/finalrelease`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
18
-
19
- - Release ad-free apps without adding an unnecessary AdMob alias or controller.
20
- - Explicitly set `plugins.AdMob.ADMOB_ENABLED` to `false` to use the ad-free release path.
21
- - Keep production AdMob safety checks for apps with advertising enabled.
22
-
23
- ## 4.10.0 — 2026-10-23
24
-
25
- Version name: 4.10.0. Version code/build number: not applicable to this npm package.
26
- Bundled pre-build script: 6.7.
27
-
28
- 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`.
29
-
30
- - Copy shared build scripts and the versions manifest into each app; run local scripts with unversioned filenames.
31
- - Rename app helper scripts to scripts-common automatically, migrate command paths, and preserve existing files without overwriting folder conflicts.
32
- - Migrate app build/store/sync paths automatically and remove only superseded versioned helpers; preserve app-owned configuration and screenshot data.
33
- - Resolve app sources/native targets from the consuming app directory while keeping bundled assets inside the plugin.
34
- - Download IAP and AdMob directly from htmlcodeplay.com, without bundling archives or adding a separate fallback.
35
- - Automatically migrate deferred ownership verification, purchase-safe advertising, and Home Pro visibility according to each store IAP flag.
36
- - Copy the full finalrelease implementation so it can be tested from the application folder.
37
- - Preserve working files during preinstall and avoid downgrading local/newer plugin installations to an older registry release.
38
-
39
- ## 4.9.8 — 2026-10-22
40
-
41
- Version name: 4.9.8. Version code/build number: not applicable to this npm package.
42
- Bundled pre-build script: 6.5.
43
-
44
- 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`.
45
-
46
- - Install AdMob as `src/js/Ads/admob-nextgen-4.0/` with stable `admob-emi-nextgen.js` and `app-open-state.js` filenames.
47
- - Automatically migrate loose-file references, folder references and Vite aliases during installation and before builds.
48
- - Preserve app-owned ad configuration and select each app's existing IAP analytics module.
49
- - Download every AdMob folder ZIP from htmlcodeplay.com; no AdMob archive is included in this npm package.
50
- - Validate ZIP contents before switching imports; retain the working package when a remote update fails.
51
- - Validate the selected folder controller during final-release checks while continuing to reject test aliases.
52
-
53
- ## 4.7.7 — 2026-10-07
54
-
55
- Version name: 4.7.7. Version code/build number: not applicable to this npm package.
56
-
57
- Files changed: `package.json`, `scripts/sync-files.js`, `files/buildCodeplay/codeplayBeforeBuild-6.4.js`
58
- (replaces `codeplayBeforeBuild-6.3.js`), `README.md`, `CHANGELOG.md`, `RELEASE_NOTES.md`.
59
-
60
- - Installation automatically configures Android and iOS build commands in your app's `package.json`.
61
- - Android builds remain the default; use `npm run build:ios` for iOS.
62
- - Save-gallery imports use one alias with a platform-specific helper and a clear confirmation before source changes.
63
- - Shared checks reuse file traversal to reduce repeated scanning.
64
- - Builds warn and automatically uninstall the retired OneSignal Cordova plugin when found.
65
- - `agent-temp/` stays ignored, while `buildCodeplay/` is removed from ignore rules.
1
+ # Release notes
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.
@@ -1,255 +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 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
-
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
+