codeplay-common 4.11.28 โ 4.11.30
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/CHANGELOG.md +1 -0
- package/README.md +89 -89
- package/RELEASE_NOTES.md +13 -13
- package/files/buildCodeplay/HUAWEI-PRIVACY.md +9 -0
- package/files/buildCodeplay/add-splash-screen.js +1 -1
- package/files/buildCodeplay/codeplayBeforeBuild.js +4756 -4755
- package/files/buildCodeplay/disabled-ads.mjs +45 -45
- package/files/buildCodeplay/ensure-current-build.cjs +42 -42
- package/files/buildCodeplay/fix-optimize-builld/android-r8-rules.cjs +31 -31
- package/files/buildCodeplay/fix-optimize-builld/ffmpeg-jni-rules.cjs +28 -28
- package/files/buildCodeplay/fix-optimize-builld/fix-optimize-build.gradle +9 -9
- package/files/buildCodeplay/fix-optimize-builld/restore-android-r8-rules.cjs +30 -30
- package/files/buildCodeplay/huawei-privacy-entry.js +135 -0
- package/files/buildCodeplay/huawei-privacy.cjs +92 -0
- package/files/buildCodeplay/huawei-privacy.css +22 -0
- package/files/buildCodeplay/iap-alias.cjs +116 -108
- package/files/buildCodeplay/ios-ad-consent.cjs +56 -56
- package/files/buildCodeplay/ios-emi-admob-modification.js +25 -25
- package/files/buildCodeplay/migrate-system-bars.cjs +115 -115
- package/files/buildCodeplay/newly added.txt +89 -89
- package/files/buildCodeplay/non-google-billing.pro +3 -3
- package/files/buildCodeplay/release-sync.config.json +4 -4
- package/files/buildCodeplay/remove-force-kotlin-disable.js +43 -43
- package/files/buildCodeplay/ruads.cjs +211 -211
- package/files/buildCodeplay/saf-mediastore-dependency.cjs +21 -21
- package/files/buildCodeplay/setSplashAnimation.js +2 -2
- package/files/buildCodeplay/setup-ruads.cjs +55 -55
- package/files/buildCodeplay/splash-setup.cjs +88 -88
- package/files/buildCodeplay/store-billing.cjs +43 -43
- package/files/buildCodeplay/tests/huawei-privacy.test.cjs +49 -0
- package/files/buildCodeplay/tests/huawei-vite.test.cjs +35 -0
- package/files/scripts-common/generate-baseline-profile.js +46 -46
- package/files/take-screen-image.js +4414 -4414
- package/package.json +28 -28
- package/runtime/splash-ready.mjs +52 -52
- package/runtime/vk-ads/vk-ad-configuration.json +39 -39
- package/scripts/ensure-current-build.test.cjs +76 -76
- package/scripts/iap-alias.test.cjs +117 -78
- package/scripts/ios-ad-consent.test.cjs +99 -99
- package/scripts/ruads-install.test.cjs +180 -180
- package/scripts/ruads-policy.test.cjs +174 -174
- package/scripts/saf-mediastore-dependency.test.cjs +44 -44
- package/scripts/splash-setup.test.cjs +142 -142
- package/scripts/sync-files.js +1 -1
- package/scripts/system-bars.test.cjs +77 -77
- package/scripts/vite-build-settings.test.cjs +92 -92
|
@@ -1,115 +1,115 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const { createRequire } = require('module');
|
|
4
|
-
const { execSync } = require('child_process');
|
|
5
|
-
|
|
6
|
-
// Keep legacy color support below Android 15; modern Android uses the existing
|
|
7
|
-
// inset-sized protection views and WindowInsetsController icon appearance.
|
|
8
|
-
function migrateSystemBars(projectRoot = process.cwd()) {
|
|
9
|
-
const pluginPath = path.join(projectRoot, 'node_modules/capacitor-codeplay-system-bars/android/src/main/java/com/codeplay/systembars/CodeplaySystemBarsPlugin.java');
|
|
10
|
-
if (!fs.existsSync(pluginPath)) return false;
|
|
11
|
-
const original = fs.readFileSync(pluginPath, 'utf8');
|
|
12
|
-
const newline = original.includes('\r\n') ? '\r\n' : '\n';
|
|
13
|
-
const marker = '// Codeplay: navigation bar colors are supplied by protection views on Android 15+.';
|
|
14
|
-
if (original.includes(marker)) return false;
|
|
15
|
-
|
|
16
|
-
const oldLine = ' window.setNavigationBarColor(Color.TRANSPARENT);';
|
|
17
|
-
if (original.split(oldLine).length !== 2 || !original.includes('window.getDecorView().post(this::updateNavigationBarProtection);')) {
|
|
18
|
-
throw new Error('System-bars plugin structure changed; review the Android 15 migration before building.');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const replacement = [
|
|
22
|
-
` ${marker}`,
|
|
23
|
-
' if (Build.VERSION.SDK_INT < Build.VERSION_CODES.VANILLA_ICE_CREAM) {',
|
|
24
|
-
' window.setNavigationBarColor(Color.TRANSPARENT);',
|
|
25
|
-
' }'
|
|
26
|
-
].join(newline);
|
|
27
|
-
fs.writeFileSync(pluginPath, original.replace(oldLine, replacement), 'utf8');
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function sourceFiles(directory, extensions, files = []) {
|
|
32
|
-
if (!fs.existsSync(directory)) return files;
|
|
33
|
-
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
|
|
34
|
-
if (entry.isSymbolicLink() || ['node_modules', '.git', 'agent-temp', 'test-results', 'www', 'public', 'Pods', 'build', 'dist'].includes(entry.name)) continue;
|
|
35
|
-
const file = path.join(directory, entry.name);
|
|
36
|
-
if (entry.isDirectory()) sourceFiles(file, extensions, files);
|
|
37
|
-
else if (extensions.test(entry.name)) files.push(file);
|
|
38
|
-
}
|
|
39
|
-
return files;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
async function auditLegacyStatusBar(projectRoot = process.cwd()) {
|
|
43
|
-
const pkg = JSON.parse(fs.readFileSync(path.join(projectRoot, 'package.json'), 'utf8'));
|
|
44
|
-
const dependency = '@capacitor/status-bar';
|
|
45
|
-
if (!pkg.dependencies?.[dependency] && !pkg.devDependencies?.[dependency] && !fs.existsSync(path.join(projectRoot, 'node_modules', dependency))) {
|
|
46
|
-
return { status: 'absent', references: [] };
|
|
47
|
-
}
|
|
48
|
-
let minify;
|
|
49
|
-
try {
|
|
50
|
-
({ minify } = createRequire(path.join(projectRoot, 'package.json'))('terser'));
|
|
51
|
-
} catch {
|
|
52
|
-
return { status: 'retained', references: ['JavaScript parser unavailable; cannot prove the plugin is unused.'] };
|
|
53
|
-
}
|
|
54
|
-
const files = sourceFiles(path.join(projectRoot, 'src'), /\.(?:js|cjs|mjs|ts|tsx|jsx|f7|vue|html)$/);
|
|
55
|
-
for (const entry of fs.readdirSync(projectRoot, { withFileTypes: true })) {
|
|
56
|
-
if (entry.isFile() && /\.(?:js|mjs|cjs|ts|tsx|jsx)$/.test(entry.name)) files.push(path.join(projectRoot, entry.name));
|
|
57
|
-
}
|
|
58
|
-
const references = [];
|
|
59
|
-
let modern = false;
|
|
60
|
-
for (const file of files) {
|
|
61
|
-
let code = fs.readFileSync(file, 'utf8');
|
|
62
|
-
if (!/StatusBar|@capacitor\/status-bar|\bSystemBars\b/.test(code)) continue;
|
|
63
|
-
try {
|
|
64
|
-
if (/\.(?:f7|vue|html)$/.test(file)) {
|
|
65
|
-
code = Array.from(code.matchAll(/<script\b[^>]*>([\s\S]*?)<\/script>/gi), match => match[1]).join('\n');
|
|
66
|
-
}
|
|
67
|
-
code = (await minify(code, { compress: false, mangle: false, module: true, format: { comments: false } })).code;
|
|
68
|
-
if (/\bSystemBars\b/.test(code) && /from["']@capacitor\/core["']/.test(code)) modern = true;
|
|
69
|
-
// This is the modern Capacitor enum, not the legacy StatusBar plugin.
|
|
70
|
-
code = code.replace(/\bSystemBarType\.StatusBar\b/g, '');
|
|
71
|
-
if (/\bStatusBar\b|@capacitor\/status-bar/.test(code)) references.push(path.relative(projectRoot, file));
|
|
72
|
-
} catch {
|
|
73
|
-
references.push(`${path.relative(projectRoot, file)} (parse review required)`);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
const native = [
|
|
77
|
-
...sourceFiles(path.join(projectRoot, 'android/app/src/main/java'), /\.(?:java|kt)$/),
|
|
78
|
-
...sourceFiles(path.join(projectRoot, 'ios/App/App'), /\.(?:swift|m|mm)$/)
|
|
79
|
-
];
|
|
80
|
-
for (const file of native) {
|
|
81
|
-
if (/StatusBarPlugin|com\.capacitorjs\.plugins\.statusbar|CapacitorStatusBar/.test(fs.readFileSync(file, 'utf8'))) references.push(path.relative(projectRoot, file));
|
|
82
|
-
}
|
|
83
|
-
if (!modern) references.push('Modern Capacitor SystemBars usage not confirmed.');
|
|
84
|
-
return { status: references.length ? 'retained' : 'unused', references };
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
async function migrateLegacyStatusBar(projectRoot = process.cwd(), options = {}) {
|
|
88
|
-
const result = await auditLegacyStatusBar(projectRoot);
|
|
89
|
-
if (result.status !== 'unused') return result;
|
|
90
|
-
const runNpm = options.runNpm || (command => execSync(command, { cwd: projectRoot, stdio: 'pipe' }));
|
|
91
|
-
// Suppress lifecycle hooks: removing this plugin must not reinstall shared
|
|
92
|
-
// templates, run a build, or change app-owned configuration.
|
|
93
|
-
runNpm('npm uninstall @capacitor/status-bar --ignore-scripts --no-audit --no-fund');
|
|
94
|
-
if (fs.existsSync(path.join(projectRoot, 'android/capacitor.settings.gradle'))) {
|
|
95
|
-
runNpm('npx --no-install cap update android');
|
|
96
|
-
}
|
|
97
|
-
const podfile = path.join(projectRoot, 'ios/App/Podfile');
|
|
98
|
-
if (fs.existsSync(podfile)) {
|
|
99
|
-
const original = fs.readFileSync(podfile, 'utf8');
|
|
100
|
-
const updated = original.replace(/^[ \t]*pod ['"]CapacitorStatusBar['"], :path => ['"]\.\.\/\.\.\/node_modules\/@capacitor\/status-bar['"][ \t]*\r?\n/gm, '');
|
|
101
|
-
if (updated !== original) fs.writeFileSync(podfile, updated, 'utf8');
|
|
102
|
-
}
|
|
103
|
-
return { status: 'removed', references: [] };
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
module.exports = { migrateSystemBars, auditLegacyStatusBar, migrateLegacyStatusBar };
|
|
107
|
-
if (require.main === module) {
|
|
108
|
-
migrateSystemBars();
|
|
109
|
-
if (process.argv.includes('--remove-unused')) {
|
|
110
|
-
migrateLegacyStatusBar().then(result => console.log(JSON.stringify(result))).catch(error => {
|
|
111
|
-
console.error(error.message);
|
|
112
|
-
process.exitCode = 1;
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { createRequire } = require('module');
|
|
4
|
+
const { execSync } = require('child_process');
|
|
5
|
+
|
|
6
|
+
// Keep legacy color support below Android 15; modern Android uses the existing
|
|
7
|
+
// inset-sized protection views and WindowInsetsController icon appearance.
|
|
8
|
+
function migrateSystemBars(projectRoot = process.cwd()) {
|
|
9
|
+
const pluginPath = path.join(projectRoot, 'node_modules/capacitor-codeplay-system-bars/android/src/main/java/com/codeplay/systembars/CodeplaySystemBarsPlugin.java');
|
|
10
|
+
if (!fs.existsSync(pluginPath)) return false;
|
|
11
|
+
const original = fs.readFileSync(pluginPath, 'utf8');
|
|
12
|
+
const newline = original.includes('\r\n') ? '\r\n' : '\n';
|
|
13
|
+
const marker = '// Codeplay: navigation bar colors are supplied by protection views on Android 15+.';
|
|
14
|
+
if (original.includes(marker)) return false;
|
|
15
|
+
|
|
16
|
+
const oldLine = ' window.setNavigationBarColor(Color.TRANSPARENT);';
|
|
17
|
+
if (original.split(oldLine).length !== 2 || !original.includes('window.getDecorView().post(this::updateNavigationBarProtection);')) {
|
|
18
|
+
throw new Error('System-bars plugin structure changed; review the Android 15 migration before building.');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const replacement = [
|
|
22
|
+
` ${marker}`,
|
|
23
|
+
' if (Build.VERSION.SDK_INT < Build.VERSION_CODES.VANILLA_ICE_CREAM) {',
|
|
24
|
+
' window.setNavigationBarColor(Color.TRANSPARENT);',
|
|
25
|
+
' }'
|
|
26
|
+
].join(newline);
|
|
27
|
+
fs.writeFileSync(pluginPath, original.replace(oldLine, replacement), 'utf8');
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function sourceFiles(directory, extensions, files = []) {
|
|
32
|
+
if (!fs.existsSync(directory)) return files;
|
|
33
|
+
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
|
|
34
|
+
if (entry.isSymbolicLink() || ['node_modules', '.git', 'agent-temp', 'test-results', 'www', 'public', 'Pods', 'build', 'dist'].includes(entry.name)) continue;
|
|
35
|
+
const file = path.join(directory, entry.name);
|
|
36
|
+
if (entry.isDirectory()) sourceFiles(file, extensions, files);
|
|
37
|
+
else if (extensions.test(entry.name)) files.push(file);
|
|
38
|
+
}
|
|
39
|
+
return files;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function auditLegacyStatusBar(projectRoot = process.cwd()) {
|
|
43
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(projectRoot, 'package.json'), 'utf8'));
|
|
44
|
+
const dependency = '@capacitor/status-bar';
|
|
45
|
+
if (!pkg.dependencies?.[dependency] && !pkg.devDependencies?.[dependency] && !fs.existsSync(path.join(projectRoot, 'node_modules', dependency))) {
|
|
46
|
+
return { status: 'absent', references: [] };
|
|
47
|
+
}
|
|
48
|
+
let minify;
|
|
49
|
+
try {
|
|
50
|
+
({ minify } = createRequire(path.join(projectRoot, 'package.json'))('terser'));
|
|
51
|
+
} catch {
|
|
52
|
+
return { status: 'retained', references: ['JavaScript parser unavailable; cannot prove the plugin is unused.'] };
|
|
53
|
+
}
|
|
54
|
+
const files = sourceFiles(path.join(projectRoot, 'src'), /\.(?:js|cjs|mjs|ts|tsx|jsx|f7|vue|html)$/);
|
|
55
|
+
for (const entry of fs.readdirSync(projectRoot, { withFileTypes: true })) {
|
|
56
|
+
if (entry.isFile() && /\.(?:js|mjs|cjs|ts|tsx|jsx)$/.test(entry.name)) files.push(path.join(projectRoot, entry.name));
|
|
57
|
+
}
|
|
58
|
+
const references = [];
|
|
59
|
+
let modern = false;
|
|
60
|
+
for (const file of files) {
|
|
61
|
+
let code = fs.readFileSync(file, 'utf8');
|
|
62
|
+
if (!/StatusBar|@capacitor\/status-bar|\bSystemBars\b/.test(code)) continue;
|
|
63
|
+
try {
|
|
64
|
+
if (/\.(?:f7|vue|html)$/.test(file)) {
|
|
65
|
+
code = Array.from(code.matchAll(/<script\b[^>]*>([\s\S]*?)<\/script>/gi), match => match[1]).join('\n');
|
|
66
|
+
}
|
|
67
|
+
code = (await minify(code, { compress: false, mangle: false, module: true, format: { comments: false } })).code;
|
|
68
|
+
if (/\bSystemBars\b/.test(code) && /from["']@capacitor\/core["']/.test(code)) modern = true;
|
|
69
|
+
// This is the modern Capacitor enum, not the legacy StatusBar plugin.
|
|
70
|
+
code = code.replace(/\bSystemBarType\.StatusBar\b/g, '');
|
|
71
|
+
if (/\bStatusBar\b|@capacitor\/status-bar/.test(code)) references.push(path.relative(projectRoot, file));
|
|
72
|
+
} catch {
|
|
73
|
+
references.push(`${path.relative(projectRoot, file)} (parse review required)`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const native = [
|
|
77
|
+
...sourceFiles(path.join(projectRoot, 'android/app/src/main/java'), /\.(?:java|kt)$/),
|
|
78
|
+
...sourceFiles(path.join(projectRoot, 'ios/App/App'), /\.(?:swift|m|mm)$/)
|
|
79
|
+
];
|
|
80
|
+
for (const file of native) {
|
|
81
|
+
if (/StatusBarPlugin|com\.capacitorjs\.plugins\.statusbar|CapacitorStatusBar/.test(fs.readFileSync(file, 'utf8'))) references.push(path.relative(projectRoot, file));
|
|
82
|
+
}
|
|
83
|
+
if (!modern) references.push('Modern Capacitor SystemBars usage not confirmed.');
|
|
84
|
+
return { status: references.length ? 'retained' : 'unused', references };
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async function migrateLegacyStatusBar(projectRoot = process.cwd(), options = {}) {
|
|
88
|
+
const result = await auditLegacyStatusBar(projectRoot);
|
|
89
|
+
if (result.status !== 'unused') return result;
|
|
90
|
+
const runNpm = options.runNpm || (command => execSync(command, { cwd: projectRoot, stdio: 'pipe' }));
|
|
91
|
+
// Suppress lifecycle hooks: removing this plugin must not reinstall shared
|
|
92
|
+
// templates, run a build, or change app-owned configuration.
|
|
93
|
+
runNpm('npm uninstall @capacitor/status-bar --ignore-scripts --no-audit --no-fund');
|
|
94
|
+
if (fs.existsSync(path.join(projectRoot, 'android/capacitor.settings.gradle'))) {
|
|
95
|
+
runNpm('npx --no-install cap update android');
|
|
96
|
+
}
|
|
97
|
+
const podfile = path.join(projectRoot, 'ios/App/Podfile');
|
|
98
|
+
if (fs.existsSync(podfile)) {
|
|
99
|
+
const original = fs.readFileSync(podfile, 'utf8');
|
|
100
|
+
const updated = original.replace(/^[ \t]*pod ['"]CapacitorStatusBar['"], :path => ['"]\.\.\/\.\.\/node_modules\/@capacitor\/status-bar['"][ \t]*\r?\n/gm, '');
|
|
101
|
+
if (updated !== original) fs.writeFileSync(podfile, updated, 'utf8');
|
|
102
|
+
}
|
|
103
|
+
return { status: 'removed', references: [] };
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
module.exports = { migrateSystemBars, auditLegacyStatusBar, migrateLegacyStatusBar };
|
|
107
|
+
if (require.main === module) {
|
|
108
|
+
migrateSystemBars();
|
|
109
|
+
if (process.argv.includes('--remove-unused')) {
|
|
110
|
+
migrateLegacyStatusBar().then(result => console.log(JSON.stringify(result))).catch(error => {
|
|
111
|
+
console.error(error.message);
|
|
112
|
+
process.exitCode = 1;
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
Note: This changes are added with my old(current) code. Might we need to integrate this features into our new optimized code.
|
|
2
|
-
|
|
3
|
-
1) If no import(saveToGalleryAndSaveAnyFile) found it through error issue is fixed
|
|
4
|
-
// iOS Checks
|
|
5
|
-
/* if (isMac && !iosImportFound) {
|
|
6
|
-
console.warn(`โ ๏ธ WARNING: You're on macOS but no iOS version (saveToGalleryAndSaveAnyFile-x.x-ios.js) found.`);
|
|
7
|
-
process.exit(1);
|
|
8
|
-
} else if (isMac && iosImportFound) {
|
|
9
|
-
console.log('โ
iOS version detected for macOS build.');
|
|
10
|
-
} else if (!iosImportFound) {
|
|
11
|
-
console.log('โ
No iOS-specific imports detected for non-macOS.');
|
|
12
|
-
} */
|
|
13
|
-
|
|
14
|
-
// โ
Only care if iOS import is found in NON-mac systems
|
|
15
|
-
if (iosImportFound && !isMac) {
|
|
16
|
-
console.error(`\nโ ERROR: iOS-specific file is imported in non-macOS environment.`);
|
|
17
|
-
process.exit(1);
|
|
18
|
-
} else if (iosImportFound && isMac) {
|
|
19
|
-
console.log('โ
iOS import detected (valid for macOS build).');
|
|
20
|
-
} else {
|
|
21
|
-
console.log('โ
No iOS-specific imports found (this is totally fine).');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
2) Statusbar color set in app startup is checked and through erro
|
|
26
|
-
|
|
27
|
-
const STATUSBAR_FILE = path.resolve(__dirname, '../src/js/common-configuration.js');
|
|
28
|
-
const STATUSBAR_REGEX = /^(?!\s*\/\/).*Capacitor\.Plugins\.StatusBar\.setStyle/m;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const ONESIGNAL_OLD_FILES = [
|
|
32
|
-
path.resolve(__dirname, '../src/js/onesignal-settings.js')
|
|
33
|
-
];
|
|
34
|
-
const ONESIGNAL_VERSION_REGEX = /^onesignal-\d+(\.\d+)*\.js$/;
|
|
35
|
-
|
|
36
|
-
....
|
|
37
|
-
....
|
|
38
|
-
....
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const JS_ROOT = path.resolve(__dirname, '../src/js');
|
|
42
|
-
const ONESIGNAL_DIR = path.join(JS_ROOT, 'onesignal');
|
|
43
|
-
|
|
44
|
-
// ๐จ Block old OneSignal file locations (ONLY in src/js root)
|
|
45
|
-
if (path.dirname(dir) === JS_ROOT) {
|
|
46
|
-
|
|
47
|
-
// โ onesignal-settings.js
|
|
48
|
-
if (ONESIGNAL_OLD_FILES.includes(dir)) {
|
|
49
|
-
console.error(`\nโ ERROR: onesignal-settings.js should not be in src/js/`);
|
|
50
|
-
console.error(`๐ Move it to: src/js/onesignal/`);
|
|
51
|
-
console.error(`๐ File: ${dir}\n`);
|
|
52
|
-
process.exit(1);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// โ onesignal-x.x.js
|
|
56
|
-
if (ONESIGNAL_VERSION_REGEX.test(baseName)) {
|
|
57
|
-
console.error(`\nโ ERROR: ${baseName} should not be in src/js/`);
|
|
58
|
-
console.error(`๐ Move it to: src/js/onesignal/`);
|
|
59
|
-
console.error(`๐ File: ${dir}\n`);
|
|
60
|
-
process.exit(1);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// ๐จ Special check ONLY for common-configuration.js
|
|
65
|
-
if (dir === STATUSBAR_FILE) {
|
|
66
|
-
let content = fs.readFileSync(dir, 'utf8');
|
|
67
|
-
|
|
68
|
-
// ๐งน Remove ALL comments (single-line + multi-line)
|
|
69
|
-
const contentWithoutComments = content
|
|
70
|
-
.replace(/\/\/.*$/gm, '') // remove // comments
|
|
71
|
-
.replace(/\/\*[\s\S]*?\*\//g, ''); // remove /* */ comments
|
|
72
|
-
|
|
73
|
-
// โ
Now check only real code
|
|
74
|
-
if (contentWithoutComments.includes('Capacitor.Plugins.StatusBar.setStyle')) {
|
|
75
|
-
console.error(`\nโ ERROR: StatusBar.setStyle should NOT be used in common-configuration.js`);
|
|
76
|
-
console.error(`๐ซ iOS status bar is controlled via other methods. Remove this line.`);
|
|
77
|
-
console.error(`๐ File: ${dir}\n`);
|
|
78
|
-
process.exit(1);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
3) Modification in "fix-onesignal-plugin.js" file
|
|
84
|
-
Search following and that whole block added for add permission to "info.plist" file
|
|
85
|
-
INFO.PLIST START
|
|
86
|
-
|
|
87
|
-
4) In "codeplayBeforeBuild-6.1.js" file following whole method is replaced. Due to add ads related permission to info.plist file
|
|
88
|
-
updateInfoPlist()
|
|
89
|
-
|
|
1
|
+
Note: This changes are added with my old(current) code. Might we need to integrate this features into our new optimized code.
|
|
2
|
+
|
|
3
|
+
1) If no import(saveToGalleryAndSaveAnyFile) found it through error issue is fixed
|
|
4
|
+
// iOS Checks
|
|
5
|
+
/* if (isMac && !iosImportFound) {
|
|
6
|
+
console.warn(`โ ๏ธ WARNING: You're on macOS but no iOS version (saveToGalleryAndSaveAnyFile-x.x-ios.js) found.`);
|
|
7
|
+
process.exit(1);
|
|
8
|
+
} else if (isMac && iosImportFound) {
|
|
9
|
+
console.log('โ
iOS version detected for macOS build.');
|
|
10
|
+
} else if (!iosImportFound) {
|
|
11
|
+
console.log('โ
No iOS-specific imports detected for non-macOS.');
|
|
12
|
+
} */
|
|
13
|
+
|
|
14
|
+
// โ
Only care if iOS import is found in NON-mac systems
|
|
15
|
+
if (iosImportFound && !isMac) {
|
|
16
|
+
console.error(`\nโ ERROR: iOS-specific file is imported in non-macOS environment.`);
|
|
17
|
+
process.exit(1);
|
|
18
|
+
} else if (iosImportFound && isMac) {
|
|
19
|
+
console.log('โ
iOS import detected (valid for macOS build).');
|
|
20
|
+
} else {
|
|
21
|
+
console.log('โ
No iOS-specific imports found (this is totally fine).');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
2) Statusbar color set in app startup is checked and through erro
|
|
26
|
+
|
|
27
|
+
const STATUSBAR_FILE = path.resolve(__dirname, '../src/js/common-configuration.js');
|
|
28
|
+
const STATUSBAR_REGEX = /^(?!\s*\/\/).*Capacitor\.Plugins\.StatusBar\.setStyle/m;
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
const ONESIGNAL_OLD_FILES = [
|
|
32
|
+
path.resolve(__dirname, '../src/js/onesignal-settings.js')
|
|
33
|
+
];
|
|
34
|
+
const ONESIGNAL_VERSION_REGEX = /^onesignal-\d+(\.\d+)*\.js$/;
|
|
35
|
+
|
|
36
|
+
....
|
|
37
|
+
....
|
|
38
|
+
....
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
const JS_ROOT = path.resolve(__dirname, '../src/js');
|
|
42
|
+
const ONESIGNAL_DIR = path.join(JS_ROOT, 'onesignal');
|
|
43
|
+
|
|
44
|
+
// ๐จ Block old OneSignal file locations (ONLY in src/js root)
|
|
45
|
+
if (path.dirname(dir) === JS_ROOT) {
|
|
46
|
+
|
|
47
|
+
// โ onesignal-settings.js
|
|
48
|
+
if (ONESIGNAL_OLD_FILES.includes(dir)) {
|
|
49
|
+
console.error(`\nโ ERROR: onesignal-settings.js should not be in src/js/`);
|
|
50
|
+
console.error(`๐ Move it to: src/js/onesignal/`);
|
|
51
|
+
console.error(`๐ File: ${dir}\n`);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// โ onesignal-x.x.js
|
|
56
|
+
if (ONESIGNAL_VERSION_REGEX.test(baseName)) {
|
|
57
|
+
console.error(`\nโ ERROR: ${baseName} should not be in src/js/`);
|
|
58
|
+
console.error(`๐ Move it to: src/js/onesignal/`);
|
|
59
|
+
console.error(`๐ File: ${dir}\n`);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// ๐จ Special check ONLY for common-configuration.js
|
|
65
|
+
if (dir === STATUSBAR_FILE) {
|
|
66
|
+
let content = fs.readFileSync(dir, 'utf8');
|
|
67
|
+
|
|
68
|
+
// ๐งน Remove ALL comments (single-line + multi-line)
|
|
69
|
+
const contentWithoutComments = content
|
|
70
|
+
.replace(/\/\/.*$/gm, '') // remove // comments
|
|
71
|
+
.replace(/\/\*[\s\S]*?\*\//g, ''); // remove /* */ comments
|
|
72
|
+
|
|
73
|
+
// โ
Now check only real code
|
|
74
|
+
if (contentWithoutComments.includes('Capacitor.Plugins.StatusBar.setStyle')) {
|
|
75
|
+
console.error(`\nโ ERROR: StatusBar.setStyle should NOT be used in common-configuration.js`);
|
|
76
|
+
console.error(`๐ซ iOS status bar is controlled via other methods. Remove this line.`);
|
|
77
|
+
console.error(`๐ File: ${dir}\n`);
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
3) Modification in "fix-onesignal-plugin.js" file
|
|
84
|
+
Search following and that whole block added for add permission to "info.plist" file
|
|
85
|
+
INFO.PLIST START
|
|
86
|
+
|
|
87
|
+
4) In "codeplayBeforeBuild-6.1.js" file following whole method is replaced. Due to add ads related permission to info.plist file
|
|
88
|
+
updateInfoPlist()
|
|
89
|
+
|
|
90
90
|
5) The "checkPackageVersion()" metod is updated. Now check the "codeplay-common" latest version and uninstall/install automatically.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# MyTracker checks for BillingClient/Purchase classes and disables its Google
|
|
2
|
-
# purchase helper when absent. These optional classes are excluded on stores 4/10.
|
|
3
|
-
-dontwarn com.android.billingclient.**
|
|
1
|
+
# MyTracker checks for BillingClient/Purchase classes and disables its Google
|
|
2
|
+
# purchase helper when absent. These optional classes are excluded on stores 4/10.
|
|
3
|
+
-dontwarn com.android.billingclient.**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{
|
|
2
|
-
"url": "https://htmlcodeplay.com/codeplay/api/v1/release/sync",
|
|
3
|
-
"token": ""
|
|
4
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"url": "https://htmlcodeplay.com/codeplay/api/v1/release/sync",
|
|
3
|
+
"token": ""
|
|
4
|
+
}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
const legacyPluginXmlPath = path.resolve(
|
|
5
|
-
__dirname,
|
|
6
|
-
'../node_modules/emi-indo-cordova-plugin-admob/plugin.xml'
|
|
7
|
-
);
|
|
8
|
-
|
|
9
|
-
const nextGenPackagePath = path.resolve(
|
|
10
|
-
__dirname,
|
|
11
|
-
'../node_modules/capacitor-admob-nextgen/package.json'
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
if (!fs.existsSync(legacyPluginXmlPath)) {
|
|
15
|
-
if (fs.existsSync(nextGenPackagePath)) {
|
|
16
|
-
console.log('โน๏ธ Skipping legacy Kotlin patch. capacitor-admob-nextgen is installed and does not use plugin.xml.');
|
|
17
|
-
process.exit(0);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
console.log('โน๏ธ Legacy AdMob plugin.xml not found, skipping Kotlin patch.');
|
|
21
|
-
process.exit(0);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
fs.readFile(legacyPluginXmlPath, 'utf8', (err, data) => {
|
|
25
|
-
if (err) {
|
|
26
|
-
console.error('Error reading plugin.xml:', err);
|
|
27
|
-
process.exit(1);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const modifiedData = data.replace(
|
|
31
|
-
/<framework\s+src="src\/android\/force-kotlin\.gradle"\s+custom="true"\s+type="gradleReference"\s*\/>\s*\n?/g,
|
|
32
|
-
''
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
fs.writeFile(legacyPluginXmlPath, modifiedData, 'utf8', (writeErr) => {
|
|
36
|
-
if (writeErr) {
|
|
37
|
-
console.error('Error writing plugin.xml:', writeErr);
|
|
38
|
-
process.exit(1);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
console.log('plugin.xml updated successfully.');
|
|
42
|
-
});
|
|
43
|
-
});
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
const legacyPluginXmlPath = path.resolve(
|
|
5
|
+
__dirname,
|
|
6
|
+
'../node_modules/emi-indo-cordova-plugin-admob/plugin.xml'
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
const nextGenPackagePath = path.resolve(
|
|
10
|
+
__dirname,
|
|
11
|
+
'../node_modules/capacitor-admob-nextgen/package.json'
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
if (!fs.existsSync(legacyPluginXmlPath)) {
|
|
15
|
+
if (fs.existsSync(nextGenPackagePath)) {
|
|
16
|
+
console.log('โน๏ธ Skipping legacy Kotlin patch. capacitor-admob-nextgen is installed and does not use plugin.xml.');
|
|
17
|
+
process.exit(0);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
console.log('โน๏ธ Legacy AdMob plugin.xml not found, skipping Kotlin patch.');
|
|
21
|
+
process.exit(0);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
fs.readFile(legacyPluginXmlPath, 'utf8', (err, data) => {
|
|
25
|
+
if (err) {
|
|
26
|
+
console.error('Error reading plugin.xml:', err);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const modifiedData = data.replace(
|
|
31
|
+
/<framework\s+src="src\/android\/force-kotlin\.gradle"\s+custom="true"\s+type="gradleReference"\s*\/>\s*\n?/g,
|
|
32
|
+
''
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
fs.writeFile(legacyPluginXmlPath, modifiedData, 'utf8', (writeErr) => {
|
|
36
|
+
if (writeErr) {
|
|
37
|
+
console.error('Error writing plugin.xml:', writeErr);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
console.log('plugin.xml updated successfully.');
|
|
42
|
+
});
|
|
43
|
+
});
|