codeplay-common 1.4.8 → 1.5.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.
|
@@ -6,7 +6,7 @@ const plist = require('plist');
|
|
|
6
6
|
// Expected plugin list with minimum versions
|
|
7
7
|
const requiredPlugins = [
|
|
8
8
|
{ pattern: /backbutton-(\d+\.\d+)\.js$/, minVersion: '1.1', required: true },
|
|
9
|
-
{ pattern: /common-(\d+\.\d+)\.js$/, minVersion: '3.
|
|
9
|
+
{ pattern: /common-(\d+\.\d+)\.js$/, minVersion: '3.4', required: true },
|
|
10
10
|
{ pattern: /localization_settings-(\d+\.\d+)\.js$/, minVersion: '1.1', required: true },
|
|
11
11
|
{ pattern: /localization-(\d+\.\d+)\.js$/, minVersion: '1.2', required: true },
|
|
12
12
|
{ pattern: /localNotification-(\d+\.\d+)\.js$/, minVersion: '2.2', required: true },
|
|
@@ -15,17 +15,89 @@ const amazonMinSdkVersion=23;
|
|
|
15
15
|
const androidManifestPath = path.join("android", "app", "src", "main", "AndroidManifest.xml");
|
|
16
16
|
|
|
17
17
|
|
|
18
|
+
function fileExists(filePath) {
|
|
19
|
+
return fs.existsSync(filePath);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
const capacitorConfigPath = path.join(process.cwd(), 'capacitor.config.json');
|
|
24
|
+
|
|
25
|
+
function getAdMobConfig() {
|
|
26
|
+
if (!fileExists(capacitorConfigPath)) {
|
|
27
|
+
throw new Error('❌ capacitor.config.json not found. Ensure this is a Capacitor project.');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const config = JSON.parse(fs.readFileSync(capacitorConfigPath, 'utf8'));
|
|
31
|
+
const admobConfig = config.plugins?.AdMob;
|
|
32
|
+
|
|
33
|
+
if (!admobConfig) {
|
|
34
|
+
throw new Error('❌ AdMob configuration is missing in capacitor.config.json.');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Default to true if ADMOB_ENABLED is not specified
|
|
38
|
+
const isEnabled = admobConfig.ADMOB_ENABLED !== false;
|
|
39
|
+
|
|
40
|
+
if (!isEnabled) {
|
|
41
|
+
return { ADMOB_ENABLED: false }; // Skip further validation
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (!admobConfig.APP_ID_ANDROID || !admobConfig.APP_ID_IOS) {
|
|
45
|
+
throw new Error(' ❌ AdMob configuration is incomplete. Ensure APP_ID_ANDROID and APP_ID_IOS are defined.');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
ADMOB_ENABLED: true,
|
|
50
|
+
APP_ID_ANDROID: admobConfig.APP_ID_ANDROID,
|
|
51
|
+
APP_ID_IOS: admobConfig.APP_ID_IOS,
|
|
52
|
+
USE_LITE_ADS: admobConfig.USE_LITE_ADS === "lite",
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
const _capacitorConfig = getAdMobConfig();
|
|
59
|
+
|
|
60
|
+
const _isADMOB_ENABLED=_capacitorConfig.ADMOB_ENABLED;
|
|
61
|
+
|
|
62
|
+
// Proceed only if ADMOB_ENABLED is true
|
|
63
|
+
//if (_capacitorConfig.ADMOB_ENABLED)
|
|
64
|
+
|
|
18
65
|
|
|
19
66
|
const admobConfigPath = path.join('src', 'js','Ads', 'admob-ad-configuration.json');
|
|
20
67
|
let admobConfig;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
68
|
+
|
|
69
|
+
if (_isADMOB_ENABLED)
|
|
70
|
+
{
|
|
71
|
+
try
|
|
72
|
+
{
|
|
73
|
+
admobConfig = JSON.parse(fs.readFileSync(admobConfigPath, 'utf8'));
|
|
74
|
+
}
|
|
75
|
+
catch (err)
|
|
76
|
+
{
|
|
77
|
+
console.error("❌ Failed to read admob-ad-configuration.json", err);
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
26
80
|
}
|
|
27
81
|
|
|
28
82
|
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
29
101
|
|
|
30
102
|
|
|
31
103
|
const checkCommonFileStoreId=()=>{
|
|
@@ -187,17 +259,33 @@ const addPermission_AD_ID=()=>{
|
|
|
187
259
|
}
|
|
188
260
|
|
|
189
261
|
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
190
271
|
checkCommonFileStoreId();
|
|
191
|
-
|
|
192
|
-
|
|
272
|
+
|
|
273
|
+
let isAdmobFound = false;
|
|
274
|
+
|
|
275
|
+
if (_isADMOB_ENABLED)
|
|
276
|
+
{
|
|
277
|
+
checkIsTestingInAdmob();
|
|
278
|
+
checkIsAdsDisableByReturnStatement()
|
|
279
|
+
|
|
280
|
+
addPermission_AD_ID()
|
|
281
|
+
}
|
|
282
|
+
|
|
193
283
|
|
|
194
284
|
|
|
195
|
-
let isAdmobFound = true;
|
|
196
|
-
addPermission_AD_ID()
|
|
197
285
|
|
|
198
286
|
|
|
199
287
|
|
|
200
|
-
const { playstore, samsung, amazon } = admobConfig.IAP;
|
|
288
|
+
const { playstore, samsung, amazon } = (_isADMOB_ENABLED && admobConfig.IAP) ? admobConfig.IAP : { playstore: false, samsung: false, amazon: false };
|
|
201
289
|
console.log(`ℹ️ IAP Configurations - PlayStore: ${playstore}, Samsung: ${samsung}, Amazon: ${amazon}`);
|
|
202
290
|
|
|
203
291
|
|