codeplay-common 4.5.2 → 4.5.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.
Files changed (2) hide show
  1. package/files/finalrelease +43 -9
  2. package/package.json +1 -1
@@ -177,9 +177,39 @@ const androidManifestPath = join("android", "app", "src", "main", "AndroidManife
177
177
  const configPath = path.join(process.cwd(), 'capacitor.config.json');
178
178
  const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
179
179
 
180
- const _appUniqueId = config.android?.APP_UNIQUE_ID;
181
- const _appName=config.appName;
182
- const _appPackageId=config.appId;
180
+ const _appUniqueId = config.android?.APP_UNIQUE_ID;
181
+ const _appName=config.appName;
182
+ const _appPackageId=config.appId;
183
+
184
+ const FLOWCHART_API_APP_ID = 228;
185
+ const FLOWCHART_SHARED_PATH = join('public', 'src', 'shared.js');
186
+ const FLOWCHART_PLAY_API_BASE = 'https://htmlcodeplay.com/appfiles/128FlowChart';
187
+ const FLOWCHART_OTHER_STORE_API_BASE = 'https://htmlcodeplay.com/appfiles/128FlowChart/otherapi';
188
+ const FLOWCHART_OTHER_STORE_API_HASH = 'd1a3774529b74206ae2117f9c25f258e485a1f7348620e769db19c2796aa1fdf';
189
+ const flowchartSharedOriginal = existsSync(FLOWCHART_SHARED_PATH)
190
+ ? readFileSync(FLOWCHART_SHARED_PATH, 'utf8')
191
+ : null;
192
+
193
+ function applyFlowchartStoreApi(storeId) {
194
+ if (String(_appUniqueId) !== String(FLOWCHART_API_APP_ID) || !flowchartSharedOriginal) return false;
195
+ const apiBase = String(storeId) === '1' ? FLOWCHART_PLAY_API_BASE : FLOWCHART_OTHER_STORE_API_BASE;
196
+ const accessHash = String(storeId) === '1' ? '' : FLOWCHART_OTHER_STORE_API_HASH;
197
+ const updated = flowchartSharedOriginal
198
+ .replace(/const FLOWCHART_API_BASE = "[^"]*";/, `const FLOWCHART_API_BASE = "${apiBase}";`)
199
+ .replace(/const FLOWCHART_API_ACCESS_HASH = "[^"]*";/, `const FLOWCHART_API_ACCESS_HASH = "${accessHash}";`);
200
+ if (updated === flowchartSharedOriginal) {
201
+ throw new Error(`Flowchart API configuration markers were not found in ${FLOWCHART_SHARED_PATH}.`);
202
+ }
203
+ writeFileSync(FLOWCHART_SHARED_PATH, updated, 'utf8');
204
+ console.log(`✅ App 228 API endpoint configured for Store ID ${storeId}.`);
205
+ return true;
206
+ }
207
+
208
+ function restoreFlowchartStoreApi() {
209
+ if (String(_appUniqueId) === String(FLOWCHART_API_APP_ID) && flowchartSharedOriginal) {
210
+ writeFileSync(FLOWCHART_SHARED_PATH, flowchartSharedOriginal, 'utf8');
211
+ }
212
+ }
183
213
 
184
214
 
185
215
 
@@ -818,8 +848,9 @@ rl.question('Enter new versionCode (press enter to keep current): ', (newVersion
818
848
  if (!originalMinSdkVersion) {
819
849
  originalMinSdkVersion = currentMinSdkVersion;
820
850
  }
821
- try {
822
- // Modify the minSdkVersion based on the store
851
+ try {
852
+ applyFlowchartStoreApi(id);
853
+ // Modify the minSdkVersion based on the store
823
854
 
824
855
 
825
856
  if(currentMinSdkVersion==23 || currentMinSdkVersion==24)
@@ -931,10 +962,13 @@ rl.question('Enter new versionCode (press enter to keep current): ', (newVersion
931
962
  console.error(`❌ ${newExt.toUpperCase()} file not found after build.`);
932
963
  }
933
964
 
934
- } catch (error) {
935
- console.error(`❌ Error during build for Store ID ${id}:`, error);
936
- process.exit(1);
937
- }
965
+ } catch (error) {
966
+ console.error(`❌ Error during build for Store ID ${id}:`, error);
967
+ restoreFlowchartStoreApi();
968
+ process.exit(1);
969
+ } finally {
970
+ restoreFlowchartStoreApi();
971
+ }
938
972
  });
939
973
 
940
974
  rl.close(); // Close the readline interface after all operations
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeplay-common",
3
- "version": "4.5.2",
3
+ "version": "4.5.3",
4
4
  "description": "Common build scripts and files",
5
5
  "scripts": {
6
6
  "postinstall": "node scripts/sync-files.js",