codeplay-common 4.11.35 → 4.11.37

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 (50) hide show
  1. package/CHANGELOG.md +115 -115
  2. package/LICENSE +21 -21
  3. package/README.md +380 -374
  4. package/RELEASE_NOTES.md +110 -110
  5. package/files/buildCodeplay/HUAWEI-PRIVACY.md +9 -9
  6. package/files/buildCodeplay/add-splash-screen.js +256 -256
  7. package/files/buildCodeplay/apk-store-builder.js +97 -97
  8. package/files/buildCodeplay/codeplayBeforeBuild.js +4793 -4793
  9. package/files/buildCodeplay/disabled-ads.mjs +53 -53
  10. package/files/buildCodeplay/fix-onesignal-plugin.js +96 -96
  11. package/files/buildCodeplay/fix-optimize-builld/android-r8-rules.cjs +31 -31
  12. package/files/buildCodeplay/fix-optimize-builld/ffmpeg-jni-rules.cjs +28 -28
  13. package/files/buildCodeplay/fix-optimize-builld/fix-optimize-build.gradle +9 -9
  14. package/files/buildCodeplay/fix-optimize-builld/restore-android-r8-rules.cjs +30 -30
  15. package/files/buildCodeplay/huawei-privacy.cjs +102 -92
  16. package/files/buildCodeplay/iap-alias.cjs +116 -116
  17. package/files/buildCodeplay/ios-emi-admob-modification.js +24 -24
  18. package/files/buildCodeplay/manifestModification.js +38 -38
  19. package/files/buildCodeplay/migrate-system-bars.cjs +122 -122
  20. package/files/buildCodeplay/packageidBaseModification.js +528 -528
  21. package/files/buildCodeplay/project-scripts.cjs +69 -69
  22. package/files/buildCodeplay/ruads.cjs +10 -1
  23. package/files/buildCodeplay/setSplashAnimation.js +228 -228
  24. package/files/buildCodeplay/setup-ruads.cjs +9 -2
  25. package/files/buildCodeplay/splash-setup.cjs +88 -88
  26. package/files/buildCodeplay/splashxml/codeplay_splashScreen.xml +11 -11
  27. package/files/buildCodeplay/sync-admob-nextgen.js +219 -219
  28. package/files/buildCodeplay/tests/huawei-live-reload.test.cjs +60 -0
  29. package/files/buildCodeplay/tests/huawei-multiple-entries.test.cjs +80 -0
  30. package/files/buildCodeplay/tests/huawei-vite.test.cjs +38 -35
  31. package/files/buildCodeplay/versions.json +28 -28
  32. package/files/finalrelease +1365 -1365
  33. package/files/generate-ai-promo-video.js +23 -23
  34. package/files/ionic.config.json +6 -6
  35. package/files/scripts-common/run-codeplay-sync-after.js +21 -21
  36. package/files/scripts-common/screenshot/background-decorations.js +120 -120
  37. package/files/scripts-common/screenshot/frame-samples.js +117 -117
  38. package/files/scripts-common/setup-baseline-profile.js +291 -291
  39. package/files/take-screen-video.js +644 -644
  40. package/package.json +29 -29
  41. package/runtime/splash-ready.mjs +52 -52
  42. package/scripts/iap-alias.test.cjs +117 -117
  43. package/scripts/ruads-install.test.cjs +20 -3
  44. package/scripts/splash-setup.test.cjs +142 -142
  45. package/scripts/squeezeback-config.test.cjs +78 -78
  46. package/scripts/sync-files.js +119 -119
  47. package/scripts/system-bars-package.test.cjs +38 -38
  48. package/scripts/system-bars.test.cjs +93 -93
  49. package/scripts/uninstall.js +2 -2
  50. package/scripts/vite-build-settings.test.cjs +1 -0
@@ -1,256 +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
- 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
-
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
+