codeplay-common 4.11.12 → 4.11.14

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +114 -101
  2. package/LICENSE +21 -21
  3. package/README.md +274 -229
  4. package/RELEASE_NOTES.md +110 -97
  5. package/files/buildCodeplay/add-splash-screen.js +256 -255
  6. package/files/buildCodeplay/apk-store-builder.js +97 -97
  7. package/files/buildCodeplay/codeplayBeforeBuild.js +45 -43
  8. package/files/buildCodeplay/ensure-current-build.cjs +42 -42
  9. package/files/buildCodeplay/fix-onesignal-plugin.js +96 -96
  10. package/files/buildCodeplay/ios-emi-admob-modification.js +49 -49
  11. package/files/buildCodeplay/manifestModification.js +38 -38
  12. package/files/buildCodeplay/newly added.txt +89 -89
  13. package/files/buildCodeplay/release-sync.config.json +4 -4
  14. package/files/buildCodeplay/remove-force-kotlin-disable.js +43 -43
  15. package/files/buildCodeplay/setSplashAnimation.js +227 -225
  16. package/files/buildCodeplay/splash-setup.cjs +88 -0
  17. package/files/buildCodeplay/splashxml/codeplay_splashScreen.xml +1 -1
  18. package/files/buildCodeplay/sync-admob-nextgen.js +219 -219
  19. package/files/buildCodeplay/versions.json +27 -27
  20. package/files/finalrelease +1263 -1263
  21. package/files/generate-ai-promo-video.js +23 -23
  22. package/files/ionic.config.json +6 -6
  23. package/files/scripts-common/generate-baseline-profile.js +46 -46
  24. package/files/scripts-common/run-codeplay-sync-after.js +21 -21
  25. package/files/scripts-common/screenshot/background-decorations.js +120 -120
  26. package/files/scripts-common/screenshot/frame-samples.js +117 -117
  27. package/files/scripts-common/setup-baseline-profile.js +291 -291
  28. package/files/take-screen-video.js +644 -644
  29. package/package.json +3 -2
  30. package/runtime/splash-ready.mjs +52 -0
  31. package/scripts/ensure-current-build.test.cjs +76 -76
  32. package/scripts/splash-setup.test.cjs +142 -0
  33. package/scripts/sync-files.js +114 -113
  34. package/scripts/uninstall.js +2 -2
