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 +16 -0
- package/README.md +24 -10
- package/RELEASE_NOTES.md +16 -0
- package/files/buildCodeplay/{add-splash-screen-1.6.js → add-splash-screen.js} +255 -254
- package/files/buildCodeplay/apk-store-builder.js +97 -97
- package/files/buildCodeplay/{codeplayBeforeBuild-6.5.js → codeplayBeforeBuild.js} +160 -80
- package/files/buildCodeplay/fix-onesignal-plugin.js +96 -96
- package/files/buildCodeplay/ios-emi-admob-modification.js +24 -24
- package/files/buildCodeplay/manifestModification.js +23 -23
- package/files/buildCodeplay/{packageidBaseModification-1.4.js → packageidBaseModification.js} +445 -445
- package/files/buildCodeplay/project-scripts.cjs +56 -0
- package/files/buildCodeplay/{setSplashAnimation-1.4.js → setSplashAnimation.js} +156 -156
- package/files/buildCodeplay/sync-admob-nextgen.js +6 -5
- package/files/buildCodeplay/versions.json +2 -2
- package/files/finalrelease +1222 -1343
- package/files/take-screen-image.js +2 -2
- package/package.json +14 -5
- package/scripts/sync-files.js +80 -112
- package/scripts/uninstall.js +3 -123
- package/.gitattributes +0 -2
- package/files/buildCodeplay/codeplayBeforeBuild-6.4.js +0 -4510
- package/files/iap-install-2.js +0 -145
- /package/files/{scripts → scripts-common}/screenshot/background-decorations.js +0 -0
- /package/files/{scripts → scripts-common}/screenshot/frame-samples.js +0 -0
- /package/files/{scripts → scripts-common}/setup-baseline-profile.js +0 -0
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
|
-
##
|
|
12
|
+
## App helper folder
|
|
13
13
|
|
|
14
|
-
|
|
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
|
-
|
|
16
|
+
## Shared unversioned build files (4.10.0)
|
|
17
17
|
|
|
18
|
-
|
|
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
|
|
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
|
-
|
|
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.
|
|
41
|
-
|
|
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
|
|
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
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
function
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
fs.
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
function
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
'<activity
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
'<activity
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
"drawable
|
|
187
|
-
"drawable-land-
|
|
188
|
-
"drawable-land-
|
|
189
|
-
"drawable-land-
|
|
190
|
-
"drawable-land-
|
|
191
|
-
"drawable-
|
|
192
|
-
"drawable-port-
|
|
193
|
-
"drawable-port-
|
|
194
|
-
"drawable-port-
|
|
195
|
-
"drawable-port-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
//
|
|
200
|
-
const drawableFolders
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
copyFile(
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
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
|
+
|