codeplay-common 4.7.6 → 4.7.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,4 +1,4 @@
1
- {
2
- "url": "https://htmlcodeplay.com/codeplay/api/v1/release/sync",
3
- "token": "b_TiY0Lu7q7Yb0Kx9djVxA6ST8k4CFiwFQNxgci7AAU"
4
- }
1
+ {
2
+ "url": "https://htmlcodeplay.com/codeplay/api/v1/release/sync",
3
+ "token": "b_TiY0Lu7q7Yb0Kx9djVxA6ST8k4CFiwFQNxgci7AAU"
4
+ }
@@ -7,7 +7,7 @@ node finalrelease "1,2,7"
7
7
 
8
8
  import { existsSync, readFileSync, readdirSync, promises, constants, writeFileSync, unlinkSync, mkdirSync, renameSync } from 'fs';
9
9
  import { join, resolve } from 'path';
10
- import { execSync, execFileSync } from 'child_process';
10
+ import { execSync, execFileSync } from 'child_process';
11
11
  import { createInterface } from 'readline';
12
12
 
13
13
  import { fileURLToPath } from 'url';
@@ -179,49 +179,49 @@ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
179
179
 
180
180
  const _appUniqueId = config.android?.APP_UNIQUE_ID;
181
181
  const _appName=config.appName;