@@ -1,255 +1,256 @@
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
+ require('./splash-setup.cjs').syncSplashSetup(projectFolder);
27
+ const sourceSplashXML = fs.existsSync(appSplashXML) ? appSplashXML : path.join(__dirname, "splashxml", "codeplay_splashScreen.xml");
28
+ const destinationSplashXML = path.join(
29
+ projectFolder,
30
+ "android",
31
+ "app",
32
+ "src",
33
+ "main",
34
+ "res",
35
+ "values",
36
+ "codeplay_splashScreen.xml"
37
+ );
38
+ const androidManifestPath = path.join(
39
+ projectFolder,
40
+ "android",
41
+ "app",
42
+ "src",
43
+ "main",
44
+ "AndroidManifest.xml"
45
+ );
46
+
47
+ // Helper function to copy files
48
+ function copyFile(source, destination) {
49
+ if (!fs.existsSync(source)) {
50
+ throw new Error(`Source file not found: ${source}`);
51
+ }
52
+ fs.mkdirSync(path.dirname(destination), { recursive: true });
53
+ fs.copyFileSync(source, destination);
54
+ console.log(`Copied: ${source} -> ${destination}`);
55
+ }
56
+
57
+ // Helper function to update AndroidManifest.xml
58
+ function updateAndroidManifest() {
59
+ if (!fs.existsSync(androidManifestPath)) {
60
+ throw new Error(`AndroidManifest.xml not found: ${androidManifestPath}`);
61
+ }
62
+
63
+
64
+
65
+
66
+
67
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
68
+
69
+
70
+ let logErrorMessage="";
71
+
72
+ const RESIZEABLE_ACTIVITY = config.android?.RESIZEABLE_ACTIVITY;
73
+ const orientation = config.android?.ORIENTATION;
74
+
75
+ // 1️⃣ Check if it’s missing
76
+ if (RESIZEABLE_ACTIVITY === undefined) {
77
+ logErrorMessage+='❌ Missing android.RESIZEABLE_ACTIVITY option in capacitor.config.json.\n';
78
+ }
79
+
80
+ // 2️⃣ Check if it’s not boolean (true/false only)
81
+ else if (typeof RESIZEABLE_ACTIVITY !== 'boolean') {
82
+ logErrorMessage+='❌ Invalid android.RESIZEABLE_ACTIVITY value. Please use only true or false (without quotes).\n';
83
+ }
84
+
85
+
86
+
87
+ if (!orientation) {
88
+ logErrorMessage+='❌ Missing android.ORIENTATION option in capacitor.config.json.\n';
89
+ }
90
+
91
+ else if(orientation!="portrait" && orientation!="landscape" && orientation!="auto")
92
+ {
93
+ logErrorMessage+='❌ Spelling mistake in android.ORIENTATION option in capacitor.config.json. Please use only ["portrait" "landscape" "auto"]\n';
94
+ }
95
+
96
+ if(logErrorMessage!="")
97
+ {
98
+ console.error(logErrorMessage);
99
+ process.exit(1)
100
+ }
101
+
102
+
103
+ let manifestContent = fs.readFileSync(androidManifestPath, "utf-8");
104
+
105
+ manifestContent = manifestContent.replace(
106
+ /<activity[^>]*?>/,
107
+ (match) => {
108
+ let updated = match;
109
+
110
+ // If android:theme is already present, update it
111
+ if (updated.includes('android:theme=')) {
112
+ updated = updated.replace(
113
+ /android:theme="[^"]*"/,
114
+ 'android:theme="@style/Theme.Codeplay.SplashScreen"'
115
+ );
116
+ }
117
+
118
+ // If android:resizeableActivity is already present, update it
119
+ if (updated.includes('android:resizeableActivity=')) {
120
+ updated = updated.replace(
121
+ /android:resizeableActivity="[^"]*"/,
122
+ `android:resizeableActivity="${RESIZEABLE_ACTIVITY}"`
123
+ );
124
+ } else {
125
+ // Add resizeableActivity attribute
126
+ updated = updated.replace(`<activity`, `<activity android:resizeableActivity="${RESIZEABLE_ACTIVITY}"`);
127
+ }
128
+
129
+
130
+ //const admobConfig = getAdMobConfig();
131
+
132
+
133
+
134
+
135
+
136
+ if(orientation=="portrait"){
137
+ // If android:screenOrientation is already present, update it
138
+ if (updated.includes('android:screenOrientation=')) {
139
+ updated = updated.replace(
140
+ /android:screenOrientation="[^"]*"/,
141
+ 'android:screenOrientation="portrait"'
142
+ );
143
+ } else {
144
+ updated = updated.replace(
145
+ '<activity',
146
+ '<activity android:screenOrientation="portrait"'
147
+ );
148
+ }
149
+ }
150
+
151
+
152
+
153
+ if(orientation=="landscape"){
154
+ // If android:screenOrientation is already present, update it
155
+ if (updated.includes('android:screenOrientation=')) {
156
+ updated = updated.replace(
157
+ /android:screenOrientation="[^"]*"/,
158
+ 'android:screenOrientation="landscape"'
159
+ );
160
+ } else {
161
+ updated = updated.replace(
162
+ '<activity',
163
+ '<activity android:screenOrientation="landscape"'
164
+ );
165
+ }
166
+ }
167
+
168
+
169
+ if (orientation === "auto") {
170
+ // Remove android:screenOrientation attribute if present
171
+ updated = updated.replace(/\s*android:screenOrientation="[^"]*"/, '');
172
+ }
173
+
174
+
175
+
176
+ return updated;
177
+ }
178
+ );
179
+
180
+ fs.writeFileSync(androidManifestPath, manifestContent, "utf-8");
181
+ console.log(`Updated AndroidManifest.xml: ensured resizeableActivity="false" and updated theme if present.`);
182
+ }
183
+
184
+
185
+ function removeOldSplashImages() {
186
+ /* const drawableFolders = [
187
+ "drawable",
188
+ "drawable-land-hdpi",
189
+ "drawable-land-mdpi",
190
+ "drawable-land-xhdpi",
191
+ "drawable-land-xxhdpi",
192
+ "drawable-land-xxxhdpi",
193
+ "drawable-port-hdpi",
194
+ "drawable-port-mdpi",
195
+ "drawable-port-xhdpi",
196
+ "drawable-port-xxhdpi",
197
+ "drawable-port-xxxhdpi"
198
+ ]; */
199
+
200
+ //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
201
+ //If we want to remove, un comment the "const drawableFolders=.." first line of this method
202
+ const drawableFolders=[];
203
+
204
+ drawableFolders.forEach((folder) => {
205
+
206
+ const filePath = path.join(projectFolder, "android", "app", "src", "main", "res", folder, "splash.png");
207
+ if (fs.existsSync(filePath)) {
208
+ fs.unlinkSync(filePath);
209
+ console.log(`Removed: ${filePath}`);
210
+ } else {
211
+ console.log(`Not found (skipped): ${filePath}`);
212
+ }
213
+ });
214
+
215
+ }
216
+
217
+ function removeOldSplashStyle() {
218
+ const stylesPath = path.join(projectFolder, "android", "app", "src", "main", "res", "values", "styles.xml");
219
+
220
+ if (!fs.existsSync(stylesPath)) {
221
+ console.log(`styles.xml not found: ${stylesPath}`);
222
+ return;
223
+ }
224
+
225
+ let content = fs.readFileSync(stylesPath, "utf-8");
226
+
227
+ // Remove the <style name="AppTheme.NoActionBarLaunch">...</style> block
228
+ const regex = /<style\s+name="AppTheme\.NoActionBarLaunch"[\s\S]*?<\/style>/g;
229
+ if (regex.test(content)) {
230
+ content = content.replace(regex, "");
231
+ fs.writeFileSync(stylesPath, content, "utf-8");
232
+ console.log("Removed AppTheme.NoActionBarLaunch from styles.xml");
233
+ } else {
234
+ console.log("AppTheme.NoActionBarLaunch style not found, skipped");
235
+ }
236
+ }
237
+
238
+ // Perform the tasks
239
+ try {
240
+ console.log("Starting splash screen setup...");
241
+ copyFile(sourceSplashIcon, destinationSplashIcon);
242
+ copyFile(sourceSplashXML, destinationSplashXML);
243
+ updateAndroidManifest();
244
+ console.log("Splash screen setup completed.");
245
+
246
+ console.log("Removing default splash.png files...");
247
+ removeOldSplashImages()
248
+ removeOldSplashStyle()
249
+
250
+ } catch (error) {
251
+ console.error(`Error: ${error.message}`);
252
+ process.exit(1);
253
+ }
254
+
255
+
256
+