codeplay-common 1.8.4 → 1.8.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.
|
@@ -108,7 +108,14 @@ if (editorDirs.length === 0) {
|
|
|
108
108
|
}
|
|
109
109
|
else
|
|
110
110
|
{
|
|
111
|
-
|
|
111
|
+
|
|
112
|
+
const latestEditorDir = editorDirs.sort((a, b) => {
|
|
113
|
+
const versionA = parseFloat(a.split('-')[1]);
|
|
114
|
+
const versionB = parseFloat(b.split('-')[1]);
|
|
115
|
+
return versionB - versionA;
|
|
116
|
+
})[0];
|
|
117
|
+
|
|
118
|
+
//const latestEditorDir = editorDirs[editorDirs.length - 1];
|
|
112
119
|
const runJsPath = path.join(baseDir, latestEditorDir, "run.js");
|
|
113
120
|
|
|
114
121
|
if (!fs.existsSync(runJsPath)) {
|
|
@@ -600,7 +607,8 @@ function validateAndroidBuildOptions() {
|
|
|
600
607
|
"com.HTML.AngularJS.Codeplay",
|
|
601
608
|
"com.html.codeplay.pro",
|
|
602
609
|
"com.bootstrap.code.play",
|
|
603
|
-
"com.kids.learning.master"
|
|
610
|
+
"com.kids.learning.master",
|
|
611
|
+
"com.Simple.Barcode.Scanner"
|
|
604
612
|
]
|
|
605
613
|
};
|
|
606
614
|
|
package/files/finalrelease21
CHANGED
|
@@ -242,33 +242,62 @@ const addPermission_AD_ID=async()=>{
|
|
|
242
242
|
isAdmobFound = false;
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
+
|
|
245
246
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
247
|
+
if (isAdmobFound) {
|
|
248
|
+
if (existsSync(androidManifestPath)) {
|
|
249
|
+
let manifestContent = readFileSync(androidManifestPath, 'utf8');
|
|
250
|
+
let modified = false;
|
|
251
|
+
|
|
252
|
+
// --- Step 1: Ensure AD_ID permission exists ---
|
|
253
|
+
const adIdPermission = '<uses-permission android:name="com.google.android.gms.permission.AD_ID" />';
|
|
254
|
+
if (!manifestContent.includes(adIdPermission)) {
|
|
255
|
+
console.log("📄 AD_ID permission not found. Adding to AndroidManifest.xml.");
|
|
256
|
+
manifestContent = manifestContent.replace('</manifest>', ` ${adIdPermission}\n</manifest>`);
|
|
257
|
+
console.log("✅ AD_ID permission added successfully.");
|
|
258
|
+
modified = true;
|
|
259
|
+
} else {
|
|
260
|
+
console.log("ℹ️ AD_ID permission already exists in AndroidManifest.xml.");
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// --- Step 2: Ensure OPTIMIZE_AD_LOADING meta-data exists ---
|
|
264
|
+
const optimizeAdMeta = `<meta-data android:name="com.google.android.gms.ads.flag.OPTIMIZE_AD_LOADING" android:value="true" />`;
|
|
265
|
+
|
|
266
|
+
if (!manifestContent.includes(optimizeAdMeta)) {
|
|
267
|
+
console.log("📄 OPTIMIZE_AD_LOADING meta-data not found. Adding to AndroidManifest.xml.");
|
|
268
|
+
|
|
269
|
+
const appTagPattern = /<application[^>]*>/;
|
|
270
|
+
if (appTagPattern.test(manifestContent)) {
|
|
271
|
+
manifestContent = manifestContent.replace(appTagPattern, match => `${match}\n ${optimizeAdMeta}`);
|
|
272
|
+
console.log("✅ OPTIMIZE_AD_LOADING meta-data added successfully.");
|
|
273
|
+
modified = true;
|
|
263
274
|
} else {
|
|
264
|
-
console.
|
|
275
|
+
console.error("❌ <application> tag not found in AndroidManifest.xml.");
|
|
265
276
|
}
|
|
266
277
|
} else {
|
|
267
|
-
console.
|
|
278
|
+
console.log("ℹ️ OPTIMIZE_AD_LOADING meta-data already exists in AndroidManifest.xml.");
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// --- Step 3: Write only if modified ---
|
|
282
|
+
if (modified) {
|
|
283
|
+
writeFileSync(androidManifestPath, manifestContent, 'utf8');
|
|
284
|
+
console.log("💾 AndroidManifest.xml updated successfully.");
|
|
285
|
+
} else {
|
|
286
|
+
console.log("✅ No changes needed. AndroidManifest.xml is up to date.");
|
|
268
287
|
}
|
|
288
|
+
|
|
269
289
|
} else {
|
|
270
|
-
console.
|
|
290
|
+
console.error("❌ AndroidManifest.xml not found at the specified path.");
|
|
271
291
|
}
|
|
292
|
+
} else {
|
|
293
|
+
console.log("\x1b[33m%s\x1b[0m", "⚠️ No AdMob found, so AD_ID permission and meta-data were not added");
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
272
301
|
}
|
|
273
302
|
|
|
274
303
|
|