182
- const _appPackageId=config.appId;
183
-
184
- const releaseSyncConfigPath = join(__dirname, 'buildCodeplay', 'release-sync.config.json');
185
- let releaseSyncConfig = {};
186
- if (existsSync(releaseSyncConfigPath)) {
187
- try {
188
- releaseSyncConfig = JSON.parse(readFileSync(releaseSyncConfigPath, 'utf8'));
189
- } catch (error) {
190
- console.warn(`⚠️ Could not read ${releaseSyncConfigPath}: ${error.message}`);
191
- }
192
- }
193
- const RELEASE_SYNC_URL = process.env.CODEPLAY_RELEASE_SYNC_URL || releaseSyncConfig.url || 'https://htmlcodeplay.com/codeplay/api/v1/release/sync';
194
- const RELEASE_SYNC_TOKEN = process.env.CODEPLAY_RELEASE_SYNC_TOKEN || releaseSyncConfig.token || '';
195
- const RELEASE_PLATFORM_IDS = { PlayStore: 1, SamsungStore: 13, AmazonStore: 17, MiStore: 15, HuaweiStore: 12, OppoStore: 14, VivoStore: 16 };
196
-
197
- function syncReleaseToCodeplay(storeName, finalVersionName, finalVersionCode, releasedDate) {
198
- if (!RELEASE_SYNC_TOKEN) {
199
- console.warn(`⚠️ Codeplay release sync skipped: add a token to ${releaseSyncConfigPath}.`);
200
- return;
201
- }
202
- const payload = JSON.stringify({
203
- app_name: _appName,
204
- package_id: _appPackageId,
205
- version_name: String(finalVersionName),
206
- version_code: String(finalVersionCode),
207
- released_date: releasedDate,
208
- language_id: 0,
209
- language_name: 'Capacitor+ Framework 7',
210
- notes: 'Automated release update',
211
- status: 1,
212
- folder_name: path.basename(process.cwd()),
213
- app_unique_id: String(_appUniqueId || ''),
214
- platform_id: RELEASE_PLATFORM_IDS[storeName],
215
- });
216
- try {
217
- const response = execFileSync('curl.exe', ['-sS', '--fail-with-body', '-X', 'POST', RELEASE_SYNC_URL,
218
- '-H', 'Content-Type: application/json', '-H', `X-Release-Token: ${RELEASE_SYNC_TOKEN}`, '--data-binary', payload],
219
- { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] });
220
- console.log(`✅ Codeplay sync (${storeName}): ${response.trim()}`);
221
- } catch (error) {
222
- console.warn(`⚠️ Codeplay sync failed for ${storeName}; continuing release builds: ${error.message}`);
223
- }
224
- }
182
+ const _appPackageId=config.appId;
183
+
184
+ const releaseSyncConfigPath = join(__dirname, 'buildCodeplay', 'release-sync.config.json');
185
+ let releaseSyncConfig = {};
186
+ if (existsSync(releaseSyncConfigPath)) {
187
+ try {
188
+ releaseSyncConfig = JSON.parse(readFileSync(releaseSyncConfigPath, 'utf8'));
189
+ } catch (error) {
190
+ console.warn(`⚠️ Could not read ${releaseSyncConfigPath}: ${error.message}`);
191
+ }
192
+ }
193
+ const RELEASE_SYNC_URL = process.env.CODEPLAY_RELEASE_SYNC_URL || releaseSyncConfig.url || 'https://htmlcodeplay.com/codeplay/api/v1/release/sync';
194
+ const RELEASE_SYNC_TOKEN = process.env.CODEPLAY_RELEASE_SYNC_TOKEN || releaseSyncConfig.token || '';
195
+ const RELEASE_PLATFORM_IDS = { PlayStore: 1, SamsungStore: 13, AmazonStore: 17, MiStore: 15, HuaweiStore: 12, OppoStore: 14, VivoStore: 16 };
196
+
197
+ function syncReleaseToCodeplay(storeName, finalVersionName, finalVersionCode, releasedDate) {
198
+ if (!RELEASE_SYNC_TOKEN) {
199
+ console.warn(`⚠️ Codeplay release sync skipped: add a token to ${releaseSyncConfigPath}.`);
200
+ return;
201
+ }
202
+ const payload = JSON.stringify({
203
+ app_name: _appName,
204
+ package_id: _appPackageId,
205
+ version_name: String(finalVersionName),
206
+ version_code: String(finalVersionCode),
207
+ released_date: releasedDate,
208
+ language_id: 0,
209
+ language_name: 'Capacitor+ Framework 7',
210
+ notes: 'Automated release update',
211
+ status: 1,
212
+ folder_name: path.basename(process.cwd()),
213
+ app_unique_id: String(_appUniqueId || ''),
214
+ platform_id: RELEASE_PLATFORM_IDS[storeName],
215
+ });
216
+ try {
217
+ const response = execFileSync('curl.exe', ['-sS', '--fail-with-body', '-X', 'POST', RELEASE_SYNC_URL,
218
+ '-H', 'Content-Type: application/json', '-H', `X-Release-Token: ${RELEASE_SYNC_TOKEN}`, '--data-binary', payload],
219
+ { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] });
220
+ console.log(`✅ Codeplay sync (${storeName}): ${response.trim()}`);
221
+ } catch (error) {
222
+ console.warn(`⚠️ Codeplay sync failed for ${storeName}; continuing release builds: ${error.message}`);
223
+ }
224
+ }
225
225
 
226
226
  const FLOWCHART_API_APP_ID = 228;
227
227
  const FLOWCHART_SHARED_PATH = join('public', 'src', 'shared.js');
