codeplay-common 4.6.8 → 4.7.0
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.
- package/files/finalrelease +223 -223
- package/files/take-screen-image.js +5 -10
- package/package.json +1 -1
package/files/finalrelease
CHANGED
|
@@ -16,135 +16,135 @@ import { dirname } from 'path';
|
|
|
16
16
|
/* const path = require('path');
|
|
17
17
|
const fs = require('fs'); */
|
|
18
18
|
|
|
19
|
-
import fs from 'fs';
|
|
20
|
-
import path from 'path';
|
|
21
|
-
|
|
22
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
23
|
-
const __dirname = dirname(__filename);
|
|
24
|
-
|
|
25
|
-
function stripJavaScriptComments(content) {
|
|
26
|
-
let result = '';
|
|
27
|
-
let state = 'code';
|
|
28
|
-
|
|
29
|
-
for (let index = 0; index < content.length; index++) {
|
|
30
|
-
const character = content[index];
|
|
31
|
-
const nextCharacter = content[index + 1];
|
|
32
|
-
|
|
33
|
-
if (state === 'lineComment') {
|
|
34
|
-
if (character === '\n') {
|
|
35
|
-
result += character;
|
|
36
|
-
state = 'code';
|
|
37
|
-
} else {
|
|
38
|
-
result += ' ';
|
|
39
|
-
}
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (state === 'blockComment') {
|
|
44
|
-
if (character === '*' && nextCharacter === '/') {
|
|
45
|
-
result += ' ';
|
|
46
|
-
index++;
|
|
47
|
-
state = 'code';
|
|
48
|
-
} else {
|
|
49
|
-
result += character === '\n' ? '\n' : ' ';
|
|
50
|
-
}
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (state !== 'code') {
|
|
55
|
-
result += character;
|
|
56
|
-
|
|
57
|
-
if (character === '\\') {
|
|
58
|
-
if (nextCharacter !== undefined) {
|
|
59
|
-
result += nextCharacter;
|
|
60
|
-
index++;
|
|
61
|
-
}
|
|
62
|
-
} else if (
|
|
63
|
-
(state === 'singleQuote' && character === "'") ||
|
|
64
|
-
(state === 'doubleQuote' && character === '"') ||
|
|
65
|
-
(state === 'templateLiteral' && character === '`')
|
|
66
|
-
) {
|
|
67
|
-
state = 'code';
|
|
68
|
-
}
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (character === '/' && nextCharacter === '/') {
|
|
73
|
-
result += ' ';
|
|
74
|
-
index++;
|
|
75
|
-
state = 'lineComment';
|
|
76
|
-
} else if (character === '/' && nextCharacter === '*') {
|
|
77
|
-
result += ' ';
|
|
78
|
-
index++;
|
|
79
|
-
state = 'blockComment';
|
|
80
|
-
} else {
|
|
81
|
-
result += character;
|
|
82
|
-
|
|
83
|
-
if (character === "'") state = 'singleQuote';
|
|
84
|
-
else if (character === '"') state = 'doubleQuote';
|
|
85
|
-
else if (character === '`') state = 'templateLiteral';
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return result;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function checkProductionAdmobAlias() {
|
|
93
|
-
const possibleConfigFiles = ['vite.config.mjs', 'vite.config.js'];
|
|
94
|
-
const viteConfigPath = possibleConfigFiles
|
|
95
|
-
.map(configFile => resolve(__dirname, configFile))
|
|
96
|
-
.find(filePath => existsSync(filePath));
|
|
97
|
-
|
|
98
|
-
if (!viteConfigPath) {
|
|
99
|
-
console.error('❌ FINAL RELEASE BLOCKED: No vite.config.mjs or vite.config.js file found.');
|
|
100
|
-
process.exit(1);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const viteConfigContent = stripJavaScriptComments(readFileSync(viteConfigPath, 'utf8'));
|
|
104
|
-
const aliasPattern = /(['"])@admob\1\s*:\s*path\.resolve\(\s*__dirname\s*,\s*(['"])([^'"\r\n]+)\2\s*\)/g;
|
|
105
|
-
const activeAliases = [...viteConfigContent.matchAll(aliasPattern)].map(match => match[3]);
|
|
106
|
-
const productionAliasPattern = /^\.\/src\/js\/Ads\/admob-emi-nextgen-\d+(?:\.\d+)+\.js$/;
|
|
107
|
-
|
|
108
|
-
if (activeAliases.length === 0) {
|
|
109
|
-
console.error('❌ FINAL RELEASE BLOCKED: The production @admob alias is commented out or missing in the Vite config.');
|
|
110
|
-
console.error(" Enable: '@admob': path.resolve(__dirname, './src/js/Ads/admob-emi-nextgen-x.x.js')");
|
|
111
|
-
process.exit(1);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if (activeAliases.length > 1) {
|
|
115
|
-
console.error('❌ FINAL RELEASE BLOCKED: Multiple active @admob aliases were found in the Vite config.');
|
|
116
|
-
console.error(' Keep exactly one active production admob-emi-nextgen-x.x.js alias.');
|
|
117
|
-
process.exit(1);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
const activeAlias = activeAliases[0];
|
|
121
|
-
if (!productionAliasPattern.test(activeAlias)) {
|
|
122
|
-
console.error(`❌ FINAL RELEASE BLOCKED: @admob currently points to '${activeAlias}'.`);
|
|
123
|
-
console.error(" It must point to './src/js/Ads/admob-emi-nextgen-x.x.js', not a test AdMob file.");
|
|
124
|
-
process.exit(1);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
const productionAdmobPath = resolve(__dirname, activeAlias);
|
|
128
|
-
if (!existsSync(productionAdmobPath)) {
|
|
129
|
-
console.error(`❌ FINAL RELEASE BLOCKED: The production @admob file does not exist: ${productionAdmobPath}`);
|
|
130
|
-
process.exit(1);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
console.log(`✅ Production @admob alias verified: ${activeAlias}`);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// This must be the first release validation so test/no-ad builds cannot proceed.
|
|
137
|
-
checkProductionAdmobAlias();
|
|
138
|
-
|
|
139
|
-
// Define a mapping between store IDs and store names
|
|
140
|
-
/* const storeNames = {
|
|
19
|
+
import fs from 'fs';
|
|
20
|
+
import path from 'path';
|
|
21
|
+
|
|
22
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
23
|
+
const __dirname = dirname(__filename);
|
|
24
|
+
|
|
25
|
+
function stripJavaScriptComments(content) {
|
|
26
|
+
let result = '';
|
|
27
|
+
let state = 'code';
|
|
28
|
+
|
|
29
|
+
for (let index = 0; index < content.length; index++) {
|
|
30
|
+
const character = content[index];
|
|
31
|
+
const nextCharacter = content[index + 1];
|
|
32
|
+
|
|
33
|
+
if (state === 'lineComment') {
|
|
34
|
+
if (character === '\n') {
|
|
35
|
+
result += character;
|
|
36
|
+
state = 'code';
|
|
37
|
+
} else {
|
|
38
|
+
result += ' ';
|
|
39
|
+
}
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (state === 'blockComment') {
|
|
44
|
+
if (character === '*' && nextCharacter === '/') {
|
|
45
|
+
result += ' ';
|
|
46
|
+
index++;
|
|
47
|
+
state = 'code';
|
|
48
|
+
} else {
|
|
49
|
+
result += character === '\n' ? '\n' : ' ';
|
|
50
|
+
}
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (state !== 'code') {
|
|
55
|
+
result += character;
|
|
56
|
+
|
|
57
|
+
if (character === '\\') {
|
|
58
|
+
if (nextCharacter !== undefined) {
|
|
59
|
+
result += nextCharacter;
|
|
60
|
+
index++;
|
|
61
|
+
}
|
|
62
|
+
} else if (
|
|
63
|
+
(state === 'singleQuote' && character === "'") ||
|
|
64
|
+
(state === 'doubleQuote' && character === '"') ||
|
|
65
|
+
(state === 'templateLiteral' && character === '`')
|
|
66
|
+
) {
|
|
67
|
+
state = 'code';
|
|
68
|
+
}
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (character === '/' && nextCharacter === '/') {
|
|
73
|
+
result += ' ';
|
|
74
|
+
index++;
|
|
75
|
+
state = 'lineComment';
|
|
76
|
+
} else if (character === '/' && nextCharacter === '*') {
|
|
77
|
+
result += ' ';
|
|
78
|
+
index++;
|
|
79
|
+
state = 'blockComment';
|
|
80
|
+
} else {
|
|
81
|
+
result += character;
|
|
82
|
+
|
|
83
|
+
if (character === "'") state = 'singleQuote';
|
|
84
|
+
else if (character === '"') state = 'doubleQuote';
|
|
85
|
+
else if (character === '`') state = 'templateLiteral';
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function checkProductionAdmobAlias() {
|
|
93
|
+
const possibleConfigFiles = ['vite.config.mjs', 'vite.config.js'];
|
|
94
|
+
const viteConfigPath = possibleConfigFiles
|
|
95
|
+
.map(configFile => resolve(__dirname, configFile))
|
|
96
|
+
.find(filePath => existsSync(filePath));
|
|
97
|
+
|
|
98
|
+
if (!viteConfigPath) {
|
|
99
|
+
console.error('❌ FINAL RELEASE BLOCKED: No vite.config.mjs or vite.config.js file found.');
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const viteConfigContent = stripJavaScriptComments(readFileSync(viteConfigPath, 'utf8'));
|
|
104
|
+
const aliasPattern = /(['"])@admob\1\s*:\s*path\.resolve\(\s*__dirname\s*,\s*(['"])([^'"\r\n]+)\2\s*\)/g;
|
|
105
|
+
const activeAliases = [...viteConfigContent.matchAll(aliasPattern)].map(match => match[3]);
|
|
106
|
+
const productionAliasPattern = /^\.\/src\/js\/Ads\/admob-emi-nextgen-\d+(?:\.\d+)+\.js$/;
|
|
107
|
+
|
|
108
|
+
if (activeAliases.length === 0) {
|
|
109
|
+
console.error('❌ FINAL RELEASE BLOCKED: The production @admob alias is commented out or missing in the Vite config.');
|
|
110
|
+
console.error(" Enable: '@admob': path.resolve(__dirname, './src/js/Ads/admob-emi-nextgen-x.x.js')");
|
|
111
|
+
process.exit(1);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (activeAliases.length > 1) {
|
|
115
|
+
console.error('❌ FINAL RELEASE BLOCKED: Multiple active @admob aliases were found in the Vite config.');
|
|
116
|
+
console.error(' Keep exactly one active production admob-emi-nextgen-x.x.js alias.');
|
|
117
|
+
process.exit(1);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const activeAlias = activeAliases[0];
|
|
121
|
+
if (!productionAliasPattern.test(activeAlias)) {
|
|
122
|
+
console.error(`❌ FINAL RELEASE BLOCKED: @admob currently points to '${activeAlias}'.`);
|
|
123
|
+
console.error(" It must point to './src/js/Ads/admob-emi-nextgen-x.x.js', not a test AdMob file.");
|
|
124
|
+
process.exit(1);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const productionAdmobPath = resolve(__dirname, activeAlias);
|
|
128
|
+
if (!existsSync(productionAdmobPath)) {
|
|
129
|
+
console.error(`❌ FINAL RELEASE BLOCKED: The production @admob file does not exist: ${productionAdmobPath}`);
|
|
130
|
+
process.exit(1);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
console.log(`✅ Production @admob alias verified: ${activeAlias}`);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// This must be the first release validation so test/no-ad builds cannot proceed.
|
|
137
|
+
checkProductionAdmobAlias();
|
|
138
|
+
|
|
139
|
+
// Define a mapping between store IDs and store names
|
|
140
|
+
/* const storeNames = {
|
|
141
141
|
"1": "PlayStore",
|
|
142
142
|
"2": "SamsungStore",
|
|
143
143
|
"7": "AmazonStore"
|
|
144
144
|
}; */
|
|
145
145
|
|
|
146
146
|
|
|
147
|
-
const isOnlyOneAPK =
|
|
147
|
+
const isOnlyOneAPK = false; // 🔥 change to false for normal behavior
|
|
148
148
|
|
|
149
149
|
const storeNames = {
|
|
150
150
|
"1": "PlayStore",
|
|
@@ -177,47 +177,47 @@ 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;
|
|
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 apiBaseMarker = /const FLOWCHART_API_BASE = "[^"]*";/;
|
|
198
|
-
const accessHashMarker = /const FLOWCHART_API_ACCESS_HASH = "[^"]*";/;
|
|
199
|
-
|
|
200
|
-
if (!apiBaseMarker.test(flowchartSharedOriginal) || !accessHashMarker.test(flowchartSharedOriginal)) {
|
|
201
|
-
throw new Error(`Flowchart API configuration markers were not found in ${FLOWCHART_SHARED_PATH}.`);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
const updated = flowchartSharedOriginal
|
|
205
|
-
.replace(apiBaseMarker, `const FLOWCHART_API_BASE = "${apiBase}";`)
|
|
206
|
-
.replace(accessHashMarker, `const FLOWCHART_API_ACCESS_HASH = "${accessHash}";`);
|
|
207
|
-
writeFileSync(FLOWCHART_SHARED_PATH, updated, 'utf8');
|
|
208
|
-
console.log(`✅ App 228 API endpoint configured for Store ID ${storeId}.`);
|
|
209
|
-
return true;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
function restoreFlowchartStoreApi() {
|
|
213
|
-
if (String(_appUniqueId) === String(FLOWCHART_API_APP_ID) && flowchartSharedOriginal) {
|
|
214
|
-
writeFileSync(FLOWCHART_SHARED_PATH, flowchartSharedOriginal, 'utf8');
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
function fileExists(filePath) {
|
|
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 apiBaseMarker = /const FLOWCHART_API_BASE = "[^"]*";/;
|
|
198
|
+
const accessHashMarker = /const FLOWCHART_API_ACCESS_HASH = "[^"]*";/;
|
|
199
|
+
|
|
200
|
+
if (!apiBaseMarker.test(flowchartSharedOriginal) || !accessHashMarker.test(flowchartSharedOriginal)) {
|
|
201
|
+
throw new Error(`Flowchart API configuration markers were not found in ${FLOWCHART_SHARED_PATH}.`);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const updated = flowchartSharedOriginal
|
|
205
|
+
.replace(apiBaseMarker, `const FLOWCHART_API_BASE = "${apiBase}";`)
|
|
206
|
+
.replace(accessHashMarker, `const FLOWCHART_API_ACCESS_HASH = "${accessHash}";`);
|
|
207
|
+
writeFileSync(FLOWCHART_SHARED_PATH, updated, 'utf8');
|
|
208
|
+
console.log(`✅ App 228 API endpoint configured for Store ID ${storeId}.`);
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function restoreFlowchartStoreApi() {
|
|
213
|
+
if (String(_appUniqueId) === String(FLOWCHART_API_APP_ID) && flowchartSharedOriginal) {
|
|
214
|
+
writeFileSync(FLOWCHART_SHARED_PATH, flowchartSharedOriginal, 'utf8');
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
function fileExists(filePath) {
|
|
221
221
|
return existsSync(filePath);
|
|
222
222
|
}
|
|
223
223
|
|
|
@@ -679,7 +679,7 @@ const gradleFilePath = join("android", "app", "build.gradle");
|
|
|
679
679
|
const gradleContent = readFileSync(gradleFilePath, 'utf8');
|
|
680
680
|
|
|
681
681
|
// Return the character range of a Gradle block, allowing nested blocks inside it.
|
|
682
|
-
function findGradleBlock(content, headerPattern) {
|
|
682
|
+
function findGradleBlock(content, headerPattern) {
|
|
683
683
|
const headerMatch = content.match(headerPattern);
|
|
684
684
|
if (!headerMatch) return null;
|
|
685
685
|
const openingBrace = content.indexOf('{', headerMatch.index + headerMatch[0].length);
|
|
@@ -697,43 +697,43 @@ function findGradleBlock(content, headerPattern) {
|
|
|
697
697
|
else if (character === '{') depth += 1;
|
|
698
698
|
else if (character === '}' && --depth === 0) return { start: openingBrace + 1, end: index };
|
|
699
699
|
}
|
|
700
|
-
return null;
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
const amazonWindowExtensionsDependency = 'implementation "androidx.window.extensions.core:core:1.0.0"';
|
|
704
|
-
const amazonWindowExtensionsDependencyPattern = /^[ \t]*implementation\s+["']androidx\.window\.extensions\.core:core:[^"']+["'][ \t]*(?:\r?\n)?/gm;
|
|
705
|
-
|
|
706
|
-
function setAmazonWindowExtensionsDependency(enabled, { cleanup = false } = {}) {
|
|
707
|
-
const currentGradleContent = readFileSync(gradleFilePath, 'utf8');
|
|
708
|
-
let nextGradleContent = currentGradleContent.replace(amazonWindowExtensionsDependencyPattern, '');
|
|
709
|
-
|
|
710
|
-
if (enabled) {
|
|
711
|
-
const dependenciesBlock = findGradleBlock(nextGradleContent, /^\s*dependencies\s*/m);
|
|
712
|
-
if (!dependenciesBlock) {
|
|
713
|
-
throw new Error(`The dependencies block was not found in ${gradleFilePath}.`);
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
const newline = nextGradleContent.includes('\r\n') ? '\r\n' : '\n';
|
|
717
|
-
const contentBeforeClosingBrace = nextGradleContent.slice(0, dependenciesBlock.end);
|
|
718
|
-
const linePrefix = contentBeforeClosingBrace.endsWith('\n') ? '' : newline;
|
|
719
|
-
nextGradleContent = contentBeforeClosingBrace
|
|
720
|
-
+ linePrefix
|
|
721
|
-
+ ` ${amazonWindowExtensionsDependency}${newline}`
|
|
722
|
-
+ nextGradleContent.slice(dependenciesBlock.end);
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
if (nextGradleContent !== currentGradleContent) {
|
|
726
|
-
writeFileSync(gradleFilePath, nextGradleContent, 'utf8');
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
console.log(enabled
|
|
730
|
-
? '✅ Added Amazon Fire WebView compatibility dependency for Store ID 7.'
|
|
731
|
-
: cleanup
|
|
732
|
-
? 'ℹ️ Removed temporary Amazon Fire WebView compatibility dependency after build cleanup.'
|
|
733
|
-
: 'ℹ️ Amazon Fire WebView compatibility dependency is not included for this build.');
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
const versionCodeMatch = gradleContent.match(/versionCode\s+(\d+)/);
|
|
700
|
+
return null;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
const amazonWindowExtensionsDependency = 'implementation "androidx.window.extensions.core:core:1.0.0"';
|
|
704
|
+
const amazonWindowExtensionsDependencyPattern = /^[ \t]*implementation\s+["']androidx\.window\.extensions\.core:core:[^"']+["'][ \t]*(?:\r?\n)?/gm;
|
|
705
|
+
|
|
706
|
+
function setAmazonWindowExtensionsDependency(enabled, { cleanup = false } = {}) {
|
|
707
|
+
const currentGradleContent = readFileSync(gradleFilePath, 'utf8');
|
|
708
|
+
let nextGradleContent = currentGradleContent.replace(amazonWindowExtensionsDependencyPattern, '');
|
|
709
|
+
|
|
710
|
+
if (enabled) {
|
|
711
|
+
const dependenciesBlock = findGradleBlock(nextGradleContent, /^\s*dependencies\s*/m);
|
|
712
|
+
if (!dependenciesBlock) {
|
|
713
|
+
throw new Error(`The dependencies block was not found in ${gradleFilePath}.`);
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
const newline = nextGradleContent.includes('\r\n') ? '\r\n' : '\n';
|
|
717
|
+
const contentBeforeClosingBrace = nextGradleContent.slice(0, dependenciesBlock.end);
|
|
718
|
+
const linePrefix = contentBeforeClosingBrace.endsWith('\n') ? '' : newline;
|
|
719
|
+
nextGradleContent = contentBeforeClosingBrace
|
|
720
|
+
+ linePrefix
|
|
721
|
+
+ ` ${amazonWindowExtensionsDependency}${newline}`
|
|
722
|
+
+ nextGradleContent.slice(dependenciesBlock.end);
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
if (nextGradleContent !== currentGradleContent) {
|
|
726
|
+
writeFileSync(gradleFilePath, nextGradleContent, 'utf8');
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
console.log(enabled
|
|
730
|
+
? '✅ Added Amazon Fire WebView compatibility dependency for Store ID 7.'
|
|
731
|
+
: cleanup
|
|
732
|
+
? 'ℹ️ Removed temporary Amazon Fire WebView compatibility dependency after build cleanup.'
|
|
733
|
+
: 'ℹ️ Amazon Fire WebView compatibility dependency is not included for this build.');
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
const versionCodeMatch = gradleContent.match(/versionCode\s+(\d+)/);
|
|
737
737
|
const versionNameMatch = gradleContent.match(/versionName\s+"([^"]+)"/);
|
|
738
738
|
|
|
739
739
|
const versionCode = versionCodeMatch ? versionCodeMatch[1] : '';
|
|
@@ -885,11 +885,11 @@ rl.question('Enter new versionCode (press enter to keep current): ', (newVersion
|
|
|
885
885
|
if (!originalMinSdkVersion) {
|
|
886
886
|
originalMinSdkVersion = currentMinSdkVersion;
|
|
887
887
|
}
|
|
888
|
-
try {
|
|
889
|
-
applyFlowchartStoreApi(id);
|
|
890
|
-
const shouldIncludeAmazonWindowExtensions = String(id) === '7' && amazon === true;
|
|
891
|
-
setAmazonWindowExtensionsDependency(shouldIncludeAmazonWindowExtensions);
|
|
892
|
-
// Modify the minSdkVersion based on the store
|
|
888
|
+
try {
|
|
889
|
+
applyFlowchartStoreApi(id);
|
|
890
|
+
const shouldIncludeAmazonWindowExtensions = String(id) === '7' && amazon === true;
|
|
891
|
+
setAmazonWindowExtensionsDependency(shouldIncludeAmazonWindowExtensions);
|
|
892
|
+
// Modify the minSdkVersion based on the store
|
|
893
893
|
|
|
894
894
|
|
|
895
895
|
if(currentMinSdkVersion==23 || currentMinSdkVersion==24)
|
|
@@ -1001,19 +1001,19 @@ rl.question('Enter new versionCode (press enter to keep current): ', (newVersion
|
|
|
1001
1001
|
console.error(`❌ ${newExt.toUpperCase()} file not found after build.`);
|
|
1002
1002
|
}
|
|
1003
1003
|
|
|
1004
|
-
} catch (error) {
|
|
1005
|
-
console.error(`❌ Error during build for Store ID ${id}:`, error);
|
|
1006
|
-
restoreFlowchartStoreApi();
|
|
1007
|
-
setAmazonWindowExtensionsDependency(false, {
|
|
1008
|
-
cleanup: String(id) === '7' && amazon === true,
|
|
1009
|
-
});
|
|
1010
|
-
process.exit(1);
|
|
1011
|
-
} finally {
|
|
1012
|
-
restoreFlowchartStoreApi();
|
|
1013
|
-
setAmazonWindowExtensionsDependency(false, {
|
|
1014
|
-
cleanup: String(id) === '7' && amazon === true,
|
|
1015
|
-
});
|
|
1016
|
-
}
|
|
1004
|
+
} catch (error) {
|
|
1005
|
+
console.error(`❌ Error during build for Store ID ${id}:`, error);
|
|
1006
|
+
restoreFlowchartStoreApi();
|
|
1007
|
+
setAmazonWindowExtensionsDependency(false, {
|
|
1008
|
+
cleanup: String(id) === '7' && amazon === true,
|
|
1009
|
+
});
|
|
1010
|
+
process.exit(1);
|
|
1011
|
+
} finally {
|
|
1012
|
+
restoreFlowchartStoreApi();
|
|
1013
|
+
setAmazonWindowExtensionsDependency(false, {
|
|
1014
|
+
cleanup: String(id) === '7' && amazon === true,
|
|
1015
|
+
});
|
|
1016
|
+
}
|
|
1017
1017
|
});
|
|
1018
1018
|
|
|
1019
1019
|
rl.close(); // Close the readline interface after all operations
|
|
@@ -1058,9 +1058,9 @@ function managePackages(store) {
|
|
|
1058
1058
|
uninstall = 'cordova-plugin-samsungiap';
|
|
1059
1059
|
|
|
1060
1060
|
// Update AndroidManifest.xml for PlayStore
|
|
1061
|
-
if (playstore && store === "PlayStore")
|
|
1062
|
-
updateAndroidManifest(store,
|
|
1063
|
-
'<uses-permission android:name="com.android.vending.BILLING" />');
|
|
1061
|
+
if (playstore && store === "PlayStore")
|
|
1062
|
+
updateAndroidManifest(store,
|
|
1063
|
+
'<uses-permission android:name="com.android.vending.BILLING" />');
|
|
1064
1064
|
|
|
1065
1065
|
} else if (samsung && store === "SamsungStore") {
|
|
1066
1066
|
install = 'cordova-plugin-samsungiap';
|
|
@@ -93,7 +93,7 @@ const deviceProfiles = [
|
|
|
93
93
|
outputFormat: 'jpeg',
|
|
94
94
|
outputExtension: 'jpg',
|
|
95
95
|
storeRequirements: {
|
|
96
|
-
maxFileSizeBytes:
|
|
96
|
+
maxFileSizeBytes: 1000 * 1000,
|
|
97
97
|
minPixels: 320,
|
|
98
98
|
maxPixels: 1920,
|
|
99
99
|
minAspectRatio: 0.5,
|
|
@@ -2185,12 +2185,9 @@ async function captureFramedScreenshot(
|
|
|
2185
2185
|
const originalImageMetadata = profile.storeRequirements
|
|
2186
2186
|
? await sharp(screenshotBuffer).metadata()
|
|
2187
2187
|
: null;
|
|
2188
|
-
const
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
const hasCustomFrameSize = Boolean(frameDimensions || (profile.framedWidth && profile.framedHeight));
|
|
2192
|
-
const frameWidth = frameDimensions?.width || profile.framedWidth || profile.width;
|
|
2193
|
-
const frameHeight = frameDimensions?.height || profile.framedHeight || profile.height;
|
|
2188
|
+
const hasCustomFrameSize = Boolean(profile.framedWidth && profile.framedHeight);
|
|
2189
|
+
const frameWidth = profile.framedWidth || profile.width;
|
|
2190
|
+
const frameHeight = profile.framedHeight || profile.height;
|
|
2194
2191
|
const frameScaleFactor = hasCustomFrameSize ? 1 : profile.deviceScaleFactor;
|
|
2195
2192
|
|
|
2196
2193
|
await client.send('Emulation.setDeviceMetricsOverride', {
|
|
@@ -2236,9 +2233,7 @@ async function captureFramedScreenshot(
|
|
|
2236
2233
|
});
|
|
2237
2234
|
|
|
2238
2235
|
const framedScreenshotBuffer = Buffer.from(framedScreenshot.data, 'base64');
|
|
2239
|
-
|
|
2240
|
-
validateStoreImage(profile, frameWidth, frameHeight, framedScreenshotBuffer);
|
|
2241
|
-
}
|
|
2236
|
+
validateStoreImage(profile, frameWidth, frameHeight, framedScreenshotBuffer);
|
|
2242
2237
|
|
|
2243
2238
|
fs.mkdirSync(framedProfileDirectory, { recursive: true });
|
|
2244
2239
|
fs.writeFileSync(
|