codeplay-common 4.11.35 → 4.11.37
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 +380 -374
- package/RELEASE_NOTES.md +110 -110
- package/files/buildCodeplay/HUAWEI-PRIVACY.md +9 -9
- package/files/buildCodeplay/add-splash-screen.js +256 -256
- package/files/buildCodeplay/apk-store-builder.js +97 -97
- package/files/buildCodeplay/codeplayBeforeBuild.js +4793 -4793
- package/files/buildCodeplay/disabled-ads.mjs +53 -53
- package/files/buildCodeplay/fix-onesignal-plugin.js +96 -96
- 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.cjs +102 -92
- package/files/buildCodeplay/iap-alias.cjs +116 -116
- package/files/buildCodeplay/ios-emi-admob-modification.js +24 -24
- package/files/buildCodeplay/manifestModification.js +38 -38
- package/files/buildCodeplay/migrate-system-bars.cjs +122 -122
- package/files/buildCodeplay/packageidBaseModification.js +528 -528
- package/files/buildCodeplay/project-scripts.cjs +69 -69
- package/files/buildCodeplay/ruads.cjs +10 -1
- package/files/buildCodeplay/setSplashAnimation.js +228 -228
- package/files/buildCodeplay/setup-ruads.cjs +9 -2
- package/files/buildCodeplay/splash-setup.cjs +88 -88
- package/files/buildCodeplay/splashxml/codeplay_splashScreen.xml +11 -11
- package/files/buildCodeplay/sync-admob-nextgen.js +219 -219
- package/files/buildCodeplay/tests/huawei-live-reload.test.cjs +60 -0
- package/files/buildCodeplay/tests/huawei-multiple-entries.test.cjs +80 -0
- package/files/buildCodeplay/tests/huawei-vite.test.cjs +38 -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/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-video.js +644 -644
- package/package.json +29 -29
- package/runtime/splash-ready.mjs +52 -52
- package/scripts/iap-alias.test.cjs +117 -117
- package/scripts/ruads-install.test.cjs +20 -3
- package/scripts/splash-setup.test.cjs +142 -142
- package/scripts/squeezeback-config.test.cjs +78 -78
- package/scripts/sync-files.js +119 -119
- package/scripts/system-bars-package.test.cjs +38 -38
- package/scripts/system-bars.test.cjs +93 -93
- package/scripts/uninstall.js +2 -2
- package/scripts/vite-build-settings.test.cjs +1 -0
|
@@ -19,7 +19,7 @@ export default async (environment) => {
|
|
|
19
19
|
const settings = JSON.parse(codeplayReadConfig(codeplayResolve('capacitor.config.json'), 'utf8'));
|
|
20
20
|
const storeId = process.env.VITE_STORE_ID || '1';
|
|
21
21
|
const platform = process.env.CODEPLAY_BUILD_PLATFORM || (storeId === '6' ? 'ios' : 'android');
|
|
22
|
-
const aliases = base.resolve?.alias || {};
|
|
22
|
+
const aliases = ruAdsBuild.withBuildCodeplayAlias(base.resolve?.alias || {}, codeplayResolve('buildCodeplay'));
|
|
23
23
|
const current = Array.isArray(aliases) ? aliases.find(item => item.find === '@admob')?.replacement : aliases['@admob'];
|
|
24
24
|
const provider = ruAdsBuild.getAdProvider(settings, storeId, platform);
|
|
25
25
|
if (!current && provider === 'vk') {
|
|
@@ -35,7 +35,14 @@ export default async (environment) => {
|
|
|
35
35
|
};
|
|
36
36
|
`);
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
let current = fs.readFileSync(vite, 'utf8');
|
|
39
|
+
if (current.includes('codeplayOriginalViteConfig') && !current.includes('ruAdsBuild.withBuildCodeplayAlias(')) {
|
|
40
|
+
const updated = current.replace('const aliases = base.resolve?.alias || {};',
|
|
41
|
+
"const aliases = ruAdsBuild.withBuildCodeplayAlias(base.resolve?.alias || {}, codeplayResolve('buildCodeplay'));");
|
|
42
|
+
if (updated === current) throw new Error('Cannot install Huawei Live Reload path mapping in the Vite wrapper.');
|
|
43
|
+
fs.writeFileSync(vite, updated);
|
|
44
|
+
current = updated;
|
|
45
|
+
}
|
|
39
46
|
if (current.includes('codeplayOriginalViteConfig') && !current.includes('ruAdsBuild.admobConfigPlugin(')) {
|
|
40
47
|
const updated = current.replace('return { ...base, resolve:', 'return { ...base, plugins: [...(base.plugins || []), ruAdsBuild.admobConfigPlugin(provider)], resolve:');
|
|
41
48
|
if (updated === current) throw new Error('Cannot install store AdMob config filtering in the Vite wrapper.');
|
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const crypto = require('crypto');
|
|
4
|
-
const runtimeImport = "import { hideSplashWhenReady } from 'codeplay-common/runtime/splash-ready.mjs';";
|
|
5
|
-
const knownReadyHash = '451fd2e0ca63712e0f771ee0ed03ae5bd3a379f0ca1e75e971cd7acee0802a2b';
|
|
6
|
-
|
|
7
|
-
function readSplashOptions(config) {
|
|
8
|
-
const options = config.plugins?.CodeplaySplashScreen || {};
|
|
9
|
-
const duration = options.exitAnimationDuration ?? 1000;
|
|
10
|
-
const timeout = options.readinessTimeout ?? 8000;
|
|
11
|
-
const imageSelector = options.readyImageSelector ?? '[data-splash-ready], .t-film-art img';
|
|
12
|
-
if (!Number.isInteger(duration) || duration < 0 || duration > 10000) throw new Error('CodeplaySplashScreen.exitAnimationDuration must be an integer from0 to10000.');
|
|
13
|
-
if (!Number.isInteger(timeout) || timeout < 1 || timeout > 60000) throw new Error('CodeplaySplashScreen.readinessTimeout must be an integer from1 to60000.');
|
|
14
|
-
if (typeof imageSelector !== 'string') throw new Error('CodeplaySplashScreen.readyImageSelector must be a string.');
|
|
15
|
-
if (options.migrateLegacyReadiness !== undefined && typeof options.migrateLegacyReadiness !== 'boolean') throw new Error('CodeplaySplashScreen.migrateLegacyReadiness must be boolean.');
|
|
16
|
-
return { duration, timeout, imageSelector, migrateLegacy: options.migrateLegacyReadiness === true };
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function migrateSplashTheme(content) {
|
|
20
|
-
// Repair only the known package default; preserve custom themes and styling.
|
|
21
|
-
return content.replace(/(<item\s+name=["']postSplashScreenTheme["']\s*>\s*)@style\/Theme\.AppCompat\.NoActionBar(\s*<\/item>)/g,
|
|
22
|
-
'$1@style/Theme.AppCompat.DayNight.NoActionBar$2');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function migrateReadinessSource(source, options) {
|
|
26
|
-
if (!/\b(?:var|let|const)\s+capacitorApp\s*=/.test(source)) return { source, status: 'unsupported' };
|
|
27
|
-
const handler = / handleSplashscreen:\s*function\s*\(\)\s*\{([\s\S]*?)\r?\n \},/;
|
|
28
|
-
const match = source.match(handler);
|
|
29
|
-
if (!match) return { source, status: 'unsupported' };
|
|
30
|
-
const body = match[1].replace(/\s+/g, '');
|
|
31
|
-
const isReady = crypto.createHash('sha256').update(body).digest('hex') === knownReadyHash;
|
|
32
|
-
const isManaged = /^if\(!window\.Capacitor\)return;returnhideSplashWhenReady\(\{f7:capacitorApp\.f7,hide:\(\)=>SplashScreen\.hide\(\),imageSelector:"(?:\\.|[^"\\])*",timeout:\d+\}\);$/.test(body)
|
|
33
|
-
&& source.includes(runtimeImport);
|
|
34
|
-
const isLegacy = body === "if(!window.Capacitor)return;setTimeout(()=>{if(window.Capacitor.Plugins?.SplashScreen)window.Capacitor.Plugins.SplashScreen.hide();},2000);"
|
|
35
|
-
|| body === "if(!window.Capacitor)return;setTimeout(()=>{if(window.Capacitor.Plugins&&window.Capacitor.Plugins.SplashScreen){window.Capacitor.Plugins.SplashScreen.hide();}},2000);";
|
|
36
|
-
if (!isReady && !isManaged && !(isLegacy && options.migrateLegacy)) return { source, status: isLegacy ? 'opt-in-required' : 'custom-preserved' };
|
|
37
|
-
const newline = source.includes('\r\n') ? '\r\n' : '\n';
|
|
38
|
-
const method = [
|
|
39
|
-
' handleSplashscreen: function () {',
|
|
40
|
-
' if (!window.Capacitor) return;',
|
|
41
|
-
' return hideSplashWhenReady({',
|
|
42
|
-
' f7: capacitorApp.f7,',
|
|
43
|
-
' hide: () => SplashScreen.hide(),',
|
|
44
|
-
` imageSelector: ${JSON.stringify(options.imageSelector)},`,
|
|
45
|
-
` timeout: ${options.timeout}`, ' });', ' },'
|
|
46
|
-
].join(newline);
|
|
47
|
-
let updated = source.replace(handler, () => method);
|
|
48
|
-
if (!updated.includes(runtimeImport)) updated = runtimeImport + newline + updated;
|
|
49
|
-
if (!/import\s*\{[^}]*\bSplashScreen\b[^}]*\}\s*from\s*['"]@capacitor\/splash-screen['"]/.test(updated)) {
|
|
50
|
-
updated = "import { SplashScreen } from '@capacitor/splash-screen';" + newline + updated;
|
|
51
|
-
}
|
|
52
|
-
return { source: updated, status: 'managed' };
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function syncSplashSetup(projectRoot, { log = console.log } = {}) {
|
|
56
|
-
const configPath = path.join(projectRoot, 'capacitor.config.json');
|
|
57
|
-
if (!fs.existsSync(configPath)) return;
|
|
58
|
-
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
59
|
-
const options = readSplashOptions(config);
|
|
60
|
-
const theme = path.join(projectRoot, 'buildCodeplay/splashxml/codeplay_splashScreen.xml');
|
|
61
|
-
if (fs.existsSync(theme)) {
|
|
62
|
-
const content = fs.readFileSync(theme, 'utf8');
|
|
63
|
-
const updated = migrateSplashTheme(content);
|
|
64
|
-
if (updated !== content) { fs.writeFileSync(theme, updated); log('codeplay-common: repaired legacy splash DayNight theme template; Android sync applies it.'); }
|
|
65
|
-
}
|
|
66
|
-
const app = path.join(projectRoot, 'src/js/capacitor-app.js');
|
|
67
|
-
if (!fs.existsSync(app)) return;
|
|
68
|
-
const source = fs.readFileSync(app, 'utf8');
|
|
69
|
-
const migrated = migrateReadinessSource(source, options);
|
|
70
|
-
if (migrated.status === 'managed') {
|
|
71
|
-
if (source !== migrated.source) {
|
|
72
|
-
const launch = config.plugins?.SplashScreen;
|
|
73
|
-
if (launch?.launchAutoHide !== true || !(launch.launchShowDuration >= options.timeout)) {
|
|
74
|
-
log('codeplay-common: readiness migration skipped; set SplashScreen.launchAutoHide=true and launchShowDuration>=readinessTimeout for the native fallback.');
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
const dependency = JSON.parse(fs.readFileSync(path.join(projectRoot, 'package.json'), 'utf8'));
|
|
78
|
-
if (!dependency.dependencies?.['@capacitor/splash-screen'] && !dependency.devDependencies?.['@capacitor/splash-screen']) {
|
|
79
|
-
log('codeplay-common: readiness migration skipped; @capacitor/splash-screen must be installed.');
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
fs.writeFileSync(app, migrated.source);
|
|
83
|
-
log('codeplay-common: connected supported startup handler to shared splash readiness.');
|
|
84
|
-
}
|
|
85
|
-
} else log(`codeplay-common: splash readiness ${migrated.status}; app startup preserved. See shared splash setup in README.`);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
module.exports = { readSplashOptions, migrateSplashTheme, migrateReadinessSource, syncSplashSetup };
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const crypto = require('crypto');
|
|
4
|
+
const runtimeImport = "import { hideSplashWhenReady } from 'codeplay-common/runtime/splash-ready.mjs';";
|
|
5
|
+
const knownReadyHash = '451fd2e0ca63712e0f771ee0ed03ae5bd3a379f0ca1e75e971cd7acee0802a2b';
|
|
6
|
+
|
|
7
|
+
function readSplashOptions(config) {
|
|
8
|
+
const options = config.plugins?.CodeplaySplashScreen || {};
|
|
9
|
+
const duration = options.exitAnimationDuration ?? 1000;
|
|
10
|
+
const timeout = options.readinessTimeout ?? 8000;
|
|
11
|
+
const imageSelector = options.readyImageSelector ?? '[data-splash-ready], .t-film-art img';
|
|
12
|
+
if (!Number.isInteger(duration) || duration < 0 || duration > 10000) throw new Error('CodeplaySplashScreen.exitAnimationDuration must be an integer from0 to10000.');
|
|
13
|
+
if (!Number.isInteger(timeout) || timeout < 1 || timeout > 60000) throw new Error('CodeplaySplashScreen.readinessTimeout must be an integer from1 to60000.');
|
|
14
|
+
if (typeof imageSelector !== 'string') throw new Error('CodeplaySplashScreen.readyImageSelector must be a string.');
|
|
15
|
+
if (options.migrateLegacyReadiness !== undefined && typeof options.migrateLegacyReadiness !== 'boolean') throw new Error('CodeplaySplashScreen.migrateLegacyReadiness must be boolean.');
|
|
16
|
+
return { duration, timeout, imageSelector, migrateLegacy: options.migrateLegacyReadiness === true };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function migrateSplashTheme(content) {
|
|
20
|
+
// Repair only the known package default; preserve custom themes and styling.
|
|
21
|
+
return content.replace(/(<item\s+name=["']postSplashScreenTheme["']\s*>\s*)@style\/Theme\.AppCompat\.NoActionBar(\s*<\/item>)/g,
|
|
22
|
+
'$1@style/Theme.AppCompat.DayNight.NoActionBar$2');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function migrateReadinessSource(source, options) {
|
|
26
|
+
if (!/\b(?:var|let|const)\s+capacitorApp\s*=/.test(source)) return { source, status: 'unsupported' };
|
|
27
|
+
const handler = / handleSplashscreen:\s*function\s*\(\)\s*\{([\s\S]*?)\r?\n \},/;
|
|
28
|
+
const match = source.match(handler);
|
|
29
|
+
if (!match) return { source, status: 'unsupported' };
|
|
30
|
+
const body = match[1].replace(/\s+/g, '');
|
|
31
|
+
const isReady = crypto.createHash('sha256').update(body).digest('hex') === knownReadyHash;
|
|
32
|
+
const isManaged = /^if\(!window\.Capacitor\)return;returnhideSplashWhenReady\(\{f7:capacitorApp\.f7,hide:\(\)=>SplashScreen\.hide\(\),imageSelector:"(?:\\.|[^"\\])*",timeout:\d+\}\);$/.test(body)
|
|
33
|
+
&& source.includes(runtimeImport);
|
|
34
|
+
const isLegacy = body === "if(!window.Capacitor)return;setTimeout(()=>{if(window.Capacitor.Plugins?.SplashScreen)window.Capacitor.Plugins.SplashScreen.hide();},2000);"
|
|
35
|
+
|| body === "if(!window.Capacitor)return;setTimeout(()=>{if(window.Capacitor.Plugins&&window.Capacitor.Plugins.SplashScreen){window.Capacitor.Plugins.SplashScreen.hide();}},2000);";
|
|
36
|
+
if (!isReady && !isManaged && !(isLegacy && options.migrateLegacy)) return { source, status: isLegacy ? 'opt-in-required' : 'custom-preserved' };
|
|
37
|
+
const newline = source.includes('\r\n') ? '\r\n' : '\n';
|
|
38
|
+
const method = [
|
|
39
|
+
' handleSplashscreen: function () {',
|
|
40
|
+
' if (!window.Capacitor) return;',
|
|
41
|
+
' return hideSplashWhenReady({',
|
|
42
|
+
' f7: capacitorApp.f7,',
|
|
43
|
+
' hide: () => SplashScreen.hide(),',
|
|
44
|
+
` imageSelector: ${JSON.stringify(options.imageSelector)},`,
|
|
45
|
+
` timeout: ${options.timeout}`, ' });', ' },'
|
|
46
|
+
].join(newline);
|
|
47
|
+
let updated = source.replace(handler, () => method);
|
|
48
|
+
if (!updated.includes(runtimeImport)) updated = runtimeImport + newline + updated;
|
|
49
|
+
if (!/import\s*\{[^}]*\bSplashScreen\b[^}]*\}\s*from\s*['"]@capacitor\/splash-screen['"]/.test(updated)) {
|
|
50
|
+
updated = "import { SplashScreen } from '@capacitor/splash-screen';" + newline + updated;
|
|
51
|
+
}
|
|
52
|
+
return { source: updated, status: 'managed' };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function syncSplashSetup(projectRoot, { log = console.log } = {}) {
|
|
56
|
+
const configPath = path.join(projectRoot, 'capacitor.config.json');
|
|
57
|
+
if (!fs.existsSync(configPath)) return;
|
|
58
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
59
|
+
const options = readSplashOptions(config);
|
|
60
|
+
const theme = path.join(projectRoot, 'buildCodeplay/splashxml/codeplay_splashScreen.xml');
|
|
61
|
+
if (fs.existsSync(theme)) {
|
|
62
|
+
const content = fs.readFileSync(theme, 'utf8');
|
|
63
|
+
const updated = migrateSplashTheme(content);
|
|
64
|
+
if (updated !== content) { fs.writeFileSync(theme, updated); log('codeplay-common: repaired legacy splash DayNight theme template; Android sync applies it.'); }
|
|
65
|
+
}
|
|
66
|
+
const app = path.join(projectRoot, 'src/js/capacitor-app.js');
|
|
67
|
+
if (!fs.existsSync(app)) return;
|
|
68
|
+
const source = fs.readFileSync(app, 'utf8');
|
|
69
|
+
const migrated = migrateReadinessSource(source, options);
|
|
70
|
+
if (migrated.status === 'managed') {
|
|
71
|
+
if (source !== migrated.source) {
|
|
72
|
+
const launch = config.plugins?.SplashScreen;
|
|
73
|
+
if (launch?.launchAutoHide !== true || !(launch.launchShowDuration >= options.timeout)) {
|
|
74
|
+
log('codeplay-common: readiness migration skipped; set SplashScreen.launchAutoHide=true and launchShowDuration>=readinessTimeout for the native fallback.');
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const dependency = JSON.parse(fs.readFileSync(path.join(projectRoot, 'package.json'), 'utf8'));
|
|
78
|
+
if (!dependency.dependencies?.['@capacitor/splash-screen'] && !dependency.devDependencies?.['@capacitor/splash-screen']) {
|
|
79
|
+
log('codeplay-common: readiness migration skipped; @capacitor/splash-screen must be installed.');
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
fs.writeFileSync(app, migrated.source);
|
|
83
|
+
log('codeplay-common: connected supported startup handler to shared splash readiness.');
|
|
84
|
+
}
|
|
85
|
+
} else log(`codeplay-common: splash readiness ${migrated.status}; app startup preserved. See shared splash setup in README.`);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
module.exports = { readSplashOptions, migrateSplashTheme, migrateReadinessSource, syncSplashSetup };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<resources>
|
|
3
|
-
<color name="splashscreen_background">#FFFFFF</color>
|
|
4
|
-
|
|
5
|
-
<style name="Theme.Codeplay.SplashScreen" parent="Theme.SplashScreen.IconBackground">
|
|
6
|
-
<item name="windowSplashScreenBackground">@color/splashscreen_background</item>
|
|
7
|
-
<item name="windowSplashScreenAnimatedIcon">@drawable/splash_icon</item>
|
|
8
|
-
<item name="windowSplashScreenAnimationDuration">10000</item>
|
|
9
|
-
<item name="postSplashScreenTheme">@style/Theme.AppCompat.DayNight.NoActionBar</item>
|
|
10
|
-
</style>
|
|
11
|
-
</resources>
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<resources>
|
|
3
|
+
<color name="splashscreen_background">#FFFFFF</color>
|
|
4
|
+
|
|
5
|
+
<style name="Theme.Codeplay.SplashScreen" parent="Theme.SplashScreen.IconBackground">
|
|
6
|
+
<item name="windowSplashScreenBackground">@color/splashscreen_background</item>
|
|
7
|
+
<item name="windowSplashScreenAnimatedIcon">@drawable/splash_icon</item>
|
|
8
|
+
<item name="windowSplashScreenAnimationDuration">10000</item>
|
|
9
|
+
<item name="postSplashScreenTheme">@style/Theme.AppCompat.DayNight.NoActionBar</item>
|
|
10
|
+
</style>
|
|
11
|
+
</resources>
|