@@ -1036,11 +1036,11 @@ rl.question('Enter new versionCode (press enter to keep current): ', (newVersion
1036
1036
  const checkFullPath = join("AAB", newFileName.replace(/\.aab$/, `.${newExt}`));
1037
1037
 
1038
1038
  // Rename the output file
1039
- if (existsSync(oldFilePath)) {
1040
- renameSync(oldFilePath, checkFullPath);
1041
- console.log(`✅ Renamed output ${newExt.toUpperCase()} file to: ${path.basename(checkFullPath)}`);
1042
- syncReleaseToCodeplay(storeName, finalVersionName, finalVersionCode, new Date().toISOString().slice(0, 10));
1043
- } else {
1039
+ if (existsSync(oldFilePath)) {
1040
+ renameSync(oldFilePath, checkFullPath);
1041
+ console.log(`✅ Renamed output ${newExt.toUpperCase()} file to: ${path.basename(checkFullPath)}`);
1042
+ syncReleaseToCodeplay(storeName, finalVersionName, finalVersionCode, new Date().toISOString().slice(0, 10));
1043
+ } else {
1044
1044
  console.error(`❌ ${newExt.toUpperCase()} file not found after build.`);
1045
1045
  }
1046
1046
 
@@ -86,8 +86,8 @@ const analysisFrameDirectory = path.join(temporaryDirectory, 'ai-analysis');
86
86
  const endCardBannerPath = path.join(outputVideoDirectory, `${appFilePrefix}-ai-end-card-banner.png`);
87
87
  const promoCopySchemaPath = path.join(temporaryDirectory, 'promo-copy-schema.json');
88
88
  const promoCopyResultPath = path.join(temporaryDirectory, 'promo-copy-result.json');
89
- const ffmpegFallbackDirectory = String(process.env.FFMPEG_BIN || '').trim()
90
- || path.join(projectDirectory, 'tools', 'ffmpeg');
89
+ const ffmpegFallbackDirectory = String(process.env.FFMPEG_BIN || '').trim()
90
+ || path.join(projectDirectory, 'tools', 'ffmpeg');
91
91
  const minimumSceneCount = 7;
92
92
  const minimumSourceDuration = 12;
93
93
  let expectedDuration = 34;
@@ -209,15 +209,15 @@ async function ensureEndCardBanner() {
209
209
  + '- Keep all logos and badge text sharp, correctly proportioned, and completely visible.\n'
210
210
  + '- Match the background colors and visual style to the actual app icon.\n'
211
211
  + '- Create a polished, professional background related to the app’s purpose.\n'
212
- + '- Keep the background subtle so it does not compete with the icon, title, feature text, or download badges.\n'
212
+ + '- Keep the background subtle so it does not compete with the icon, title, feature text, or download badges.\n'
213
213
  + '- Use a balanced landscape composition:\n'
214
214
  + ' - Large actual app icon on the left.\n'
215
215
  + ' - App Store badge followed by Google Play badge on the right.\n'
216
216
  + ' - Maintain comfortable margins and clear space around every element.\n'
217
- + '- Add the application title prominently.\n'
218
- + '- Add concise promotional text describing the application’s actual features, presenting each feature one by one.\n'
219
- + '- Keep the title and feature text sharp, readable, accurate, and visually balanced with the icon and download badges.\n'
220
- + '- Do not invent unsupported features or add unrelated marketing text.\n'
217
+ + '- Add the application title prominently.\n'
218
+ + '- Add concise promotional text describing the application’s actual features, presenting each feature one by one.\n'
219
+ + '- Keep the title and feature text sharp, readable, accurate, and visually balanced with the icon and download badges.\n'
220
+ + '- Do not invent unsupported features or add unrelated marketing text.\n'
221
221
  + '- Do not add watermarks, fake UI, generated symbols, or unrelated decorations.\n'
222
222
  + '- Rounded corners and a subtle shadow may be applied around the app icon, but its internal artwork must remain unchanged.\n'
223
223
  + '- Use image generation only for the background.\n'
@@ -467,12 +467,12 @@ function commandExists(command) {
467
467
  return !result.error && result.status === 0;
468
468
  }
469
469
 
470
- function getExecutable(command) {
471
- const executableName = process.platform === 'win32' ? `${command}.exe` : command;
472
- const fallbackPath = path.join(ffmpegFallbackDirectory, executableName);
473
- if (fs.existsSync(fallbackPath)) return fallbackPath;
474
- return commandExists(command) ? command : '';
475
- }
470
+ function getExecutable(command) {
471
+ const executableName = process.platform === 'win32' ? `${command}.exe` : command;
472
+ const fallbackPath = path.join(ffmpegFallbackDirectory, executableName);
473
+ if (fs.existsSync(fallbackPath)) return fallbackPath;
474
+ return commandExists(command) ? command : '';
475
+ }
476
476
 
477
477
  function detectRedundantStaticRanges(ffmpegCommand, inputPath, sourceDuration) {
478
478
  const minimumStaticDuration = Math.max(2, Math.min(4, sourceDuration / 60));
@@ -640,7 +640,7 @@ function resolvePromoLayout(requestedLayout) {
640
640
  }
641
641
 
642
642
  function getPythonExecutable() {
643
- for (const candidate of ['py', 'python', 'python3']) {
643
+ for (const candidate of ['py', 'python', 'python3']) {
644
644
  const result = spawnSync(candidate, ['-m', 'edge_tts', '--version'], {
645
645
  encoding: 'utf8',
646
646
  windowsHide: true,
@@ -915,7 +915,7 @@ Rules:
915
915
  - footer_keywords must contain exactly 3 distinct, natural app-search phrases, each 2-24 characters.
916
916
  - Generate a YouTube upload title and description from the same verified features.
917
917
  - YouTube title: 40-100 characters, include ${JSON.stringify(appName)} and one strong natural search phrase, without clickbait.
918
- - YouTube description: 350-1500 characters with readable paragraphs. Put the clearest app summary and primary search phrase in the opening two lines, explain the demonstrated features, add a simple call to action, then insert a newline and finish with exactly 3 relevant hashtags on that separate final line. The hashtags must not be appended to the preceding paragraph.
918
+ - YouTube description: 350-1500 characters with readable paragraphs. Put the clearest app summary and primary search phrase in the opening two lines, explain the demonstrated features, add a simple call to action, then insert a newline and finish with exactly 3 relevant hashtags on that separate final line. The hashtags must not be appended to the preceding paragraph.
919
919
  - Do not add download links or URLs; the script will append the verified Google Play URL built from the configured package ID. Do not add chapter timestamps or unsupported availability claims.
920
920
  - Keep YouTube text natural and useful; do not repeat keywords unnaturally.
921
921
  - Avoid prices, ratings, awards, competitor names, unsupported superlatives, and words such as best, guaranteed, or free.
@@ -1025,14 +1025,14 @@ function validatePromoCopy(value) {
1025
1025
  throw new Error(`The final scene must mention the app name ${JSON.stringify(appName)}.`);
1026
1026
  }
1027
1027
 
1028
- const youtubeTitle = cleanGeneratedString(value.youtube.title);
1029
- let youtubeDescription = cleanGeneratedDescription(value.youtube.description);
1030
- const trailingHashtagGroup = youtubeDescription.match(
1031
- /(?:^|\s)(#[\p{L}\p{N}_]+\s+#[\p{L}\p{N}_]+\s+#[\p{L}\p{N}_]+)\s*$/u,
1032
- );
1033
- if (trailingHashtagGroup) {
1034
- youtubeDescription = `${youtubeDescription.slice(0, trailingHashtagGroup.index).trimEnd()}\n${trailingHashtagGroup[1]}`;
1035
- }
1028
+ const youtubeTitle = cleanGeneratedString(value.youtube.title);
1029
+ let youtubeDescription = cleanGeneratedDescription(value.youtube.description);
1030
+ const trailingHashtagGroup = youtubeDescription.match(
1031
+ /(?:^|\s)(#[\p{L}\p{N}_]+\s+#[\p{L}\p{N}_]+\s+#[\p{L}\p{N}_]+)\s*$/u,
1032
+ );
1033
+ if (trailingHashtagGroup) {
1034
+ youtubeDescription = `${youtubeDescription.slice(0, trailingHashtagGroup.index).trimEnd()}\n${trailingHashtagGroup[1]}`;
1035
+ }
1036
1036
  if (youtubeTitle.length < 40 || youtubeTitle.length > 100) {
1037
1037
  throw new Error('YouTube title must be 40-100 characters.');
1038
1038
  }
@@ -1,145 +1,145 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
-
4
-
5
-
6
- const androidManifestPath = path.join("android", "app", "src", "main", "AndroidManifest.xml");
7
-
8
- // Find the vite config file
9
- const possibleConfigFiles = ['vite.config.mjs', 'vite.config.js'];
10
- let viteConfigPath;
11
-
12
- for (const configFile of possibleConfigFiles) {
13
- const fullPath = path.resolve(configFile);
14
- if (fs.existsSync(fullPath)) {
15
- viteConfigPath = fullPath;
16
- break;
17
- }
18
- }
19
-
20
- if (!viteConfigPath) {
21
- console.error('Error: No vite.config.mjs or vite.config.js file found.');
22
- process.exit(1);
23
- }
24
-
25
- try {
26
- // Read vite config file
27
- const viteConfigContent = fs.readFileSync(viteConfigPath, 'utf-8');
28
-
29
- // Extract @common alias path
30
- const aliasPattern = /'@common':\s*path\.resolve\(__dirname,\s*'(.+?)'\)/;
31
- const match = viteConfigContent.match(aliasPattern);
32
-
33
- if (!match) {
34
- console.error(`Error: @common alias not found in ${viteConfigPath}`);
35
- process.exit(1);
36
- }
37
-
38
- const commonFilePath = match[1];
39
- const resolvedCommonPath = path.resolve(__dirname, commonFilePath);
40
-
41
- // Read the common file content
42
- if (!fs.existsSync(resolvedCommonPath)) {
43
- console.error(`Error: Resolved common file does not exist: ${resolvedCommonPath}`);
44
- process.exit(1);
45
- }
46
-
47
- const commonFileContent = fs.readFileSync(resolvedCommonPath, 'utf-8');
48
-
49
- // Extract _storeid value
50
- const storeIdPattern = /export\s+let\s+_storeid\s*=\s*import\.meta\.env\.VITE_STORE_ID\s*\|\|\s*(\d+)\s*;/;
51
-
52
- const storeMatch = commonFileContent.match(storeIdPattern);
53
-
54
-
55
- if (!storeMatch) {
56
- console.error(`Error: _storeid not found in ${resolvedCommonPath}`);
57
- process.exit(1);
58
- }
59
-
60
- const _storeid = parseInt(storeMatch[1], 10);
61
-
62
- // Determine the store name based on _storeid
63
- let storeName = "";
64
- if (_storeid === 1) {
65
- storeName = "PlayStore";
66
- } else if (_storeid === 2) {
67
- storeName = "SamsungStore";
68
- } else if (_storeid === 7) {
69
- storeName = "AmazonStore";
70
- } else {
71
- console.error(`Error: Unsupported _storeid value: ${_storeid}`);
72
- process.exit(1);
73
- }
74
-
75
-
76
- // Call managePackages with the determined store name
77
- managePackages(storeName);
78
-
79
- console.log(commonFilePath, `Success - _storeid found: ${_storeid}, Store: ${storeName}`);
80
- } catch (error) {
81
- console.error('Error:', error);
82
- process.exit(1);
83
- }
84
-
85
- function managePackages(store) {
86
- console.log(`Managing packages for store: ${store}`);
87
-
88
- let install = "";
89
- let uninstall = "";
90
-
91
- //let androidManifestPath = "path/to/AndroidManifest.xml"; // Update this path
92
-
93
-
94
- let manifestContent = fs.readFileSync(androidManifestPath, 'utf-8');
95
-
96
- const permissionsToRemove = [
97
- 'com.android.vending.BILLING',
98
- 'com.samsung.android.iap.permission.BILLING'
99
- ];
100
-
101
- permissionsToRemove.forEach(permission => {
102
- const permissionRegex = new RegExp(`^\\s*<uses-permission\\s+android:name="${permission}"\\s*/?>\\s*[\r\n]?`, 'm');
103
- if (permissionRegex.test(manifestContent)) {
104
- manifestContent = manifestContent.replace(permissionRegex, '');
105
- console.log(`Removed <uses-permission android:name="${permission}" /> from AndroidManifest.xml`);
106
- }
107
- });
108
-
109
- // Write the updated content back to the file
110
- fs.writeFileSync(androidManifestPath, manifestContent, 'utf-8');
111
-
112
- if (store === "PlayStore") {
113
- install = '@revenuecat/purchases-capacitor';
114
- uninstall = 'cordova-plugin-samsungiap';
115
- } else if (store === "AmazonStore") {
116
- install = '@revenuecat/purchases-capacitor';
117
- uninstall = 'cordova-plugin-samsungiap';
118
- } else if (store === "SamsungStore") {
119
- install = 'cordova-plugin-samsungiap';
120
- uninstall = '@revenuecat/purchases-capacitor';
121
- } else {
122
- console.log("No valid store specified. Uninstalling both plugins.");
123
- try {
124
- require('child_process').execSync(`npm uninstall cordova-plugin-samsungiap`, { stdio: 'inherit' });
125
- require('child_process').execSync(`npm uninstall @revenuecat/purchases-capacitor`, { stdio: 'inherit' });
126
- console.log("Both plugins uninstalled successfully.");
127
- } catch (err) {
128
- console.error("Error uninstalling plugins:", err);
129
- }
130
- return;
131
- }
132
-
133
- console.log(`Installing ${install} and uninstalling ${uninstall} for ${store}...`);
134
- try {
135
- if (install) {
136
- require('child_process').execSync(`npm install ${install}`, { stdio: 'inherit' });
137
- }
138
- if (uninstall) {
139
- require('child_process').execSync(`npm uninstall ${uninstall}`, { stdio: 'inherit' });
140
- }
141
- console.log(`${install} installed and ${uninstall} uninstalled successfully.`);
142
- } catch (err) {
143
- console.error(`Error managing packages for ${store}:`, err);
144
- }
145
- }
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+
5
+
6
+ const androidManifestPath = path.join("android", "app", "src", "main", "AndroidManifest.xml");
7
+
8
+ // Find the vite config file
9
+ const possibleConfigFiles = ['vite.config.mjs', 'vite.config.js'];
10
+ let viteConfigPath;
11
+
12
+ for (const configFile of possibleConfigFiles) {
13
+ const fullPath = path.resolve(configFile);
14
+ if (fs.existsSync(fullPath)) {
15
+ viteConfigPath = fullPath;
16
+ break;
17
+ }
18
+ }
19
+
20
+ if (!viteConfigPath) {
21
+ console.error('Error: No vite.config.mjs or vite.config.js file found.');
22
+ process.exit(1);
23
+ }
24
+
25
+ try {
26
+ // Read vite config file
27
+ const viteConfigContent = fs.readFileSync(viteConfigPath, 'utf-8');
28
+
29
+ // Extract @common alias path
30
+ const aliasPattern = /'@common':\s*path\.resolve\(__dirname,\s*'(.+?)'\)/;
31
+ const match = viteConfigContent.match(aliasPattern);
32
+
33
+ if (!match) {
34
+ console.error(`Error: @common alias not found in ${viteConfigPath}`);
35
+ process.exit(1);
36
+ }
37
+
38
+ const commonFilePath = match[1];
39
+ const resolvedCommonPath = path.resolve(__dirname, commonFilePath);
40
+
41
+ // Read the common file content
42
+ if (!fs.existsSync(resolvedCommonPath)) {
43
+ console.error(`Error: Resolved common file does not exist: ${resolvedCommonPath}`);
44
+ process.exit(1);
45
+ }
46
+
47
+ const commonFileContent = fs.readFileSync(resolvedCommonPath, 'utf-8');
48
+
49
+ // Extract _storeid value
50
+ const storeIdPattern = /export\s+let\s+_storeid\s*=\s*import\.meta\.env\.VITE_STORE_ID\s*\|\|\s*(\d+)\s*;/;
51
+
52
+ const storeMatch = commonFileContent.match(storeIdPattern);
53
+
54
+
55
+ if (!storeMatch) {
56
+ console.error(`Error: _storeid not found in ${resolvedCommonPath}`);
57
+ process.exit(1);
58
+ }
59
+
60
+ const _storeid = parseInt(storeMatch[1], 10);
61
+
62
+ // Determine the store name based on _storeid
63
+ let storeName = "";
64
+ if (_storeid === 1) {
65
+ storeName = "PlayStore";
66
+ } else if (_storeid === 2) {
67
+ storeName = "SamsungStore";
68
+ } else if (_storeid === 7) {
69
+ storeName = "AmazonStore";
70
+ } else {
71
+ console.error(`Error: Unsupported _storeid value: ${_storeid}`);
72
+ process.exit(1);
73
+ }
74
+
75
+
76
+ // Call managePackages with the determined store name
77
+ managePackages(storeName);
78
+
79
+ console.log(commonFilePath, `Success - _storeid found: ${_storeid}, Store: ${storeName}`);
80
+ } catch (error) {
81
+ console.error('Error:', error);
82
+ process.exit(1);
83
+ }
84
+
85
+ function managePackages(store) {
86
+ console.log(`Managing packages for store: ${store}`);
87
+
88
+ let install = "";
89
+ let uninstall = "";
90
+
91
+ //let androidManifestPath = "path/to/AndroidManifest.xml"; // Update this path
92
+
93
+
94
+ let manifestContent = fs.readFileSync(androidManifestPath, 'utf-8');
95
+
96
+ const permissionsToRemove = [
97
+ 'com.android.vending.BILLING',
98
+ 'com.samsung.android.iap.permission.BILLING'
99
+ ];
100
+
101
+ permissionsToRemove.forEach(permission => {
102
+ const permissionRegex = new RegExp(`^\\s*<uses-permission\\s+android:name="${permission}"\\s*/?>\\s*[\r\n]?`, 'm');
103
+ if (permissionRegex.test(manifestContent)) {
104
+ manifestContent = manifestContent.replace(permissionRegex, '');
105
+ console.log(`Removed <uses-permission android:name="${permission}" /> from AndroidManifest.xml`);
106
+ }
107
+ });
108
+
109
+ // Write the updated content back to the file
110
+ fs.writeFileSync(androidManifestPath, manifestContent, 'utf-8');
111
+
112
+ if (store === "PlayStore") {
113
+ install = '@revenuecat/purchases-capacitor';
114
+ uninstall = 'cordova-plugin-samsungiap';
115
+ } else if (store === "AmazonStore") {
116
+ install = '@revenuecat/purchases-capacitor';
117
+ uninstall = 'cordova-plugin-samsungiap';
118
+ } else if (store === "SamsungStore") {
119
+ install = 'cordova-plugin-samsungiap';
120
+ uninstall = '@revenuecat/purchases-capacitor';
121
+ } else {
122
+ console.log("No valid store specified. Uninstalling both plugins.");
123
+ try {
124
+ require('child_process').execSync(`npm uninstall cordova-plugin-samsungiap`, { stdio: 'inherit' });
125
+ require('child_process').execSync(`npm uninstall @revenuecat/purchases-capacitor`, { stdio: 'inherit' });
126
+ console.log("Both plugins uninstalled successfully.");
127
+ } catch (err) {
128
+ console.error("Error uninstalling plugins:", err);
129
+ }
130
+ return;
131
+ }
132
+
133
+ console.log(`Installing ${install} and uninstalling ${uninstall} for ${store}...`);
134
+ try {
135
+ if (install) {
136
+ require('child_process').execSync(`npm install ${install}`, { stdio: 'inherit' });
137
+ }
138
+ if (uninstall) {
139
+ require('child_process').execSync(`npm uninstall ${uninstall}`, { stdio: 'inherit' });
140
+ }
141
+ console.log(`${install} installed and ${uninstall} uninstalled successfully.`);
142
+ } catch (err) {
143
+ console.error(`Error managing packages for ${store}:`, err);
144
+ }
145
+ }
@@ -1,7 +1,7 @@
1
- {
2
- "name": "merbin-test-app",
3
- "integrations": {
4
- "capacitor": {}
5
- },
6
- "type": "custom"
1
+ {
2
+ "name": "merbin-test-app",
3
+ "integrations": {
4
+ "capacitor": {}
5
+ },
6
+ "type": "custom"
7
7
  }