codeplay-common 3.2.5 → 3.2.7

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,92 +1,92 @@
1
- const { spawn } = require("child_process");
2
- const path = require("path");
3
- const fs = require("fs");
4
-
5
- // Paths
6
- //const projectRoot = path.join(__dirname, "..");
7
- const projectRoot = process.cwd();
8
- const androidPath = path.join(projectRoot, "android");
9
- const capacitorConfigPath = path.join(projectRoot, "capacitor.config.json");
10
-
11
- // Read capacitor.config.json
12
- if (!fs.existsSync(capacitorConfigPath)) {
13
- console.error("❌ capacitor.config.json not found!");
14
- process.exit(1);
15
- }
16
-
17
- const config = JSON.parse(fs.readFileSync(capacitorConfigPath, "utf8"));
18
-
19
- const buildOptions = config.android?.buildOptions;
20
-
21
- if (!buildOptions) {
22
- console.error("❌ android.buildOptions not found in capacitor.config.json");
23
- process.exit(1);
24
- }
25
-
26
- // Resolve keystore path (relative → absolute)
27
-
28
-
29
- const storePassword = buildOptions.keystorePassword;
30
- const keyAlias = buildOptions.keystoreAlias;
31
- const keyPassword = buildOptions.keystoreAliasPassword;
32
-
33
-
34
-
35
-
36
-
37
-
38
- const rawKeystorePath = buildOptions.keystorePath;
39
-
40
- // First try normal resolve
41
- let keystorePath = path.resolve(projectRoot, rawKeystorePath);
42
-
43
- // If not found, try trimming one "../"
44
- if (!fs.existsSync(keystorePath)) {
45
- console.log("⚠️ Keystore not found, attempting path correction...");
46
-
47
- const trimmedPath = rawKeystorePath.replace(/^\.\.\//, "");
48
- keystorePath = path.resolve(projectRoot, trimmedPath);
49
- }
50
-
51
- // Final validation
52
- if (!fs.existsSync(keystorePath)) {
53
- console.error("❌ Keystore file not found even after correction:", keystorePath);
54
- process.exit(1);
55
- }
56
-
57
- console.log("🔐 Using keystore:", keystorePath);
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
- // Gradle args
69
- const args = [
70
- "/c",
71
- "gradlew.bat",
72
- "assembleRelease",
73
- `-Pandroid.injected.signing.store.file=${keystorePath}`,
74
- `-Pandroid.injected.signing.store.password=${storePassword}`,
75
- `-Pandroid.injected.signing.key.alias=${keyAlias}`,
76
- `-Pandroid.injected.signing.key.password=${keyPassword}`,
77
- ];
78
-
79
- // Run Gradle
80
- const gradle = spawn("cmd.exe", args, {
81
- cwd: androidPath,
82
- stdio: "inherit",
83
- });
84
-
85
- gradle.on("close", (code) => {
86
- if (code === 0) {
87
- console.log("\n✅ Signed APK Generated Successfully!");
88
- } else {
89
- console.log("\n❌ Build Failed with code:", code);
90
- process.exit(code);
91
- }
1
+ const { spawn } = require("child_process");
2
+ const path = require("path");
3
+ const fs = require("fs");
4
+
5
+ // Paths
6
+ //const projectRoot = path.join(__dirname, "..");
7
+ const projectRoot = process.cwd();
8
+ const androidPath = path.join(projectRoot, "android");
9
+ const capacitorConfigPath = path.join(projectRoot, "capacitor.config.json");
10
+
11
+ // Read capacitor.config.json
12
+ if (!fs.existsSync(capacitorConfigPath)) {
13
+ console.error("❌ capacitor.config.json not found!");
14
+ process.exit(1);
15
+ }
16
+
17
+ const config = JSON.parse(fs.readFileSync(capacitorConfigPath, "utf8"));
18
+
19
+ const buildOptions = config.android?.buildOptions;
20
+
21
+ if (!buildOptions) {
22
+ console.error("❌ android.buildOptions not found in capacitor.config.json");
23
+ process.exit(1);
24
+ }
25
+
26
+ // Resolve keystore path (relative → absolute)
27
+
28
+
29
+ const storePassword = buildOptions.keystorePassword;
30
+ const keyAlias = buildOptions.keystoreAlias;
31
+ const keyPassword = buildOptions.keystoreAliasPassword;
32
+
33
+
34
+
35
+
36
+
37
+
38
+ const rawKeystorePath = buildOptions.keystorePath;
39
+
40
+ // First try normal resolve
41
+ let keystorePath = path.resolve(projectRoot, rawKeystorePath);
42
+
43
+ // If not found, try trimming one "../"
44
+ if (!fs.existsSync(keystorePath)) {
45
+ console.log("⚠️ Keystore not found, attempting path correction...");
46
+
47
+ const trimmedPath = rawKeystorePath.replace(/^\.\.\//, "");
48
+ keystorePath = path.resolve(projectRoot, trimmedPath);
49
+ }
50
+
51
+ // Final validation
52
+ if (!fs.existsSync(keystorePath)) {
53
+ console.error("❌ Keystore file not found even after correction:", keystorePath);
54
+ process.exit(1);
55
+ }
56
+
57
+ console.log("🔐 Using keystore:", keystorePath);
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+ // Gradle args
69
+ const args = [
70
+ "/c",
71
+ "gradlew.bat",
72
+ "assembleRelease",
73
+ `-Pandroid.injected.signing.store.file=${keystorePath}`,
74
+ `-Pandroid.injected.signing.store.password=${storePassword}`,
75
+ `-Pandroid.injected.signing.key.alias=${keyAlias}`,
76
+ `-Pandroid.injected.signing.key.password=${keyPassword}`,
77
+ ];
78
+
79
+ // Run Gradle
80
+ const gradle = spawn("cmd.exe", args, {
81
+ cwd: androidPath,
82
+ stdio: "inherit",
83
+ });
84
+
85
+ gradle.on("close", (code) => {
86
+ if (code === 0) {
87
+ console.log("\n✅ Signed APK Generated Successfully!");
88
+ } else {
89
+ console.log("\n❌ Build Failed with code:", code);
90
+ process.exit(code);
91
+ }
92
92
  });
@@ -381,10 +381,10 @@ import { showSubscribePopup } from './../js/Ads/IAP-x.x/IAP-check-And-LoadAd.js'
381
381
  });
382
382
 
383
383
  const subscribeOrProLink = async () => {
384
-
384
+
385
385
  //This is only allowed if samsung have pro version
386
386
  if(_storeid==2)
387
- buyProMethod()
387
+ gotoBuyPro("com.html.codeplay.pro",noAppOpenShowUntilResume)
388
388
  else{
389
389
  const module = await loadIAP();
390
390
  module.showSubscribePopup();
@@ -1,47 +1,47 @@
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
- process.exit(0);
25
- }
26
-
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
-
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
+ process.exit(0);
25
+ }
26
+
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
47
  console.log("OneSignal plugin patched successfully.");
@@ -1,52 +1,52 @@
1
- /* EMI PLUGIN one line comment START */
2
-
3
- //Note : Call showBannerAd() method after hideBannerAd(), the inset space are not set properly (The banner ad overlap the content). So hide a line in emiAdmobPlugin.m file "//[self resetWebViewHeight];"
4
- const fs = require('fs');
5
- const path = require('path');
6
-
7
- const replaceEmiPluginCode=()=>
8
- {
9
- debugger;
10
- // path to your .m file
11
- const filePath = path.join(__dirname, '../ios/capacitor-cordova-ios-plugins/sourcesstatic/EmiIndoCordovaPluginAdmob/emiAdmobPlugin.m');
12
-
13
-
14
- if (fs.existsSync(filePath)) {
15
- let fileContent = fs.readFileSync(filePath, 'utf8');
16
-
17
- // match the hideBannerAd method
18
- const methodRegex = /(- \(void\)hideBannerAd:[\s\S]*?\{)([\s\S]*?)(^\})/m;
19
-
20
- const match = fileContent.match(methodRegex);
21
-
22
- if (match) {
23
- const methodBody = match[2];
24
-
25
- // replace only if the line is not already commented
26
- const modifiedMethodBody = methodBody.replace(
27
- /^(\s*)(?!\/\/)\[self\s+resetWebViewHeight\];/m,
28
- '$1//[self resetWebViewHeight];'
29
- );
30
-
31
- const updatedFileContent =
32
- fileContent.slice(0, match.index) +
33
- match[1] +
34
- modifiedMethodBody +
35
- match[3] +
36
- fileContent.slice(match.index + match[0].length);
37
-
38
- fs.writeFileSync(filePath, updatedFileContent, 'utf8');
39
- console.log(
40
- '✅ Successfully ensured [self resetWebViewHeight]; is commented only inside hideBannerAd in emiAdmobPlugin.m'
41
- );
42
- } else {
43
- console.log('⚠️ hideBannerAd method not found.');
44
- }
45
- } else {
46
- console.log('ℹ️ emiAdmobPlugin.m file not found, skipping modification.');
47
- }
48
- }
49
-
50
- replaceEmiPluginCode();
51
-
52
- /* EMI PLUGIN one line comment END */
1
+ /* EMI PLUGIN one line comment START */
2
+
3
+ //Note : Call showBannerAd() method after hideBannerAd(), the inset space are not set properly (The banner ad overlap the content). So hide a line in emiAdmobPlugin.m file "//[self resetWebViewHeight];"
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+
7
+ const replaceEmiPluginCode=()=>
8
+ {
9
+ debugger;
10
+ // path to your .m file
11
+ const filePath = path.join(__dirname, '../ios/capacitor-cordova-ios-plugins/sourcesstatic/EmiIndoCordovaPluginAdmob/emiAdmobPlugin.m');
12
+
13
+
14
+ if (fs.existsSync(filePath)) {
15
+ let fileContent = fs.readFileSync(filePath, 'utf8');
16
+
17
+ // match the hideBannerAd method
18
+ const methodRegex = /(- \(void\)hideBannerAd:[\s\S]*?\{)([\s\S]*?)(^\})/m;
19
+
20
+ const match = fileContent.match(methodRegex);
21
+
22
+ if (match) {
23
+ const methodBody = match[2];
24
+
25
+ // replace only if the line is not already commented
26
+ const modifiedMethodBody = methodBody.replace(
27
+ /^(\s*)(?!\/\/)\[self\s+resetWebViewHeight\];/m,
28
+ '$1//[self resetWebViewHeight];'
29
+ );
30
+
31
+ const updatedFileContent =
32
+ fileContent.slice(0, match.index) +
33
+ match[1] +
34
+ modifiedMethodBody +
35
+ match[3] +
36
+ fileContent.slice(match.index + match[0].length);
37
+
38
+ fs.writeFileSync(filePath, updatedFileContent, 'utf8');
39
+ console.log(
40
+ '✅ Successfully ensured [self resetWebViewHeight]; is commented only inside hideBannerAd in emiAdmobPlugin.m'
41
+ );
42
+ } else {
43
+ console.log('⚠️ hideBannerAd method not found.');
44
+ }
45
+ } else {
46
+ console.log('ℹ️ emiAdmobPlugin.m file not found, skipping modification.');
47
+ }
48
+ }
49
+
50
+ replaceEmiPluginCode();
51
+
52
+ /* EMI PLUGIN one line comment END */
@@ -1,33 +1,33 @@
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(__dirname, '../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('✅ EMI-ADMob: Added xmlns:tools to AndroidManifest.xml');
27
- } else {
28
- console.log('ℹ️ EMI-ADMob: xmlns:tools already exists, skipping...');
29
- }
30
- }
31
- };
32
-
33
- 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(__dirname, '../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('✅ EMI-ADMob: Added xmlns:tools to AndroidManifest.xml');
27
+ } else {
28
+ console.log('ℹ️ EMI-ADMob: xmlns:tools already exists, skipping...');
29
+ }
30
+ }
31
+ };
32
+
33
+ addToolAttribute()
@@ -1,36 +1,36 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
-
4
- // Path to the plugin.xml file
5
- const pluginXmlPath = path.join('node_modules', 'emi-indo-cordova-plugin-admob', 'plugin.xml');
6
-
7
- // Get the store ID from the environment variable
8
- const storeId = process.env.VITE_STORE_ID || '1';
9
-
10
- // Determine the framework to use based on storeId
11
- const framework = storeId === '7'
12
- ? '<framework src="com.google.android.gms:play-services-ads:$PLAY_SERVICES_VERSION" />'
13
- : '<framework src="com.google.android.gms:play-services-ads-lite:24.6.0" />';
14
-
15
- // Read and modify the plugin.xml file
16
- fs.readFile(pluginXmlPath, 'utf8', (err, data) => {
17
- if (err) {
18
- console.error('Error reading plugin.xml:', err);
19
- process.exit(1);
20
- }
21
-
22
- // Replace the existing framework line with the selected one
23
- const modifiedData = data.replace(
24
- /<framework src="com.google.android.gms:play-services-ads.*" \/>\n/,
25
- `${framework}\n`
26
- );
27
-
28
- // Write the modified content back to plugin.xml
29
- fs.writeFile(pluginXmlPath, modifiedData, 'utf8', (err) => {
30
- if (err) {
31
- console.error('Error writing plugin.xml:', err);
32
- process.exit(1);
33
- }
34
- console.log('plugin.xml updated successfully.');
35
- });
36
- });
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ // Path to the plugin.xml file
5
+ const pluginXmlPath = path.join('node_modules', 'emi-indo-cordova-plugin-admob', 'plugin.xml');
6
+
7
+ // Get the store ID from the environment variable
8
+ const storeId = process.env.VITE_STORE_ID || '1';
9
+
10
+ // Determine the framework to use based on storeId
11
+ const framework = storeId === '7'
12
+ ? '<framework src="com.google.android.gms:play-services-ads:$PLAY_SERVICES_VERSION" />'
13
+ : '<framework src="com.google.android.gms:play-services-ads-lite:24.6.0" />';
14
+
15
+ // Read and modify the plugin.xml file
16
+ fs.readFile(pluginXmlPath, 'utf8', (err, data) => {
17
+ if (err) {
18
+ console.error('Error reading plugin.xml:', err);
19
+ process.exit(1);
20
+ }
21
+
22
+ // Replace the existing framework line with the selected one
23
+ const modifiedData = data.replace(
24
+ /<framework src="com.google.android.gms:play-services-ads.*" \/>\n/,
25
+ `${framework}\n`
26
+ );
27
+
28
+ // Write the modified content back to plugin.xml
29
+ fs.writeFile(pluginXmlPath, modifiedData, 'utf8', (err) => {
30
+ if (err) {
31
+ console.error('Error writing plugin.xml:', err);
32
+ process.exit(1);
33
+ }
34
+ console.log('plugin.xml updated successfully.');
35
+ });
36
+ });