codeplay-common 1.4.5 → 1.4.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.
|
@@ -473,6 +473,8 @@ function checkAndCopyResources() {
|
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
475
|
|
|
476
|
+
|
|
477
|
+
|
|
476
478
|
function getAdMobConfig() {
|
|
477
479
|
if (!fileExists(configPath)) {
|
|
478
480
|
throw new Error('capacitor.config.json not found. Ensure this is a Capacitor project.');
|
|
@@ -481,11 +483,23 @@ function getAdMobConfig() {
|
|
|
481
483
|
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
482
484
|
const admobConfig = config.plugins?.AdMob;
|
|
483
485
|
|
|
484
|
-
if (!admobConfig
|
|
485
|
-
throw new Error('AdMob configuration is missing in capacitor.config.json.
|
|
486
|
+
if (!admobConfig) {
|
|
487
|
+
throw new Error('AdMob configuration is missing in capacitor.config.json.');
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
// Default to true if ADMOB_ENABLED is not specified
|
|
491
|
+
const isEnabled = admobConfig.ADMOB_ENABLED !== false;
|
|
492
|
+
|
|
493
|
+
if (!isEnabled) {
|
|
494
|
+
return { ADMOB_ENABLED: false }; // Skip further validation
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
if (!admobConfig.APP_ID_ANDROID || !admobConfig.APP_ID_IOS) {
|
|
498
|
+
throw new Error('AdMob configuration is incomplete. Ensure APP_ID_ANDROID and APP_ID_IOS are defined.');
|
|
486
499
|
}
|
|
487
500
|
|
|
488
501
|
return {
|
|
502
|
+
ADMOB_ENABLED: true,
|
|
489
503
|
APP_ID_ANDROID: admobConfig.APP_ID_ANDROID,
|
|
490
504
|
APP_ID_IOS: admobConfig.APP_ID_IOS,
|
|
491
505
|
USE_LITE_ADS: admobConfig.USE_LITE_ADS === "lite",
|
|
@@ -538,14 +552,20 @@ try {
|
|
|
538
552
|
checkAndCopyResources();
|
|
539
553
|
|
|
540
554
|
const admobConfig = getAdMobConfig();
|
|
555
|
+
|
|
541
556
|
|
|
542
|
-
if
|
|
543
|
-
|
|
544
|
-
|
|
557
|
+
// Proceed only if ADMOB_ENABLED is true
|
|
558
|
+
if (admobConfig.ADMOB_ENABLED) {
|
|
559
|
+
if (fileExists(androidPlatformPath)) {
|
|
560
|
+
updatePluginXml(admobConfig);
|
|
561
|
+
}
|
|
545
562
|
|
|
546
|
-
|
|
547
|
-
|
|
563
|
+
if (fileExists(iosPlatformPath)) {
|
|
564
|
+
updateInfoPlist(admobConfig);
|
|
565
|
+
}
|
|
548
566
|
}
|
|
567
|
+
|
|
568
|
+
|
|
549
569
|
} catch (error) {
|
|
550
570
|
console.error(error.message);
|
|
551
571
|
process.exit(1); // Stop execution if there's a critical error
|