codeplay-common 3.2.15 → 3.2.17

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.
@@ -635,12 +635,17 @@ const SKIP_FILES = [
635
635
  ,'index.browser.js'
636
636
  ];
637
637
 
638
- const STATUSBAR_FILE = path.resolve(__dirname, '../src/js/common-configuration.js');
639
638
 
640
- // Match StatusBar.setStyle (ignore comments)
639
+
640
+ const STATUSBAR_FILE = path.resolve(__dirname, '../src/js/common-configuration.js');
641
641
  const STATUSBAR_REGEX = /^(?!\s*\/\/).*Capacitor\.Plugins\.StatusBar\.setStyle/m;
642
642
 
643
643
 
644
+ const ONESIGNAL_OLD_FILES = [
645
+ path.resolve(__dirname, '../src/js/onesignal-settings.js')
646
+ ];
647
+ const ONESIGNAL_VERSION_REGEX = /^onesignal-\d+(\.\d+)*\.js$/;
648
+
644
649
  function scanDirectory(dir) {
645
650
 
646
651
  /*
@@ -656,6 +661,32 @@ function scanDirectory(dir) {
656
661
  if (stat.isFile()) {
657
662
 
658
663
 
664
+
665
+ const baseName = path.basename(dir);
666
+
667
+ const JS_ROOT = path.resolve(__dirname, '../src/js');
668
+ const ONESIGNAL_DIR = path.join(JS_ROOT, 'onesignal');
669
+
670
+ // 🚨 Block old OneSignal file locations (ONLY in src/js root)
671
+ if (path.dirname(dir) === JS_ROOT) {
672
+
673
+ // āŒ onesignal-settings.js
674
+ if (ONESIGNAL_OLD_FILES.includes(dir)) {
675
+ console.error(`\nāŒ ERROR: onesignal-settings.js should not be in src/js/`);
676
+ console.error(`šŸ“ Move it to: src/js/onesignal/`);
677
+ console.error(`šŸ“„ File: ${dir}\n`);
678
+ process.exit(1);
679
+ }
680
+
681
+ // āŒ onesignal-x.x.js
682
+ if (ONESIGNAL_VERSION_REGEX.test(baseName)) {
683
+ console.error(`\nāŒ ERROR: ${baseName} should not be in src/js/`);
684
+ console.error(`šŸ“ Move it to: src/js/onesignal/`);
685
+ console.error(`šŸ“„ File: ${dir}\n`);
686
+ process.exit(1);
687
+ }
688
+ }
689
+
659
690
  // 🚨 Special check ONLY for common-configuration.js
660
691
  if (dir === STATUSBAR_FILE) {
661
692
  let content = fs.readFileSync(dir, 'utf8');
@@ -675,7 +706,7 @@ function scanDirectory(dir) {
675
706
  }
676
707
 
677
708
  // šŸ”„ Skip files in SKIP_FILES array
678
- const baseName = path.basename(dir);
709
+
679
710
  if (SKIP_FILES.includes(baseName)) {
680
711
  // Just skip silently
681
712
  return;
@@ -1240,7 +1271,7 @@ function updatePluginXml(admobConfig) {
1240
1271
 
1241
1272
  function updateInfoPlist(admobConfig) {
1242
1273
  if (!fileExists(infoPlistPath)) {
1243
- console.error(' āŒ Info.plist not found. Ensure you have built the iOS project.');
1274
+ console.error('Info.plist not found. Ensure you have built the iOS project.');
1244
1275
  return;
1245
1276
  }
1246
1277
 
@@ -1251,6 +1282,52 @@ function updateInfoPlist(admobConfig) {
1251
1282
  plistData.NSUserTrackingUsageDescription = 'This identifier will be used to deliver personalized ads to you.';
1252
1283
  plistData.GADDelayAppMeasurementInit = true;
1253
1284
 
1285
+ // https://developers.google.com/admob/ios/quick-start
1286
+ plistData.SKAdNetworkItems = [
1287
+ { SKAdNetworkIdentifier: 'cstr6suwn9.skadnetwork' }, // Google
1288
+ { SKAdNetworkIdentifier: '4fzdc2evr5.skadnetwork' }, // Aarki
1289
+ { SKAdNetworkIdentifier: '2fnua5tdw4.skadnetwork' }, // Adform
1290
+ { SKAdNetworkIdentifier: 'ydx93a7ass.skadnetwork' }, // Adikteev
1291
+ { SKAdNetworkIdentifier: 'p78axxw29g.skadnetwork' }, // Amazon
1292
+ { SKAdNetworkIdentifier: 'v72qych5uu.skadnetwork' }, // Appier
1293
+ { SKAdNetworkIdentifier: 'ludvb6z3bs.skadnetwork' }, // Applovin
1294
+ { SKAdNetworkIdentifier: 'cp8zw746q7.skadnetwork' }, // Arpeely
1295
+ { SKAdNetworkIdentifier: '3sh42y64q3.skadnetwork' }, // Basis
1296
+ { SKAdNetworkIdentifier: 'c6k4g5qg8m.skadnetwork' }, // Beeswax.io
1297
+ { SKAdNetworkIdentifier: 's39g8k73mm.skadnetwork' }, // Bidease
1298
+ { SKAdNetworkIdentifier: '3qy4746246.skadnetwork' }, // Bigabid
1299
+ { SKAdNetworkIdentifier: 'hs6bdukanm.skadnetwork' }, // Criteo
1300
+ { SKAdNetworkIdentifier: 'mlmmfzh3r3.skadnetwork' }, // Digital Turbine DSP
1301
+ { SKAdNetworkIdentifier: 'v4nxqhlyqp.skadnetwork' }, // i-mobile
1302
+ { SKAdNetworkIdentifier: 'wzmmz9fp6w.skadnetwork' }, // InMobi
1303
+ { SKAdNetworkIdentifier: 'su67r6k2v3.skadnetwork' }, // ironSource Ads
1304
+ { SKAdNetworkIdentifier: 'yclnxrl5pm.skadnetwork' }, // Jampp
1305
+ { SKAdNetworkIdentifier: '7ug5zh24hu.skadnetwork' }, // Liftoff
1306
+ { SKAdNetworkIdentifier: 'gta9lk7p23.skadnetwork' }, // Liftoff Monetize
1307
+ { SKAdNetworkIdentifier: 'vutu7akeur.skadnetwork' }, // LINE
1308
+ { SKAdNetworkIdentifier: 'y5ghdn5j9k.skadnetwork' }, // Mediaforce
1309
+ { SKAdNetworkIdentifier: 'v9wttpbfk9.skadnetwork' }, // Meta (1 of 2)
1310
+ { SKAdNetworkIdentifier: 'n38lu8286q.skadnetwork' }, // Meta (2 of 2)
1311
+ { SKAdNetworkIdentifier: '47vhws6wlr.skadnetwork' }, // MicroAd
1312
+ { SKAdNetworkIdentifier: 'kbd757ywx3.skadnetwork' }, // Mintegral / Mobvista
1313
+ { SKAdNetworkIdentifier: '9t245vhmpl.skadnetwork' }, // Moloco
1314
+ { SKAdNetworkIdentifier: 'a2p9lx4jpn.skadnetwork' }, // Opera
1315
+ { SKAdNetworkIdentifier: '22mmun2rn5.skadnetwork' }, // Pangle
1316
+ { SKAdNetworkIdentifier: '4468km3ulz.skadnetwork' }, // Realtime Technologies GmbH
1317
+ { SKAdNetworkIdentifier: '2u9pt9hc89.skadnetwork' }, // Remerge
1318
+ { SKAdNetworkIdentifier: '8s468mfl3y.skadnetwork' }, // RTB House
1319
+ { SKAdNetworkIdentifier: 'ppxm28t8ap.skadnetwork' }, // Smadex
1320
+ { SKAdNetworkIdentifier: 'uw77j35x4d.skadnetwork' }, // The Trade Desk
1321
+ { SKAdNetworkIdentifier: 'pwa73g5rt2.skadnetwork' }, // Tremor
1322
+ { SKAdNetworkIdentifier: '578prtvx9j.skadnetwork' }, // Unicorn
1323
+ { SKAdNetworkIdentifier: '4dzt52r2t5.skadnetwork' }, // Unity Ads
1324
+ { SKAdNetworkIdentifier: 'tl55sbb4fm.skadnetwork' }, // Verve
1325
+ { SKAdNetworkIdentifier: 'e5fvkxwrpn.skadnetwork' }, // Yahoo!
1326
+ { SKAdNetworkIdentifier: '8c4e2ghe7u.skadnetwork' }, // Yahoo! Japan Ads
1327
+ { SKAdNetworkIdentifier: '3rd42ekr43.skadnetwork' }, // YouAppi
1328
+ { SKAdNetworkIdentifier: '3qcr597p9d.skadnetwork' }, // Zucks
1329
+ ];
1330
+
1254
1331
  const updatedPlistContent = plist.build(plistData);
1255
1332
  fs.writeFileSync(infoPlistPath, updatedPlistContent, 'utf8');
1256
1333
  console.log('AdMob IDs and additional configurations successfully updated in Info.plist');
@@ -21,27 +21,77 @@ let content = fs.readFileSync(pluginPath, "utf8");
21
21
  /* ---- Prevent running twice ---- */
22
22
  if (content.includes("buildCodeplay/fix-onesignal-plugin.js")) {
23
23
  console.log("OneSignal plugin already patched.");
24
- process.exit(0);
25
24
  }
26
25
 
27
- /* ---- Comment Kotlin dependency ---- */
28
- content = content.replace(
29
- '<framework src="org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10" />',
30
- `<!-- Disabled: causes Kotlin version conflict with modern Gradle/Kotlin -->
31
- <!-- <framework src="org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10" /> -->`
32
- );
26
+ else{
27
+ /* ---- Comment Kotlin dependency ---- */
28
+ content = content.replace(
29
+ '<framework src="org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10" />',
30
+ `<!-- Disabled: causes Kotlin version conflict with modern Gradle/Kotlin -->
31
+ <!-- <framework src="org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10" /> -->`
32
+ );
33
+
34
+ /* ---- Add dependencies ---- */
35
+ content = content.replace(
36
+ '<framework src="build-extras-onesignal.gradle" custom="true" type="gradleReference" />',
37
+ `<framework src="build-extras-onesignal.gradle" custom="true" type="gradleReference" />
38
+
39
+ <!--Newly added content through buildCodeplay/fix-onesignal-plugin.js Start-->
40
+ <framework src="com.fasterxml.jackson.core:jackson-core:2.17.2" />
41
+ <framework src="com.google.auto.value:auto-value-annotations:1.11.0" scope="provided" />
42
+ <!--Newly added content through buildCodeplay/fix-onesignal-plugin.js End-->`
43
+ );
44
+
45
+ fs.writeFileSync(pluginPath, content);
46
+
47
+ console.log("OneSignal plugin patched successfully.");
48
+ }
49
+
50
+
51
+
52
+
53
+
33
54
 
34
- /* ---- Add dependencies ---- */
35
- content = content.replace(
36
- '<framework src="build-extras-onesignal.gradle" custom="true" type="gradleReference" />',
37
- `<framework src="build-extras-onesignal.gradle" custom="true" type="gradleReference" />
38
55
 
39
- <!--Newly added content through buildCodeplay/fix-onesignal-plugin.js Start-->
40
- <framework src="com.fasterxml.jackson.core:jackson-core:2.17.2" />
41
- <framework src="com.google.auto.value:auto-value-annotations:1.11.0" scope="provided" />
42
- <!--Newly added content through buildCodeplay/fix-onesignal-plugin.js End-->`
56
+
57
+ //#################### ADD THE PROPER ONESIGNAL PERMISSIN TO INFO.PLIST START ###########################
58
+
59
+ const iosPlistPath = path.join(
60
+ __dirname,
61
+ "..",
62
+ "ios",
63
+ "App",
64
+ "App",
65
+ "Info.plist"
43
66
  );
44
67
 
45
- fs.writeFileSync(pluginPath, content);
68
+ console.log(iosPlistPath)
69
+
70
+ if (fs.existsSync(iosPlistPath)) {
71
+
72
+ let plist = fs.readFileSync(iosPlistPath, "utf8");
73
+
74
+ const insertBlock = `
75
+ <key>UIBackgroundModes</key>
76
+ <array>
77
+ <string>remote-notification</string>
78
+ </array>
79
+ `;
80
+
81
+ if (!plist.includes("UIBackgroundModes")) {
82
+ const lastIndex = plist.lastIndexOf("</dict>");
83
+
84
+ plist =
85
+ plist.slice(0, lastIndex) +
86
+ insertBlock +
87
+ "\n" +
88
+ plist.slice(lastIndex);
89
+
90
+ console.log("Inserted UIBackgroundModes correctly.");
91
+ }
92
+
93
+ fs.writeFileSync(iosPlistPath, plist);
94
+ }
95
+
46
96
 
47
- console.log("OneSignal plugin patched successfully.");
97
+ //#################### ADD THE PROPER ONESIGNAL PERMISSIN TO INFO.PLIST END ###########################
@@ -25,11 +25,42 @@ Note: This changes are added with my old(current) code. Might we need to integra
25
25
  2) Statusbar color set in app startup is checked and through erro
26
26
 
27
27
  const STATUSBAR_FILE = path.resolve(__dirname, '../src/js/common-configuration.js');
28
-
29
- // Match StatusBar.setStyle (ignore comments)
30
28
  const STATUSBAR_REGEX = /^(?!\s*\/\/).*Capacitor\.Plugins\.StatusBar\.setStyle/m;
29
+
30
+
31
+ const ONESIGNAL_OLD_FILES = [
32
+ path.resolve(__dirname, '../src/js/onesignal-settings.js')
33
+ ];
34
+ const ONESIGNAL_VERSION_REGEX = /^onesignal-\d+(\.\d+)*\.js$/;
35
+
31
36
  ....
32
37
  ....
38
+ ....
39
+
40
+
41
+ const JS_ROOT = path.resolve(__dirname, '../src/js');
42
+ const ONESIGNAL_DIR = path.join(JS_ROOT, 'onesignal');
43
+
44
+ // 🚨 Block old OneSignal file locations (ONLY in src/js root)
45
+ if (path.dirname(dir) === JS_ROOT) {
46
+
47
+ // āŒ onesignal-settings.js
48
+ if (ONESIGNAL_OLD_FILES.includes(dir)) {
49
+ console.error(`\nāŒ ERROR: onesignal-settings.js should not be in src/js/`);
50
+ console.error(`šŸ“ Move it to: src/js/onesignal/`);
51
+ console.error(`šŸ“„ File: ${dir}\n`);
52
+ process.exit(1);
53
+ }
54
+
55
+ // āŒ onesignal-x.x.js
56
+ if (ONESIGNAL_VERSION_REGEX.test(baseName)) {
57
+ console.error(`\nāŒ ERROR: ${baseName} should not be in src/js/`);
58
+ console.error(`šŸ“ Move it to: src/js/onesignal/`);
59
+ console.error(`šŸ“„ File: ${dir}\n`);
60
+ process.exit(1);
61
+ }
62
+ }
63
+
33
64
  // 🚨 Special check ONLY for common-configuration.js
34
65
  if (dir === STATUSBAR_FILE) {
35
66
  let content = fs.readFileSync(dir, 'utf8');
@@ -47,3 +78,11 @@ Note: This changes are added with my old(current) code. Might we need to integra
47
78
  process.exit(1);
48
79
  }
49
80
  }
81
+
82
+
83
+ 3) Modification in "fix-onesignal-plugin.js" file
84
+ Search following and that whole block added for add permission to "info.plist" file
85
+ INFO.PLIST START
86
+
87
+ 4) In "codeplayBeforeBuild-6.1.js" file following whole method is replaced. Due to add ads related permission to info.plist file
88
+ updateInfoPlist()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeplay-common",
3
- "version": "3.2.15",
3
+ "version": "3.2.17",
4
4
  "description": "Common build scripts and files",
5
5
  "scripts": {
6
6
  "postinstall": "node scripts/sync-files.js",