codeplay-common 4.11.30 → 4.11.32
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 +115 -115
- package/LICENSE +21 -21
- package/README.md +368 -368
- package/RELEASE_NOTES.md +97 -97
- package/files/buildCodeplay/HUAWEI-PRIVACY.md +9 -9
- package/files/buildCodeplay/add-splash-screen.js +255 -255
- package/files/buildCodeplay/apk-store-builder.js +97 -97
- package/files/buildCodeplay/codeplayBeforeBuild.js +4769 -4756
- package/files/buildCodeplay/disabled-ads.mjs +45 -45
- package/files/buildCodeplay/ensure-current-build.cjs +42 -42
- package/files/buildCodeplay/fix-onesignal-plugin.js +96 -96
- package/files/buildCodeplay/huawei-privacy-entry.js +135 -135
- package/files/buildCodeplay/huawei-privacy.cjs +92 -92
- package/files/buildCodeplay/huawei-privacy.css +22 -22
- package/files/buildCodeplay/iap-alias.cjs +108 -116
- package/files/buildCodeplay/ios-ad-consent.cjs +56 -56
- package/files/buildCodeplay/ios-emi-admob-modification.js +49 -49
- package/files/buildCodeplay/manifestModification.js +38 -38
- package/files/buildCodeplay/migrate-system-bars.cjs +122 -115
- package/files/buildCodeplay/newly added.txt +89 -89
- package/files/buildCodeplay/non-google-billing.pro +3 -3
- package/files/buildCodeplay/packageidBaseModification.js +528 -528
- package/files/buildCodeplay/project-scripts.cjs +69 -69
- 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 +226 -226
- package/files/buildCodeplay/setup-ruads.cjs +55 -55
- package/files/buildCodeplay/splashxml/codeplay_splashScreen.xml +11 -11
- package/files/buildCodeplay/store-billing.cjs +43 -43
- package/files/buildCodeplay/sync-admob-nextgen.js +219 -219
- package/files/buildCodeplay/tests/huawei-privacy.test.cjs +49 -49
- package/files/buildCodeplay/tests/huawei-vite.test.cjs +35 -35
- package/files/buildCodeplay/versions.json +28 -28
- package/files/finalrelease +1365 -1365
- package/files/generate-ai-promo-video.js +23 -23
- package/files/ionic.config.json +6 -6
- package/files/scripts-common/generate-baseline-profile.js +46 -46
- package/files/scripts-common/run-codeplay-sync-after.js +21 -21
- package/files/scripts-common/screenshot/background-decorations.js +120 -120
- package/files/scripts-common/screenshot/frame-samples.js +117 -117
- package/files/scripts-common/setup-baseline-profile.js +291 -291
- package/files/take-screen-image.js +4414 -4414
- package/files/take-screen-video.js +644 -644
- package/package.json +3 -2
- 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 +78 -117
- 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/sync-files.js +120 -120
- package/scripts/system-bars-package.test.cjs +38 -0
- package/scripts/system-bars.test.cjs +93 -77
- package/scripts/uninstall.js +2 -2
- package/scripts/vite-build-settings.test.cjs +92 -92
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
const replaceEmiPluginCode=()=>
|
|
5
|
-
{
|
|
6
|
-
// path to your .m file
|
|
7
|
-
const filePath = path.join(__dirname, '../ios/capacitor-cordova-ios-plugins/sourcesstatic/EmiIndoCordovaPluginAdmob/emiAdmobPlugin.m');
|
|
8
|
-
const nextGenPackagePath = path.join(__dirname, '../node_modules/capacitor-admob-nextgen/package.json');
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (fs.existsSync(filePath)) {
|
|
12
|
-
let fileContent = fs.readFileSync(filePath, 'utf8');
|
|
13
|
-
|
|
14
|
-
// match the hideBannerAd method
|
|
15
|
-
const methodRegex = /(- \(void\)hideBannerAd:[\s\S]*?\{)([\s\S]*?)(^\})/m;
|
|
16
|
-
|
|
17
|
-
const match = fileContent.match(methodRegex);
|
|
18
|
-
|
|
19
|
-
if (match) {
|
|
20
|
-
const methodBody = match[2];
|
|
21
|
-
|
|
22
|
-
// replace only if the line is not already commented
|
|
23
|
-
const modifiedMethodBody = methodBody.replace(
|
|
24
|
-
/^(\s*)(?!\/\/)\[self\s+resetWebViewHeight\];/m,
|
|
25
|
-
'$1//[self resetWebViewHeight];'
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
const updatedFileContent =
|
|
29
|
-
fileContent.slice(0, match.index) +
|
|
30
|
-
match[1] +
|
|
31
|
-
modifiedMethodBody +
|
|
32
|
-
match[3] +
|
|
33
|
-
fileContent.slice(match.index + match[0].length);
|
|
34
|
-
|
|
35
|
-
fs.writeFileSync(filePath, updatedFileContent, 'utf8');
|
|
36
|
-
console.log(
|
|
37
|
-
'✅ Successfully ensured [self resetWebViewHeight]; is commented only inside hideBannerAd in emiAdmobPlugin.m'
|
|
38
|
-
);
|
|
39
|
-
} else {
|
|
40
|
-
console.log('⚠️ hideBannerAd method not found.');
|
|
41
|
-
}
|
|
42
|
-
} else if (fs.existsSync(nextGenPackagePath)) {
|
|
43
|
-
console.log('ℹ️ Skipping legacy iOS EMI AdMob patch. capacitor-admob-nextgen does not use emiAdmobPlugin.m.');
|
|
44
|
-
} else {
|
|
45
|
-
console.log('ℹ️ emiAdmobPlugin.m file not found, skipping modification.');
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
replaceEmiPluginCode();
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
const replaceEmiPluginCode=()=>
|
|
5
|
+
{
|
|
6
|
+
// path to your .m file
|
|
7
|
+
const filePath = path.join(__dirname, '../ios/capacitor-cordova-ios-plugins/sourcesstatic/EmiIndoCordovaPluginAdmob/emiAdmobPlugin.m');
|
|
8
|
+
const nextGenPackagePath = path.join(__dirname, '../node_modules/capacitor-admob-nextgen/package.json');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
if (fs.existsSync(filePath)) {
|
|
12
|
+
let fileContent = fs.readFileSync(filePath, 'utf8');
|
|
13
|
+
|
|
14
|
+
// match the hideBannerAd method
|
|
15
|
+
const methodRegex = /(- \(void\)hideBannerAd:[\s\S]*?\{)([\s\S]*?)(^\})/m;
|
|
16
|
+
|
|
17
|
+
const match = fileContent.match(methodRegex);
|
|
18
|
+
|
|
19
|
+
if (match) {
|
|
20
|
+
const methodBody = match[2];
|
|
21
|
+
|
|
22
|
+
// replace only if the line is not already commented
|
|
23
|
+
const modifiedMethodBody = methodBody.replace(
|
|
24
|
+
/^(\s*)(?!\/\/)\[self\s+resetWebViewHeight\];/m,
|
|
25
|
+
'$1//[self resetWebViewHeight];'
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const updatedFileContent =
|
|
29
|
+
fileContent.slice(0, match.index) +
|
|
30
|
+
match[1] +
|
|
31
|
+
modifiedMethodBody +
|
|
32
|
+
match[3] +
|
|
33
|
+
fileContent.slice(match.index + match[0].length);
|
|
34
|
+
|
|
35
|
+
fs.writeFileSync(filePath, updatedFileContent, 'utf8');
|
|
36
|
+
console.log(
|
|
37
|
+
'✅ Successfully ensured [self resetWebViewHeight]; is commented only inside hideBannerAd in emiAdmobPlugin.m'
|
|
38
|
+
);
|
|
39
|
+
} else {
|
|
40
|
+
console.log('⚠️ hideBannerAd method not found.');
|
|
41
|
+
}
|
|
42
|
+
} else if (fs.existsSync(nextGenPackagePath)) {
|
|
43
|
+
console.log('ℹ️ Skipping legacy iOS EMI AdMob patch. capacitor-admob-nextgen does not use emiAdmobPlugin.m.');
|
|
44
|
+
} else {
|
|
45
|
+
console.log('ℹ️ emiAdmobPlugin.m file not found, skipping modification.');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
replaceEmiPluginCode();
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const plist = require('plist');
|
|
4
|
-
const { syncAndroidR8Rules } = require('./fix-optimize-builld/restore-android-r8-rules.cjs');
|
|
5
|
-
|
|
6
|
-
syncAndroidR8Rules(process.cwd(), { installGradleHook: true });
|
|
7
|
-
|
|
8
|
-
const { readFileSync } = require("fs");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const addToolAttribute=()=>{
|
|
16
|
-
//const platformRoot = path.join(context.opts.projectRoot, 'android');
|
|
17
|
-
//const manifestPath = path.join(platformRoot, 'capacitor-cordova-android-plugins/src/main/AndroidManifest.xml');
|
|
18
|
-
|
|
19
|
-
const manifestPath = path.resolve(process.cwd(), 'android/capacitor-cordova-android-plugins/src/main/AndroidManifest.xml');
|
|
20
|
-
|
|
21
|
-
if (fs.existsSync(manifestPath)) {
|
|
22
|
-
let manifest = fs.readFileSync(manifestPath, 'utf8');
|
|
23
|
-
|
|
24
|
-
// Check if xmlns:tools exists
|
|
25
|
-
if (!manifest.includes('xmlns:tools="http://schemas.android.com/tools"')) {
|
|
26
|
-
// Add the tools namespace to the <manifest> tag.
|
|
27
|
-
manifest = manifest.replace('<manifest', '<manifest xmlns:tools="http://schemas.android.com/tools"');
|
|
28
|
-
fs.writeFileSync(manifestPath, manifest, 'utf8');
|
|
29
|
-
console.log('✅ Added xmlns:tools to AndroidManifest.xml');
|
|
30
|
-
} else {
|
|
31
|
-
console.log('ℹ️ xmlns:tools already exists, skipping...');
|
|
32
|
-
}
|
|
33
|
-
} else {
|
|
34
|
-
console.log('ℹ️ capacitor-cordova-android-plugins AndroidManifest.xml not found, skipping tools namespace update.');
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
addToolAttribute()
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const plist = require('plist');
|
|
4
|
+
const { syncAndroidR8Rules } = require('./fix-optimize-builld/restore-android-r8-rules.cjs');
|
|
5
|
+
|
|
6
|
+
syncAndroidR8Rules(process.cwd(), { installGradleHook: true });
|
|
7
|
+
|
|
8
|
+
const { readFileSync } = require("fs");
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
const addToolAttribute=()=>{
|
|
16
|
+
//const platformRoot = path.join(context.opts.projectRoot, 'android');
|
|
17
|
+
//const manifestPath = path.join(platformRoot, 'capacitor-cordova-android-plugins/src/main/AndroidManifest.xml');
|
|
18
|
+
|
|
19
|
+
const manifestPath = path.resolve(process.cwd(), 'android/capacitor-cordova-android-plugins/src/main/AndroidManifest.xml');
|
|
20
|
+
|
|
21
|
+
if (fs.existsSync(manifestPath)) {
|
|
22
|
+
let manifest = fs.readFileSync(manifestPath, 'utf8');
|
|
23
|
+
|
|
24
|
+
// Check if xmlns:tools exists
|
|
25
|
+
if (!manifest.includes('xmlns:tools="http://schemas.android.com/tools"')) {
|
|
26
|
+
// Add the tools namespace to the <manifest> tag.
|
|
27
|
+
manifest = manifest.replace('<manifest', '<manifest xmlns:tools="http://schemas.android.com/tools"');
|
|
28
|
+
fs.writeFileSync(manifestPath, manifest, 'utf8');
|
|
29
|
+
console.log('✅ Added xmlns:tools to AndroidManifest.xml');
|
|
30
|
+
} else {
|
|
31
|
+
console.log('ℹ️ xmlns:tools already exists, skipping...');
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
console.log('ℹ️ capacitor-cordova-android-plugins AndroidManifest.xml not found, skipping tools namespace update.');
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
addToolAttribute()
|
|
@@ -1,115 +1,122 @@
|
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
+
// Copied app helpers must also support npm nesting Terser inside this package.
|
|
51
|
+
const packagePath = require.resolve('codeplay-common/package.json', { paths: [projectRoot] });
|
|
52
|
+
({ minify } = createRequire(packagePath)('terser'));
|
|
53
|
+
} catch {
|
|
54
|
+
try {
|
|
55
|
+
// Source checkout and package-local execution resolve the declared dependency here.
|
|
56
|
+
({ minify } = require('terser'));
|
|
57
|
+
} catch {
|
|
58
|
+
return { status: 'retained', references: ['JavaScript parser unavailable; cannot prove the plugin is unused.'] };
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const files = sourceFiles(path.join(projectRoot, 'src'), /\.(?:js|cjs|mjs|ts|tsx|jsx|f7|vue|html)$/);
|
|
62
|
+
for (const entry of fs.readdirSync(projectRoot, { withFileTypes: true })) {
|
|
63
|
+
if (entry.isFile() && /\.(?:js|mjs|cjs|ts|tsx|jsx)$/.test(entry.name)) files.push(path.join(projectRoot, entry.name));
|
|
64
|
+
}
|
|
65
|
+
const references = [];
|
|
66
|
+
let modern = false;
|
|
67
|
+
for (const file of files) {
|
|
68
|
+
let code = fs.readFileSync(file, 'utf8');
|
|
69
|
+
if (!/StatusBar|@capacitor\/status-bar|\bSystemBars\b/.test(code)) continue;
|
|
70
|
+
try {
|
|
71
|
+
if (/\.(?:f7|vue|html)$/.test(file)) {
|
|
72
|
+
code = Array.from(code.matchAll(/<script\b[^>]*>([\s\S]*?)<\/script>/gi), match => match[1]).join('\n');
|
|
73
|
+
}
|
|
74
|
+
code = (await minify(code, { compress: false, mangle: false, module: true, format: { comments: false } })).code;
|
|
75
|
+
if (/\bSystemBars\b/.test(code) && /from["']@capacitor\/core["']/.test(code)) modern = true;
|
|
76
|
+
// This is the modern Capacitor enum, not the legacy StatusBar plugin.
|
|
77
|
+
code = code.replace(/\bSystemBarType\.StatusBar\b/g, '');
|
|
78
|
+
if (/\bStatusBar\b|@capacitor\/status-bar/.test(code)) references.push(path.relative(projectRoot, file));
|
|
79
|
+
} catch {
|
|
80
|
+
references.push(`${path.relative(projectRoot, file)} (parse review required)`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const native = [
|
|
84
|
+
...sourceFiles(path.join(projectRoot, 'android/app/src/main/java'), /\.(?:java|kt)$/),
|
|
85
|
+
...sourceFiles(path.join(projectRoot, 'ios/App/App'), /\.(?:swift|m|mm)$/)
|
|
86
|
+
];
|
|
87
|
+
for (const file of native) {
|
|
88
|
+
if (/StatusBarPlugin|com\.capacitorjs\.plugins\.statusbar|CapacitorStatusBar/.test(fs.readFileSync(file, 'utf8'))) references.push(path.relative(projectRoot, file));
|
|
89
|
+
}
|
|
90
|
+
if (!modern) references.push('Modern Capacitor SystemBars usage not confirmed.');
|
|
91
|
+
return { status: references.length ? 'retained' : 'unused', references };
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
async function migrateLegacyStatusBar(projectRoot = process.cwd(), options = {}) {
|
|
95
|
+
const result = await auditLegacyStatusBar(projectRoot);
|
|
96
|
+
if (result.status !== 'unused') return result;
|
|
97
|
+
const runNpm = options.runNpm || (command => execSync(command, { cwd: projectRoot, stdio: 'pipe' }));
|
|
98
|
+
// Suppress lifecycle hooks: removing this plugin must not reinstall shared
|
|
99
|
+
// templates, run a build, or change app-owned configuration.
|
|
100
|
+
runNpm('npm uninstall @capacitor/status-bar --ignore-scripts --no-audit --no-fund');
|
|
101
|
+
if (fs.existsSync(path.join(projectRoot, 'android/capacitor.settings.gradle'))) {
|
|
102
|
+
runNpm('npx --no-install cap update android');
|
|
103
|
+
}
|
|
104
|
+
const podfile = path.join(projectRoot, 'ios/App/Podfile');
|
|
105
|
+
if (fs.existsSync(podfile)) {
|
|
106
|
+
const original = fs.readFileSync(podfile, 'utf8');
|
|
107
|
+
const updated = original.replace(/^[ \t]*pod ['"]CapacitorStatusBar['"], :path => ['"]\.\.\/\.\.\/node_modules\/@capacitor\/status-bar['"][ \t]*\r?\n/gm, '');
|
|
108
|
+
if (updated !== original) fs.writeFileSync(podfile, updated, 'utf8');
|
|
109
|
+
}
|
|
110
|
+
return { status: 'removed', references: [] };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
module.exports = { migrateSystemBars, auditLegacyStatusBar, migrateLegacyStatusBar };
|
|
114
|
+
if (require.main === module) {
|
|
115
|
+
migrateSystemBars();
|
|
116
|
+
if (process.argv.includes('--remove-unused')) {
|
|
117
|
+
migrateLegacyStatusBar().then(result => console.log(JSON.stringify(result))).catch(error => {
|
|
118
|
+
console.error(error.message);
|
|
119
|
+
process.exitCode = 1;
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -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.**
|