codeplay-common 1.7.2 → 1.7.3

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.
@@ -497,6 +497,83 @@ function getAdMobConfig() {
497
497
  };
498
498
  }
499
499
 
500
+ function validateAndroidBuildOptions() {
501
+
502
+
503
+ if (!fileExists(configPath)) {
504
+ console.log('❌ capacitor.config.json not found. Ensure this is a Capacitor project.');
505
+ process.exit(1);
506
+ }
507
+
508
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
509
+
510
+ const targetAppId=config.appId
511
+
512
+ const buildOptions = config.android?.buildOptions;
513
+
514
+ /* if (!buildOptions) {
515
+ console.log('❌ Missing android.buildOptions in capacitor.config.json.');
516
+ process.exit(1);
517
+ } */
518
+
519
+ const requiredProps = [
520
+ 'keystorePath',
521
+ 'keystorePassword',
522
+ 'keystoreAlias',
523
+ 'keystoreAliasPassword',
524
+ 'releaseType',
525
+ 'signingType'
526
+ ];
527
+
528
+ const missing = requiredProps.filter(prop => !buildOptions[prop]);
529
+
530
+ if (missing.length > 0) {
531
+ console.log('❌ Missing android.buildOptions in capacitor.config.json.');
532
+ process.exit(1);
533
+ }
534
+
535
+ debugger;
536
+ const keystorePath=buildOptions.keystorePath
537
+ const keyFileName = path.basename(keystorePath);
538
+
539
+
540
+
541
+ const keystoreMap = {
542
+ "gameskey.jks": [
543
+ "com.cube.blaster",
544
+ "com.simple.barcodescanner",
545
+ "com.kids.app"
546
+ ],
547
+ "htmleditorkeystoke.jks": [
548
+ "com.HTML.AngularJS.Codeplay",
549
+ "com.html.codeplay.pro",
550
+ "com.bootstrap.code.play"
551
+ ]
552
+ };
553
+
554
+ // find which keystore is required for the given targetAppId
555
+ let requiredKey = "newappskey.jks"; // default
556
+ for (const [keyFile, appIds] of Object.entries(keystoreMap)) {
557
+ if (appIds.includes(targetAppId)) {
558
+ requiredKey = keyFile;
559
+ break;
560
+ }
561
+ }
562
+
563
+ // validate
564
+ if (keyFileName !== requiredKey) {
565
+ console.log(`❌ The keystore path is mismatched. Expected ${requiredKey} for ${targetAppId}, but got ${keyFileName}`);
566
+ process.exit(1);
567
+ }
568
+
569
+
570
+
571
+
572
+
573
+ // optionally return them
574
+ //return buildOptions;
575
+ }
576
+
500
577
  function updatePluginXml(admobConfig) {
501
578
  if (!fileExists(pluginPath)) {
502
579
  console.error(' ❌ plugin.xml not found. Ensure the plugin is installed.');
@@ -545,6 +622,8 @@ try {
545
622
  const admobConfig = getAdMobConfig();
546
623
 
547
624
 
625
+
626
+
548
627
  // Proceed only if ADMOB_ENABLED is true
549
628
  if (admobConfig.ADMOB_ENABLED) {
550
629
  if (fileExists(androidPlatformPath)) {
@@ -564,7 +643,7 @@ try {
564
643
 
565
644
 
566
645
 
567
-
646
+ validateAndroidBuildOptions();
568
647
 
569
648
 
570
649
 
@@ -228,7 +228,24 @@ addFavIconCode()
228
228
  appJssmallModifications();
229
229
  replaceKeyboardSet()
230
230
 
231
- if('apk.bulk.app.uninstaller')
231
+
232
+
233
+
234
+
235
+
236
+ const configPath = path.join(process.cwd(), 'capacitor.config.json');
237
+ if (!fs.existsSync(configPath)) {
238
+ console.error(`❌ capacitor.config.json not found at: ${configPath}`);
239
+ //return;
240
+ }
241
+ const rawData = fs.readFileSync(configPath, 'utf8');
242
+ const config = JSON.parse(rawData);
243
+ const targetAppId=config.appId
244
+
245
+ //console.log("TARGET APP ID IS : "+ targetAppId)
246
+
247
+
248
+ if(targetAppId=='apk.bulk.app.uninstaller' || targetAppId=='apk.extractor.installer')
232
249
  {
233
250
  const permissions=[
234
251
  '<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeplay-common",
3
- "version": "1.7.2",
3
+ "version": "1.7.3",
4
4
  "description": "Common build scripts and files",
5
5
  "scripts": {
6
6
  "postinstall": "node scripts/sync-files.js",