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
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
// Shared ad interface for builds with both native providers disabled.
|
|
2
|
-
const ignore = () => {};
|
|
3
|
-
const unavailable = async () => false;
|
|
4
|
-
const hidden = async () => true;
|
|
5
|
-
export const _isVideoLoad = false;
|
|
6
|
-
export const _isRewardInterstitialLoad = false;
|
|
7
|
-
export const _isNativeAdLoaded = false;
|
|
8
|
-
export const _bannerAdHeight = 0;
|
|
9
|
-
export const adjustWebViewForBanner = ignore;
|
|
10
|
-
export const hideGoogleBannerAd = hidden;
|
|
11
|
-
export const showGoogleBannerAd = unavailable;
|
|
12
|
-
export const canRequestAppAds = () => false;
|
|
13
|
-
export const getAdPrivacyOptionsState = () => ({ supported: false, requirementStatus: 'NOT_REQUIRED', loading: false, error: false, canRetry: false });
|
|
14
|
-
export const isAdPrivacyOptionsRequired = () => false;
|
|
15
|
-
export const requestAppAdConsent = unavailable;
|
|
16
|
-
export const adsOnDeviceReady = unavailable;
|
|
17
|
-
export const showAppAdPrivacyOptions = unavailable;
|
|
18
|
-
export const refreshAppAdConsent = showAppAdPrivacyOptions;
|
|
19
|
-
export async function withAdPrivacyChoices(callback) {
|
|
20
|
-
if (typeof callback === 'function') await callback();
|
|
21
|
-
}
|
|
22
|
-
export const disableFor_IAP_Subscription = ignore;
|
|
23
|
-
export const enableFor_IAP_Subscription = ignore;
|
|
24
|
-
export const disableFor_CREDIT_Subscription = ignore;
|
|
25
|
-
export const showRewardVideo = unavailable;
|
|
26
|
-
export async function levelWinInterstitial(callback) {
|
|
27
|
-
if (typeof callback === 'function') await callback();
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
export const runInterstitialTaskTransition = levelWinInterstitial;
|
|
31
|
-
export const disableAppOpenAd = ignore;
|
|
32
|
-
export const enableAppOpenAd = ignore;
|
|
33
|
-
export const noAppOpenShowUntilResume = ignore;
|
|
34
|
-
export const showRewardInterstitial = unavailable;
|
|
35
|
-
export const showNativeAd = unavailable;
|
|
36
|
-
export const showNativeAdInElement = showNativeAd;
|
|
37
|
-
export const hideNativeAd = hidden;
|
|
38
|
-
export const hideNativeAdInElement = hideNativeAd;
|
|
39
|
-
export const loadPictureInPictureAd = unavailable;
|
|
40
|
-
export const showPictureInPictureAd = loadPictureInPictureAd;
|
|
41
|
-
export const hidePictureInPictureAd = hidden;
|
|
42
|
-
export const destroyPictureInPictureAd = hidePictureInPictureAd;
|
|
43
|
-
export const removePictureInPictureAd = destroyPictureInPictureAd;
|
|
44
|
-
export const getPictureInPictureAdState = () => ({ loading: false, loaded: false, showing: false, fullscreen: false, adUnitId: '', error: null });
|
|
45
|
-
export const addPictureInPictureAdListener = () => ({ remove: ignore });
|
|
46
|
-
|
|
47
|
-
export const loadSqueezebackAd = async () => false;
|
|
48
|
-
export const showSqueezebackAd = async () => false;
|
|
49
|
-
export const hideSqueezebackAd = async () => true;
|
|
50
|
-
export const destroySqueezebackAd = async () => true;
|
|
51
|
-
export const getSqueezebackAdState = () => ({
|
|
52
|
-
loading: false, loaded: false, showing: false, fullscreen: false, adUnitId: '', error: null
|
|
53
|
-
});
|
|
1
|
+
// Shared ad interface for builds with both native providers disabled.
|
|
2
|
+
const ignore = () => {};
|
|
3
|
+
const unavailable = async () => false;
|
|
4
|
+
const hidden = async () => true;
|
|
5
|
+
export const _isVideoLoad = false;
|
|
6
|
+
export const _isRewardInterstitialLoad = false;
|
|
7
|
+
export const _isNativeAdLoaded = false;
|
|
8
|
+
export const _bannerAdHeight = 0;
|
|
9
|
+
export const adjustWebViewForBanner = ignore;
|
|
10
|
+
export const hideGoogleBannerAd = hidden;
|
|
11
|
+
export const showGoogleBannerAd = unavailable;
|
|
12
|
+
export const canRequestAppAds = () => false;
|
|
13
|
+
export const getAdPrivacyOptionsState = () => ({ supported: false, requirementStatus: 'NOT_REQUIRED', loading: false, error: false, canRetry: false });
|
|
14
|
+
export const isAdPrivacyOptionsRequired = () => false;
|
|
15
|
+
export const requestAppAdConsent = unavailable;
|
|
16
|
+
export const adsOnDeviceReady = unavailable;
|
|
17
|
+
export const showAppAdPrivacyOptions = unavailable;
|
|
18
|
+
export const refreshAppAdConsent = showAppAdPrivacyOptions;
|
|
19
|
+
export async function withAdPrivacyChoices(callback) {
|
|
20
|
+
if (typeof callback === 'function') await callback();
|
|
21
|
+
}
|
|
22
|
+
export const disableFor_IAP_Subscription = ignore;
|
|
23
|
+
export const enableFor_IAP_Subscription = ignore;
|
|
24
|
+
export const disableFor_CREDIT_Subscription = ignore;
|
|
25
|
+
export const showRewardVideo = unavailable;
|
|
26
|
+
export async function levelWinInterstitial(callback) {
|
|
27
|
+
if (typeof callback === 'function') await callback();
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
export const runInterstitialTaskTransition = levelWinInterstitial;
|
|
31
|
+
export const disableAppOpenAd = ignore;
|
|
32
|
+
export const enableAppOpenAd = ignore;
|
|
33
|
+
export const noAppOpenShowUntilResume = ignore;
|
|
34
|
+
export const showRewardInterstitial = unavailable;
|
|
35
|
+
export const showNativeAd = unavailable;
|
|
36
|
+
export const showNativeAdInElement = showNativeAd;
|
|
37
|
+
export const hideNativeAd = hidden;
|
|
38
|
+
export const hideNativeAdInElement = hideNativeAd;
|
|
39
|
+
export const loadPictureInPictureAd = unavailable;
|
|
40
|
+
export const showPictureInPictureAd = loadPictureInPictureAd;
|
|
41
|
+
export const hidePictureInPictureAd = hidden;
|
|
42
|
+
export const destroyPictureInPictureAd = hidePictureInPictureAd;
|
|
43
|
+
export const removePictureInPictureAd = destroyPictureInPictureAd;
|
|
44
|
+
export const getPictureInPictureAdState = () => ({ loading: false, loaded: false, showing: false, fullscreen: false, adUnitId: '', error: null });
|
|
45
|
+
export const addPictureInPictureAdListener = () => ({ remove: ignore });
|
|
46
|
+
|
|
47
|
+
export const loadSqueezebackAd = async () => false;
|
|
48
|
+
export const showSqueezebackAd = async () => false;
|
|
49
|
+
export const hideSqueezebackAd = async () => true;
|
|
50
|
+
export const destroySqueezebackAd = async () => true;
|
|
51
|
+
export const getSqueezebackAdState = () => ({
|
|
52
|
+
loading: false, loaded: false, showing: false, fullscreen: false, adUnitId: '', error: null
|
|
53
|
+
});
|
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
|
-
const path = require("path");
|
|
3
|
-
|
|
4
|
-
const pluginPath = path.join(
|
|
5
|
-
__dirname,
|
|
6
|
-
"..",
|
|
7
|
-
"node_modules",
|
|
8
|
-
"onesignal-cordova-plugin",
|
|
9
|
-
"plugin.xml"
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
if (!fs.existsSync(pluginPath)) {
|
|
13
|
-
console.log("OneSignal plugin not found, skipping patch.");
|
|
14
|
-
process.exit(0);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
console.log("OneSignal plugin patch started.");
|
|
18
|
-
|
|
19
|
-
let content = fs.readFileSync(pluginPath, "utf8");
|
|
20
|
-
|
|
21
|
-
/* ---- Prevent running twice ---- */
|
|
22
|
-
if (content.includes("buildCodeplay/fix-onesignal-plugin.js")) {
|
|
23
|
-
console.log("OneSignal plugin already patched.");
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
else{
|
|
27
|
-
/* ---- Comment Kotlin dependency ---- */
|
|
28
|
-
content = content.replace(
|
|
29
|
-
'<framework src="org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10" />',
|
|
30
|
-
`<!-- Disabled: causes Kotlin version conflict with modern Gradle/Kotlin -->
|
|
31
|
-
<!-- <framework src="org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10" /> -->`
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
/* ---- Add dependencies ---- */
|
|
35
|
-
content = content.replace(
|
|
36
|
-
'<framework src="build-extras-onesignal.gradle" custom="true" type="gradleReference" />',
|
|
37
|
-
`<framework src="build-extras-onesignal.gradle" custom="true" type="gradleReference" />
|
|
38
|
-
|
|
39
|
-
<!--Newly added content through buildCodeplay/fix-onesignal-plugin.js Start-->
|
|
40
|
-
<framework src="com.fasterxml.jackson.core:jackson-core:2.17.2" />
|
|
41
|
-
<framework src="com.google.auto.value:auto-value-annotations:1.11.0" scope="provided" />
|
|
42
|
-
<!--Newly added content through buildCodeplay/fix-onesignal-plugin.js End-->`
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
fs.writeFileSync(pluginPath, content);
|
|
46
|
-
|
|
47
|
-
console.log("OneSignal plugin patched successfully.");
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
//#################### ADD THE PROPER ONESIGNAL PERMISSIN TO INFO.PLIST START ###########################
|
|
58
|
-
|
|
59
|
-
const iosPlistPath = path.join(
|
|
60
|
-
__dirname,
|
|
61
|
-
"..",
|
|
62
|
-
"ios",
|
|
63
|
-
"App",
|
|
64
|
-
"App",
|
|
65
|
-
"Info.plist"
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
console.log(iosPlistPath)
|
|
69
|
-
|
|
70
|
-
if (fs.existsSync(iosPlistPath)) {
|
|
71
|
-
|
|
72
|
-
let plist = fs.readFileSync(iosPlistPath, "utf8");
|
|
73
|
-
|
|
74
|
-
const insertBlock = `
|
|
75
|
-
<key>UIBackgroundModes</key>
|
|
76
|
-
<array>
|
|
77
|
-
<string>remote-notification</string>
|
|
78
|
-
</array>
|
|
79
|
-
`;
|
|
80
|
-
|
|
81
|
-
if (!plist.includes("UIBackgroundModes")) {
|
|
82
|
-
const lastIndex = plist.lastIndexOf("</dict>");
|
|
83
|
-
|
|
84
|
-
plist =
|
|
85
|
-
plist.slice(0, lastIndex) +
|
|
86
|
-
insertBlock +
|
|
87
|
-
"\n" +
|
|
88
|
-
plist.slice(lastIndex);
|
|
89
|
-
|
|
90
|
-
console.log("Inserted UIBackgroundModes correctly.");
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
fs.writeFileSync(iosPlistPath, plist);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
|
|
4
|
+
const pluginPath = path.join(
|
|
5
|
+
__dirname,
|
|
6
|
+
"..",
|
|
7
|
+
"node_modules",
|
|
8
|
+
"onesignal-cordova-plugin",
|
|
9
|
+
"plugin.xml"
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
if (!fs.existsSync(pluginPath)) {
|
|
13
|
+
console.log("OneSignal plugin not found, skipping patch.");
|
|
14
|
+
process.exit(0);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
console.log("OneSignal plugin patch started.");
|
|
18
|
+
|
|
19
|
+
let content = fs.readFileSync(pluginPath, "utf8");
|
|
20
|
+
|
|
21
|
+
/* ---- Prevent running twice ---- */
|
|
22
|
+
if (content.includes("buildCodeplay/fix-onesignal-plugin.js")) {
|
|
23
|
+
console.log("OneSignal plugin already patched.");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
else{
|
|
27
|
+
/* ---- Comment Kotlin dependency ---- */
|
|
28
|
+
content = content.replace(
|
|
29
|
+
'<framework src="org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10" />',
|
|
30
|
+
`<!-- Disabled: causes Kotlin version conflict with modern Gradle/Kotlin -->
|
|
31
|
+
<!-- <framework src="org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10" /> -->`
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
/* ---- Add dependencies ---- */
|
|
35
|
+
content = content.replace(
|
|
36
|
+
'<framework src="build-extras-onesignal.gradle" custom="true" type="gradleReference" />',
|
|
37
|
+
`<framework src="build-extras-onesignal.gradle" custom="true" type="gradleReference" />
|
|
38
|
+
|
|
39
|
+
<!--Newly added content through buildCodeplay/fix-onesignal-plugin.js Start-->
|
|
40
|
+
<framework src="com.fasterxml.jackson.core:jackson-core:2.17.2" />
|
|
41
|
+
<framework src="com.google.auto.value:auto-value-annotations:1.11.0" scope="provided" />
|
|
42
|
+
<!--Newly added content through buildCodeplay/fix-onesignal-plugin.js End-->`
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
fs.writeFileSync(pluginPath, content);
|
|
46
|
+
|
|
47
|
+
console.log("OneSignal plugin patched successfully.");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
//#################### ADD THE PROPER ONESIGNAL PERMISSIN TO INFO.PLIST START ###########################
|
|
58
|
+
|
|
59
|
+
const iosPlistPath = path.join(
|
|
60
|
+
__dirname,
|
|
61
|
+
"..",
|
|
62
|
+
"ios",
|
|
63
|
+
"App",
|
|
64
|
+
"App",
|
|
65
|
+
"Info.plist"
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
console.log(iosPlistPath)
|
|
69
|
+
|
|
70
|
+
if (fs.existsSync(iosPlistPath)) {
|
|
71
|
+
|
|
72
|
+
let plist = fs.readFileSync(iosPlistPath, "utf8");
|
|
73
|
+
|
|
74
|
+
const insertBlock = `
|
|
75
|
+
<key>UIBackgroundModes</key>
|
|
76
|
+
<array>
|
|
77
|
+
<string>remote-notification</string>
|
|
78
|
+
</array>
|
|
79
|
+
`;
|
|
80
|
+
|
|
81
|
+
if (!plist.includes("UIBackgroundModes")) {
|
|
82
|
+
const lastIndex = plist.lastIndexOf("</dict>");
|
|
83
|
+
|
|
84
|
+
plist =
|
|
85
|
+
plist.slice(0, lastIndex) +
|
|
86
|
+
insertBlock +
|
|
87
|
+
"\n" +
|
|
88
|
+
plist.slice(lastIndex);
|
|
89
|
+
|
|
90
|
+
console.log("Inserted UIBackgroundModes correctly.");
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
fs.writeFileSync(iosPlistPath, plist);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
97
|
//#################### ADD THE PROPER ONESIGNAL PERMISSIN TO INFO.PLIST END ###########################
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
function syncCapacitorPermissionRules(projectRoot = path.resolve(__dirname, '../..')) {
|
|
5
|
-
const appPath = path.join(projectRoot, 'android', 'app');
|
|
6
|
-
if (!fs.existsSync(path.join(appPath, 'build.gradle'))) return false;
|
|
7
|
-
|
|
8
|
-
const rulesPath = path.join(appPath, 'proguard-rules.pro');
|
|
9
|
-
const original = fs.existsSync(rulesPath) ? fs.readFileSync(rulesPath, 'utf8') : '';
|
|
10
|
-
const rules = [
|
|
11
|
-
'-keepattributes RuntimeVisibleAnnotations,AnnotationDefault',
|
|
12
|
-
'-keep @interface com.getcapacitor.annotation.CapacitorPlugin { *; }',
|
|
13
|
-
'-keep @interface com.getcapacitor.annotation.Permission { *; }',
|
|
14
|
-
];
|
|
15
|
-
const existing = new Set(original.split(/\r?\n/).map(line => line.trim()));
|
|
16
|
-
const missing = rules.filter(rule => !existing.has(rule));
|
|
17
|
-
if (!missing.length) return false;
|
|
18
|
-
|
|
19
|
-
const newline = original.includes('\r\n') ? '\r\n' : '\n';
|
|
20
|
-
fs.writeFileSync(rulesPath, `${original.trimEnd()}${newline}${newline}`
|
|
21
|
-
+ `# Preserve Capacitor permission metadata used at runtime.${newline}`
|
|
22
|
-
+ `${missing.join(newline)}${newline}`, 'utf8');
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (require.main === module) {
|
|
27
|
-
const changed = syncCapacitorPermissionRules();
|
|
28
|
-
console.log(changed ? 'Capacitor R8 permission rules restored.' : 'Capacitor R8 permission rules unchanged.');
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
module.exports = { syncCapacitorPermissionRules };
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
function syncCapacitorPermissionRules(projectRoot = path.resolve(__dirname, '../..')) {
|
|
5
|
+
const appPath = path.join(projectRoot, 'android', 'app');
|
|
6
|
+
if (!fs.existsSync(path.join(appPath, 'build.gradle'))) return false;
|
|
7
|
+
|
|
8
|
+
const rulesPath = path.join(appPath, 'proguard-rules.pro');
|
|
9
|
+
const original = fs.existsSync(rulesPath) ? fs.readFileSync(rulesPath, 'utf8') : '';
|
|
10
|
+
const rules = [
|
|
11
|
+
'-keepattributes RuntimeVisibleAnnotations,AnnotationDefault',
|
|
12
|
+
'-keep @interface com.getcapacitor.annotation.CapacitorPlugin { *; }',
|
|
13
|
+
'-keep @interface com.getcapacitor.annotation.Permission { *; }',
|
|
14
|
+
];
|
|
15
|
+
const existing = new Set(original.split(/\r?\n/).map(line => line.trim()));
|
|
16
|
+
const missing = rules.filter(rule => !existing.has(rule));
|
|
17
|
+
if (!missing.length) return false;
|
|
18
|
+
|
|
19
|
+
const newline = original.includes('\r\n') ? '\r\n' : '\n';
|
|
20
|
+
fs.writeFileSync(rulesPath, `${original.trimEnd()}${newline}${newline}`
|
|
21
|
+
+ `# Preserve Capacitor permission metadata used at runtime.${newline}`
|
|
22
|
+
+ `${missing.join(newline)}${newline}`, 'utf8');
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (require.main === module) {
|
|
27
|
+
const changed = syncCapacitorPermissionRules();
|
|
28
|
+
console.log(changed ? 'Capacitor R8 permission rules restored.' : 'Capacitor R8 permission rules unchanged.');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
module.exports = { syncCapacitorPermissionRules };
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
// FFmpegKit's JNI library looks up these Java members by name at runtime.
|
|
5
|
-
const FFMPEG_JNI_RULES = [
|
|
6
|
-
'-keep class com.antonkarpenko.ffmpegkit.** { *; }',
|
|
7
|
-
'-keep interface com.antonkarpenko.ffmpegkit.** { *; }',
|
|
8
|
-
];
|
|
9
|
-
|
|
10
|
-
function syncFfmpegJniRules(projectRoot) {
|
|
11
|
-
const pluginPath = path.join(projectRoot, 'node_modules', 'codeplay-fmpg', 'plugin.xml');
|
|
12
|
-
const appPath = path.join(projectRoot, 'android', 'app');
|
|
13
|
-
if (!fs.existsSync(pluginPath) || !fs.existsSync(appPath)) return false;
|
|
14
|
-
|
|
15
|
-
const rulesPath = path.join(appPath, 'proguard-rules.pro');
|
|
16
|
-
const original = fs.existsSync(rulesPath) ? fs.readFileSync(rulesPath, 'utf8') : '';
|
|
17
|
-
const existing = new Set(original.split(/\r?\n/).map(line => line.trim()));
|
|
18
|
-
const missing = FFMPEG_JNI_RULES.filter(rule => !existing.has(rule));
|
|
19
|
-
if (!missing.length) return false;
|
|
20
|
-
|
|
21
|
-
const newline = original.includes('\r\n') ? '\r\n' : '\n';
|
|
22
|
-
fs.writeFileSync(rulesPath, `${original.trimEnd()}${newline}${newline}`
|
|
23
|
-
+ `# Preserve FFmpegKit JNI entry points and callbacks.${newline}`
|
|
24
|
-
+ `${missing.join(newline)}${newline}`, 'utf8');
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
module.exports = { syncFfmpegJniRules };
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
// FFmpegKit's JNI library looks up these Java members by name at runtime.
|
|
5
|
+
const FFMPEG_JNI_RULES = [
|
|
6
|
+
'-keep class com.antonkarpenko.ffmpegkit.** { *; }',
|
|
7
|
+
'-keep interface com.antonkarpenko.ffmpegkit.** { *; }',
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
function syncFfmpegJniRules(projectRoot) {
|
|
11
|
+
const pluginPath = path.join(projectRoot, 'node_modules', 'codeplay-fmpg', 'plugin.xml');
|
|
12
|
+
const appPath = path.join(projectRoot, 'android', 'app');
|
|
13
|
+
if (!fs.existsSync(pluginPath) || !fs.existsSync(appPath)) return false;
|
|
14
|
+
|
|
15
|
+
const rulesPath = path.join(appPath, 'proguard-rules.pro');
|
|
16
|
+
const original = fs.existsSync(rulesPath) ? fs.readFileSync(rulesPath, 'utf8') : '';
|
|
17
|
+
const existing = new Set(original.split(/\r?\n/).map(line => line.trim()));
|
|
18
|
+
const missing = FFMPEG_JNI_RULES.filter(rule => !existing.has(rule));
|
|
19
|
+
if (!missing.length) return false;
|
|
20
|
+
|
|
21
|
+
const newline = original.includes('\r\n') ? '\r\n' : '\n';
|
|
22
|
+
fs.writeFileSync(rulesPath, `${original.trimEnd()}${newline}${newline}`
|
|
23
|
+
+ `# Preserve FFmpegKit JNI entry points and callbacks.${newline}`
|
|
24
|
+
+ `${missing.join(newline)}${newline}`, 'utf8');
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
module.exports = { syncFfmpegJniRules };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// Restore native metadata before Gradle configures an optimized Android build.
|
|
2
|
-
def codeplayAppRoot = rootProject.projectDir.parentFile
|
|
3
|
-
def codeplayRepairScript = new File(codeplayAppRoot, 'buildCodeplay/fix-optimize-builld/restore-android-r8-rules.cjs')
|
|
4
|
-
def codeplayNodeBinary = project.findProperty('codeplayNodeBinary') ?: 'node'
|
|
5
|
-
|
|
6
|
-
providers.exec {
|
|
7
|
-
workingDir codeplayAppRoot
|
|
8
|
-
commandLine codeplayNodeBinary, codeplayRepairScript.absolutePath
|
|
9
|
-
}.result.get().assertNormalExitValue()
|
|
1
|
+
// Restore native metadata before Gradle configures an optimized Android build.
|
|
2
|
+
def codeplayAppRoot = rootProject.projectDir.parentFile
|
|
3
|
+
def codeplayRepairScript = new File(codeplayAppRoot, 'buildCodeplay/fix-optimize-builld/restore-android-r8-rules.cjs')
|
|
4
|
+
def codeplayNodeBinary = project.findProperty('codeplayNodeBinary') ?: 'node'
|
|
5
|
+
|
|
6
|
+
providers.exec {
|
|
7
|
+
workingDir codeplayAppRoot
|
|
8
|
+
commandLine codeplayNodeBinary, codeplayRepairScript.absolutePath
|
|
9
|
+
}.result.get().assertNormalExitValue()
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const { syncFfmpegJniRules } = require('./ffmpeg-jni-rules.cjs');
|
|
4
|
-
const { syncCapacitorPermissionRules } = require('./android-r8-rules.cjs');
|
|
5
|
-
|
|
6
|
-
function syncAndroidR8Rules(projectRoot = path.resolve(__dirname, '../..'), { installGradleHook = false } = {}) {
|
|
7
|
-
const buildPath = path.join(projectRoot, 'android', 'app', 'build.gradle');
|
|
8
|
-
if (!fs.existsSync(buildPath)) return false;
|
|
9
|
-
const capacitorChanged = syncCapacitorPermissionRules(projectRoot);
|
|
10
|
-
const ffmpegChanged = syncFfmpegJniRules(projectRoot);
|
|
11
|
-
let hookChanged = false;
|
|
12
|
-
if (installGradleHook) {
|
|
13
|
-
const original = fs.readFileSync(buildPath, 'utf8');
|
|
14
|
-
const hook = "apply from: '../../buildCodeplay/fix-optimize-builld/fix-optimize-build.gradle'";
|
|
15
|
-
const existingHook = /^[ \t]*apply\s+from:\s*(['"])\.\.\/\.\.\/buildCodeplay\/fix-optimize-builld\/fix-optimize-build\.gradle\1[ \t]*;?[ \t]*$/m;
|
|
16
|
-
if (!existingHook.test(original)) {
|
|
17
|
-
const newline = original.includes('\r\n') ? '\r\n' : '\n';
|
|
18
|
-
fs.writeFileSync(buildPath, `${original.trimEnd()}${newline}${newline}${hook}${newline}`, 'utf8');
|
|
19
|
-
hookChanged = true;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return capacitorChanged || ffmpegChanged || hookChanged;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (require.main === module) {
|
|
26
|
-
const changed = syncAndroidR8Rules(undefined, { installGradleHook: process.argv.includes('--install-gradle-hook') });
|
|
27
|
-
console.log(changed ? 'Android R8 keep rules restored.' : 'Android R8 keep rules unchanged; no Android app or rules already present.');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
module.exports = { syncAndroidR8Rules };
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { syncFfmpegJniRules } = require('./ffmpeg-jni-rules.cjs');
|
|
4
|
+
const { syncCapacitorPermissionRules } = require('./android-r8-rules.cjs');
|
|
5
|
+
|
|
6
|
+
function syncAndroidR8Rules(projectRoot = path.resolve(__dirname, '../..'), { installGradleHook = false } = {}) {
|
|
7
|
+
const buildPath = path.join(projectRoot, 'android', 'app', 'build.gradle');
|
|
8
|
+
if (!fs.existsSync(buildPath)) return false;
|
|
9
|
+
const capacitorChanged = syncCapacitorPermissionRules(projectRoot);
|
|
10
|
+
const ffmpegChanged = syncFfmpegJniRules(projectRoot);
|
|
11
|
+
let hookChanged = false;
|
|
12
|
+
if (installGradleHook) {
|
|
13
|
+
const original = fs.readFileSync(buildPath, 'utf8');
|
|
14
|
+
const hook = "apply from: '../../buildCodeplay/fix-optimize-builld/fix-optimize-build.gradle'";
|
|
15
|
+
const existingHook = /^[ \t]*apply\s+from:\s*(['"])\.\.\/\.\.\/buildCodeplay\/fix-optimize-builld\/fix-optimize-build\.gradle\1[ \t]*;?[ \t]*$/m;
|
|
16
|
+
if (!existingHook.test(original)) {
|
|
17
|
+
const newline = original.includes('\r\n') ? '\r\n' : '\n';
|
|
18
|
+
fs.writeFileSync(buildPath, `${original.trimEnd()}${newline}${newline}${hook}${newline}`, 'utf8');
|
|
19
|
+
hookChanged = true;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return capacitorChanged || ffmpegChanged || hookChanged;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (require.main === module) {
|
|
26
|
+
const changed = syncAndroidR8Rules(undefined, { installGradleHook: process.argv.includes('--install-gradle-hook') });
|
|
27
|
+
console.log(changed ? 'Android R8 keep rules restored.' : 'Android R8 keep rules unchanged; no Android app or rules already present.');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
module.exports = { syncAndroidR8Rules };
|