codeplay-common 3.1.7 → 3.1.9
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/.gitattributes +2 -2
- package/LICENSE +21 -21
- package/README.md +11 -11
- package/files/buildCodeplay/add-splash-screen-1.6.js +254 -254
- package/files/buildCodeplay/{codeplayBeforeBuild-6.0.js → codeplayBeforeBuild-6.1.js} +173 -85
- package/files/finalrelease +924 -924
- package/files/iap-install-2.js +145 -145
- package/files/ionic.config.json +6 -6
- package/package.json +16 -16
- package/scripts/sync-files.js +86 -86
- package/scripts/uninstall.js +77 -77
|
@@ -327,13 +327,16 @@ checkAppUniqueId();
|
|
|
327
327
|
|
|
328
328
|
const jsDir = path.join(__dirname, "..", "src", "js");
|
|
329
329
|
|
|
330
|
-
//
|
|
330
|
+
// 🔍 Detect OLD structure
|
|
331
331
|
const oldEditorDirs = fs.readdirSync(jsDir)
|
|
332
332
|
.filter(name => /^editor-\d+\.\d+$/.test(name));
|
|
333
333
|
|
|
334
|
-
//
|
|
334
|
+
// 📁 New structure path (optional, not mandatory)
|
|
335
335
|
const newEditorBaseDir = path.join(jsDir, "editor");
|
|
336
336
|
|
|
337
|
+
// ======================================================
|
|
338
|
+
// ❌ CASE 1: OLD STRUCTURE FOUND → STOP
|
|
339
|
+
// ======================================================
|
|
337
340
|
if (oldEditorDirs.length > 0) {
|
|
338
341
|
|
|
339
342
|
console.error(`
|
|
@@ -342,127 +345,98 @@ if (oldEditorDirs.length > 0) {
|
|
|
342
345
|
You are using outdated folder structure:
|
|
343
346
|
src/js/editor-x.x/
|
|
344
347
|
|
|
345
|
-
🚨 This
|
|
346
|
-
|
|
347
|
-
✅ NEW STRUCTURE REQUIRED:
|
|
348
|
-
src/js/editor/editor-x.x/
|
|
348
|
+
🚨 This is no longer supported.
|
|
349
349
|
|
|
350
|
-
📦
|
|
350
|
+
📦 Found folders:
|
|
351
351
|
${oldEditorDirs.map(d => " - " + d).join("\n")}
|
|
352
352
|
|
|
353
|
-
👉 Please move them manually
|
|
353
|
+
👉 Please move them manually:
|
|
354
354
|
|
|
355
355
|
src/js/editor-1.6
|
|
356
|
-
⬇
|
|
356
|
+
⬇
|
|
357
357
|
src/js/editor/editor-1.6
|
|
358
358
|
|
|
359
|
-
⚠️
|
|
359
|
+
⚠️ Also ensure:
|
|
360
|
+
src/js/editor/configuration.json exists
|
|
360
361
|
|
|
361
|
-
❌ Build stopped
|
|
362
|
+
❌ Build stopped.
|
|
362
363
|
`);
|
|
363
364
|
|
|
364
365
|
process.exit(1);
|
|
365
366
|
}
|
|
366
367
|
|
|
367
|
-
//
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
❌ MISSING EDITOR DIRECTORY
|
|
372
|
-
|
|
373
|
-
Expected path:
|
|
374
|
-
src/js/editor/
|
|
375
|
-
|
|
376
|
-
But it was not found.
|
|
377
|
-
|
|
378
|
-
👉 Please create the folder and move editor-x.x inside it.
|
|
379
|
-
|
|
380
|
-
Example:
|
|
381
|
-
src/js/editor/editor-1.6/
|
|
382
|
-
`);
|
|
383
|
-
|
|
384
|
-
process.exit(1);
|
|
385
|
-
}
|
|
368
|
+
// ======================================================
|
|
369
|
+
// ✅ CASE 2: NEW STRUCTURE EXISTS → VALIDATE
|
|
370
|
+
// ======================================================
|
|
371
|
+
if (fs.existsSync(newEditorBaseDir)) {
|
|
386
372
|
|
|
373
|
+
// 🔍 Find editor-x.x inside new folder
|
|
374
|
+
const editorDirs = fs.readdirSync(newEditorBaseDir)
|
|
375
|
+
.filter(name => /^editor-\d+\.\d+$/.test(name));
|
|
387
376
|
|
|
377
|
+
// 👉 If editor folder exists but no versions → skip safely
|
|
378
|
+
if (editorDirs.length === 0) {
|
|
379
|
+
console.log("ℹ️ No editor-x.x folders found inside src/js/editor/");
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
388
382
|
|
|
389
|
-
// ======================================================
|
|
390
|
-
// Validate
|
|
391
|
-
// ======================================================
|
|
383
|
+
// ======================================================
|
|
384
|
+
// ✅ Validate configuration.json (NEW RULE)
|
|
385
|
+
// ======================================================
|
|
392
386
|
|
|
393
|
-
const editorConfigPath = path.join(newEditorBaseDir, "configuration.json");
|
|
387
|
+
const editorConfigPath = path.join(newEditorBaseDir, "configuration.json");
|
|
394
388
|
|
|
395
|
-
// ❌
|
|
396
|
-
if (!fs.existsSync(editorConfigPath)) {
|
|
397
|
-
|
|
389
|
+
// ❌ Missing config
|
|
390
|
+
if (!fs.existsSync(editorConfigPath)) {
|
|
391
|
+
console.error(`
|
|
398
392
|
❌ MISSING EDITOR CONFIGURATION FILE
|
|
399
393
|
|
|
400
|
-
Required
|
|
394
|
+
Required:
|
|
401
395
|
src/js/editor/configuration.json
|
|
402
396
|
|
|
403
|
-
👉 This file is mandatory in new editor structure.
|
|
404
|
-
|
|
405
|
-
📦 Please ensure:
|
|
406
|
-
src/js/editor/configuration.json exists
|
|
407
|
-
|
|
408
397
|
❌ Build stopped.
|
|
409
398
|
`);
|
|
410
|
-
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
// ❌ Check for OLD structure mistake inside version folders
|
|
414
|
-
const invalidConfigLocations = [];
|
|
399
|
+
process.exit(1);
|
|
400
|
+
}
|
|
415
401
|
|
|
416
|
-
|
|
417
|
-
|
|
402
|
+
// ❌ Check wrong placement
|
|
403
|
+
const invalidConfigs = [];
|
|
418
404
|
|
|
419
|
-
|
|
420
|
-
|
|
405
|
+
editorDirs.forEach(dir => {
|
|
406
|
+
const wrongPath = path.join(newEditorBaseDir, dir, "configuration.json");
|
|
407
|
+
if (fs.existsSync(wrongPath)) {
|
|
408
|
+
invalidConfigs.push(`src/js/editor/${dir}/configuration.json`);
|
|
409
|
+
}
|
|
410
|
+
});
|
|
421
411
|
|
|
422
|
-
if (
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
});
|
|
426
|
-
|
|
427
|
-
if (invalidConfigLocations.length > 0) {
|
|
428
|
-
console.error(`
|
|
429
|
-
❌ INVALID EDITOR CONFIGURATION STRUCTURE DETECTED
|
|
412
|
+
if (invalidConfigs.length > 0) {
|
|
413
|
+
console.error(`
|
|
414
|
+
❌ INVALID CONFIGURATION LOCATION
|
|
430
415
|
|
|
431
416
|
🚫 configuration.json must NOT be inside version folders.
|
|
432
417
|
|
|
433
|
-
Found
|
|
434
|
-
${
|
|
418
|
+
Found:
|
|
419
|
+
${invalidConfigs.map(p => " - " + p).join("\n")}
|
|
435
420
|
|
|
436
|
-
✅ Correct
|
|
421
|
+
✅ Correct:
|
|
437
422
|
src/js/editor/configuration.json
|
|
438
423
|
|
|
439
|
-
👉 Please MOVE or DELETE the above files.
|
|
440
|
-
|
|
441
424
|
❌ Build stopped.
|
|
442
425
|
`);
|
|
443
|
-
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
console.log("✅ Editor configuration structure validated.");
|
|
447
|
-
|
|
426
|
+
process.exit(1);
|
|
427
|
+
}
|
|
448
428
|
|
|
429
|
+
console.log("✅ Editor structure validated.");
|
|
449
430
|
|
|
431
|
+
// ======================================================
|
|
432
|
+
// 🚀 Continue execution (run.js)
|
|
433
|
+
// ======================================================
|
|
450
434
|
|
|
451
|
-
|
|
452
|
-
const
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
const [aMajor, aMinor] = getVersion(a);
|
|
457
|
-
const [bMajor, bMinor] = getVersion(b);
|
|
458
|
-
return bMajor - aMajor || bMinor - aMinor;
|
|
459
|
-
});
|
|
460
|
-
|
|
461
|
-
if (editorDirs.length === 0) {
|
|
462
|
-
console.log("@Codemirror editor(s) not found inside src/js/editor/");
|
|
463
|
-
} else {
|
|
464
|
-
|
|
465
|
-
const latestEditorDir = editorDirs[0];
|
|
435
|
+
const latestEditorDir = editorDirs.sort((a, b) => {
|
|
436
|
+
const vA = parseFloat(a.split('-')[1]);
|
|
437
|
+
const vB = parseFloat(b.split('-')[1]);
|
|
438
|
+
return vB - vA;
|
|
439
|
+
})[0];
|
|
466
440
|
|
|
467
441
|
const runJsPath = path.join(newEditorBaseDir, latestEditorDir, "run.js");
|
|
468
442
|
|
|
@@ -475,6 +449,13 @@ if (editorDirs.length === 0) {
|
|
|
475
449
|
execSync(`node "${runJsPath}"`, { stdio: "inherit" });
|
|
476
450
|
}
|
|
477
451
|
|
|
452
|
+
// ======================================================
|
|
453
|
+
// ✅ CASE 3: NOTHING EXISTS → DO NOTHING
|
|
454
|
+
// ======================================================
|
|
455
|
+
else {
|
|
456
|
+
console.log("ℹ️ Editor not used in this project. Skipping...");
|
|
457
|
+
}
|
|
458
|
+
|
|
478
459
|
//@Codemirror check and install/uninstall the packages END
|
|
479
460
|
|
|
480
461
|
|
|
@@ -2136,6 +2117,113 @@ validateAndRestoreSignDetails()
|
|
|
2136
2117
|
|
|
2137
2118
|
execSync('node buildCodeplay/fix-onesignal-plugin.js', { stdio: 'inherit' });
|
|
2138
2119
|
|
|
2120
|
+
|
|
2121
|
+
|
|
2122
|
+
|
|
2123
|
+
|
|
2124
|
+
|
|
2125
|
+
|
|
2126
|
+
//################################## SystemBars.java update for "@capacitor/android": "^8.3.0" plugin START ###############################
|
|
2127
|
+
|
|
2128
|
+
|
|
2129
|
+
const filePath = path.join(
|
|
2130
|
+
__dirname,
|
|
2131
|
+
"../node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/plugin/SystemBars.java"
|
|
2132
|
+
);
|
|
2133
|
+
|
|
2134
|
+
// 🔍 OLD BLOCK (anchor)
|
|
2135
|
+
const OLD_BLOCK = `if (shouldPassthroughInsets) {
|
|
2136
|
+
// We need to correct for a possible shown IME
|
|
2137
|
+
v.setPadding(0, 0, 0, keyboardVisible ? imeInsets.bottom : 0);
|
|
2138
|
+
|
|
2139
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM && hasViewportCover && insetHandlingEnabled) {
|
|
2140
|
+
Insets safeAreaInsets = calcSafeAreaInsets(insets);
|
|
2141
|
+
injectSafeAreaCSS(safeAreaInsets.top, safeAreaInsets.right, safeAreaInsets.bottom, safeAreaInsets.left);
|
|
2142
|
+
}
|
|
2143
|
+
|
|
2144
|
+
return new WindowInsetsCompat.Builder(insets)
|
|
2145
|
+
.setInsets(
|
|
2146
|
+
WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.displayCutout(),
|
|
2147
|
+
Insets.of(
|
|
2148
|
+
systemBarsInsets.left,
|
|
2149
|
+
systemBarsInsets.top,
|
|
2150
|
+
systemBarsInsets.right,
|
|
2151
|
+
getBottomInset(systemBarsInsets, keyboardVisible)
|
|
2152
|
+
)
|
|
2153
|
+
)
|
|
2154
|
+
.build();
|
|
2155
|
+
}`;
|
|
2156
|
+
|
|
2157
|
+
// ✅ NEW BLOCK
|
|
2158
|
+
const NEW_BLOCK = `if (shouldPassthroughInsets) {
|
|
2159
|
+
/* 🔴 ORIGINAL CODE (COMMENTED FOR SAFETY)
|
|
2160
|
+
${OLD_BLOCK.split("\n").map(line => " " + line).join("\n")}
|
|
2161
|
+
*/
|
|
2162
|
+
|
|
2163
|
+
// ✅ NEW LOGIC (CUSTOM FIX)
|
|
2164
|
+
v.setPadding(0, 0, 0, 0);
|
|
2165
|
+
|
|
2166
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM && hasViewportCover && insetHandlingEnabled) {
|
|
2167
|
+
Insets safeAreaInsets = calcSafeAreaInsets(insets);
|
|
2168
|
+
injectSafeAreaCSS(safeAreaInsets.top, safeAreaInsets.right, safeAreaInsets.bottom, safeAreaInsets.left);
|
|
2169
|
+
}
|
|
2170
|
+
|
|
2171
|
+
return insets; // WebView handles everything
|
|
2172
|
+
}`;
|
|
2173
|
+
|
|
2174
|
+
// 🚨 ERROR MESSAGE
|
|
2175
|
+
const ERROR_MSG = `
|
|
2176
|
+
❌ Capacitor SystemBars.java structure changed!
|
|
2177
|
+
|
|
2178
|
+
Plugin: @capacitor/android
|
|
2179
|
+
|
|
2180
|
+
👉 Expected code block not found.
|
|
2181
|
+
|
|
2182
|
+
This usually means Capacitor updated internally.
|
|
2183
|
+
|
|
2184
|
+
Please:
|
|
2185
|
+
1. Open SystemBars.java
|
|
2186
|
+
2. Update patch script
|
|
2187
|
+
3. Re-run build
|
|
2188
|
+
|
|
2189
|
+
⛔ Build stopped.
|
|
2190
|
+
`;
|
|
2191
|
+
|
|
2192
|
+
function patchFile() {
|
|
2193
|
+
if (!fs.existsSync(filePath)) {
|
|
2194
|
+
console.error("❌ SystemBars.java not found!");
|
|
2195
|
+
process.exit(1);
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
let content = fs.readFileSync(filePath, "utf8");
|
|
2199
|
+
|
|
2200
|
+
// ✅ Already patched?
|
|
2201
|
+
if (content.includes("🔴 ORIGINAL CODE (COMMENTED FOR SAFETY)")) {
|
|
2202
|
+
console.log("✅ Already SystemBars.java patched. Skipping...");
|
|
2203
|
+
return;
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
// 🔍 Check old block exists
|
|
2207
|
+
if (!content.includes(OLD_BLOCK)) {
|
|
2208
|
+
console.error(ERROR_MSG);
|
|
2209
|
+
process.exit(1);
|
|
2210
|
+
}
|
|
2211
|
+
|
|
2212
|
+
// 🔁 Replace
|
|
2213
|
+
const updated = content.replace(OLD_BLOCK, NEW_BLOCK);
|
|
2214
|
+
|
|
2215
|
+
fs.writeFileSync(filePath, updated, "utf8");
|
|
2216
|
+
|
|
2217
|
+
console.log("✅ SystemBars.java patched (comment + new logic)!");
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2220
|
+
patchFile();
|
|
2221
|
+
|
|
2222
|
+
//################################## SystemBars.java update for "@capacitor/android": "^8.3.0" plugin END ###############################
|
|
2223
|
+
|
|
2224
|
+
|
|
2225
|
+
|
|
2226
|
+
|
|
2139
2227
|
/*
|
|
2140
2228
|
Release Notes
|
|
2141
2229
|
|