codeplay-common 4.10.5 → 4.10.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.
@@ -1,97 +1,97 @@
1
- const fs = require("fs");
2
- const path = require("path");
3
-
4
- const pluginPath = path.join(
5
- __dirname,
6
- "..",
7
- "node_modules",
8
- "onesignal-cordova-plugin",
9
- "plugin.xml"
10
- );
11
-
12
- if (!fs.existsSync(pluginPath)) {
13
- console.log("OneSignal plugin not found, skipping patch.");
14
- process.exit(0);
15
- }
16
-
17
- console.log("OneSignal plugin patch started.");
18
-
19
- let content = fs.readFileSync(pluginPath, "utf8");
20
-
21
- /* ---- Prevent running twice ---- */
22
- if (content.includes("buildCodeplay/fix-onesignal-plugin.js")) {
23
- console.log("OneSignal plugin already patched.");
24
- }
25
-
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
-
54
-
55
-
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"
66
- );
67
-
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
-
96
-
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+
4
+ const pluginPath = path.join(
5
+ __dirname,
6
+ "..",
7
+ "node_modules",
8
+ "onesignal-cordova-plugin",
9
+ "plugin.xml"
10
+ );
11
+
12
+ if (!fs.existsSync(pluginPath)) {
13
+ console.log("OneSignal plugin not found, skipping patch.");
14
+ process.exit(0);
15
+ }
16
+
17
+ console.log("OneSignal plugin patch started.");
18
+
19
+ let content = fs.readFileSync(pluginPath, "utf8");
20
+
21
+ /* ---- Prevent running twice ---- */
22
+ if (content.includes("buildCodeplay/fix-onesignal-plugin.js")) {
23
+ console.log("OneSignal plugin already patched.");
24
+ }
25
+
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
+
54
+
55
+
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"
66
+ );
67
+
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
+
96
+
97
97
  //#################### ADD THE PROPER ONESIGNAL PERMISSIN TO INFO.PLIST END ###########################
@@ -9,30 +9,30 @@ const replaceEmiPluginCode=()=>
9
9
 
10
10
 
11
11
  if (fs.existsSync(filePath)) {
12
- let fileContent = fs.readFileSync(filePath, 'utf8');
13
-
14
- // match the hideBannerAd method
15
- const methodRegex = /(- \(void\)hideBannerAd:[\s\S]*?\{)([\s\S]*?)(^\})/m;
16
-
17
- const match = fileContent.match(methodRegex);
18
-
19
- if (match) {
20
- const methodBody = match[2];
21
-
22
- // replace only if the line is not already commented
23
- const modifiedMethodBody = methodBody.replace(
24
- /^(\s*)(?!\/\/)\[self\s+resetWebViewHeight\];/m,
25
- '$1//[self resetWebViewHeight];'
26
- );
27
-
28
- const updatedFileContent =
29
- fileContent.slice(0, match.index) +
30
- match[1] +
31
- modifiedMethodBody +
32
- match[3] +
33
- fileContent.slice(match.index + match[0].length);
34
-
35
- fs.writeFileSync(filePath, updatedFileContent, 'utf8');
12
+ let fileContent = fs.readFileSync(filePath, 'utf8');
13
+
14
+ // match the hideBannerAd method
15
+ const methodRegex = /(- \(void\)hideBannerAd:[\s\S]*?\{)([\s\S]*?)(^\})/m;
16
+
17
+ const match = fileContent.match(methodRegex);
18
+
19
+ if (match) {
20
+ const methodBody = match[2];
21
+
22
+ // replace only if the line is not already commented
23
+ const modifiedMethodBody = methodBody.replace(
24
+ /^(\s*)(?!\/\/)\[self\s+resetWebViewHeight\];/m,
25
+ '$1//[self resetWebViewHeight];'
26
+ );
27
+
28
+ const updatedFileContent =
29
+ fileContent.slice(0, match.index) +
30
+ match[1] +
31
+ modifiedMethodBody +
32
+ match[3] +
33
+ fileContent.slice(match.index + match[0].length);
34
+
35
+ fs.writeFileSync(filePath, updatedFileContent, 'utf8');
36
36
  console.log(
37
37
  '✅ Successfully ensured [self resetWebViewHeight]; is commented only inside hideBannerAd in emiAdmobPlugin.m'
38
38
  );
@@ -1,35 +1,35 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const plist = require('plist');
4
-
5
- const { readFileSync } = require("fs");
6
-
7
-
8
-
9
-
10
-
11
-
12
- const addToolAttribute=()=>{
13
- //const platformRoot = path.join(context.opts.projectRoot, 'android');
14
- //const manifestPath = path.join(platformRoot, 'capacitor-cordova-android-plugins/src/main/AndroidManifest.xml');
15
-
16
- const manifestPath = path.resolve(process.cwd(), 'android/capacitor-cordova-android-plugins/src/main/AndroidManifest.xml');
17
-
18
- if (fs.existsSync(manifestPath)) {
19
- let manifest = fs.readFileSync(manifestPath, 'utf8');
20
-
21
- // Check if xmlns:tools exists
22
- if (!manifest.includes('xmlns:tools="http://schemas.android.com/tools"')) {
23
- // Add the tools namespace to the <manifest> tag.
24
- manifest = manifest.replace('<manifest', '<manifest xmlns:tools="http://schemas.android.com/tools"');
25
- fs.writeFileSync(manifestPath, manifest, 'utf8');
26
- console.log('✅ Added xmlns:tools to AndroidManifest.xml');
27
- } else {
28
- console.log('ℹ️ xmlns:tools already exists, skipping...');
29
- }
30
- } else {
31
- console.log('ℹ️ capacitor-cordova-android-plugins AndroidManifest.xml not found, skipping tools namespace update.');
32
- }
33
- };
34
-
35
- addToolAttribute()
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const plist = require('plist');
4
+
5
+ const { readFileSync } = require("fs");
6
+
7
+
8
+
9
+
10
+
11
+
12
+ const addToolAttribute=()=>{
13
+ //const platformRoot = path.join(context.opts.projectRoot, 'android');
14
+ //const manifestPath = path.join(platformRoot, 'capacitor-cordova-android-plugins/src/main/AndroidManifest.xml');
15
+
16
+ const manifestPath = path.resolve(process.cwd(), 'android/capacitor-cordova-android-plugins/src/main/AndroidManifest.xml');
17
+
18
+ if (fs.existsSync(manifestPath)) {
19
+ let manifest = fs.readFileSync(manifestPath, 'utf8');
20
+
21
+ // Check if xmlns:tools exists
22
+ if (!manifest.includes('xmlns:tools="http://schemas.android.com/tools"')) {
23
+ // Add the tools namespace to the <manifest> tag.
24
+ manifest = manifest.replace('<manifest', '<manifest xmlns:tools="http://schemas.android.com/tools"');
25
+ fs.writeFileSync(manifestPath, manifest, 'utf8');
26
+ console.log('✅ Added xmlns:tools to AndroidManifest.xml');
27
+ } else {
28
+ console.log('ℹ️ xmlns:tools already exists, skipping...');
29
+ }
30
+ } else {
31
+ console.log('ℹ️ capacitor-cordova-android-plugins AndroidManifest.xml not found, skipping tools namespace update.');
32
+ }
33
+ };
34
+
35
+ addToolAttribute()