codeplay-common 4.11.29 → 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 +280 -280
- package/RELEASE_NOTES.md +110 -110
- package/files/buildCodeplay/add-splash-screen.js +256 -256
- package/files/buildCodeplay/apk-store-builder.js +97 -97
- package/files/buildCodeplay/codeplayBeforeBuild.js +19 -6
- 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/ios-emi-admob-modification.js +24 -24
- package/files/buildCodeplay/manifestModification.js +38 -38
- package/files/buildCodeplay/migrate-system-bars.cjs +9 -2
- package/files/buildCodeplay/packageidBaseModification.js +528 -528
- package/files/buildCodeplay/project-scripts.cjs +69 -69
- package/files/buildCodeplay/setSplashAnimation.js +228 -228
- 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/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 -28
- package/runtime/splash-ready.mjs +52 -52
- package/scripts/splash-setup.test.cjs +142 -142
- package/scripts/sync-files.js +119 -119
- package/scripts/system-bars-package.test.cjs +38 -0
- package/scripts/system-bars.test.cjs +16 -0
- package/scripts/uninstall.js +2 -2
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
const { spawn } = require("child_process");
|
|
2
|
-
const path = require("path");
|
|
3
|
-
const fs = require("fs");
|
|
4
|
-
|
|
5
|
-
// Paths
|
|
6
|
-
//const projectRoot = path.join(__dirname, "..");
|
|
7
|
-
const projectRoot = process.cwd();
|
|
8
|
-
const androidPath = path.join(projectRoot, "android");
|
|
9
|
-
const capacitorConfigPath = path.join(projectRoot, "capacitor.config.json");
|
|
10
|
-
|
|
11
|
-
// Read capacitor.config.json
|
|
12
|
-
if (!fs.existsSync(capacitorConfigPath)) {
|
|
13
|
-
console.error("❌ capacitor.config.json not found!");
|
|
14
|
-
process.exit(1);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const config = JSON.parse(fs.readFileSync(capacitorConfigPath, "utf8"));
|
|
18
|
-
|
|
19
|
-
const buildOptions = config.android?.buildOptions;
|
|
20
|
-
|
|
21
|
-
if (!buildOptions) {
|
|
22
|
-
console.error("❌ android.buildOptions not found in capacitor.config.json");
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Resolve keystore path (relative → absolute)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const storePassword = buildOptions.keystorePassword;
|
|
30
|
-
const keyAlias = buildOptions.keystoreAlias;
|
|
31
|
-
const keyPassword = buildOptions.keystoreAliasPassword;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const rawKeystorePath = buildOptions.keystorePath;
|
|
39
|
-
|
|
40
|
-
// First try normal resolve
|
|
41
|
-
let keystorePath = path.resolve(projectRoot, rawKeystorePath);
|
|
42
|
-
|
|
43
|
-
// If not found, try trimming one "../"
|
|
44
|
-
if (!fs.existsSync(keystorePath)) {
|
|
45
|
-
console.log("⚠️ Keystore not found, attempting path correction...");
|
|
46
|
-
|
|
47
|
-
const trimmedPath = rawKeystorePath.replace(/^\.\.\//, "");
|
|
48
|
-
keystorePath = path.resolve(projectRoot, trimmedPath);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Final validation
|
|
52
|
-
if (!fs.existsSync(keystorePath)) {
|
|
53
|
-
console.error("❌ Keystore file not found even after correction:", keystorePath);
|
|
54
|
-
process.exit(1);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
console.log("🔐 Using keystore:", keystorePath);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
// Gradle args
|
|
69
|
-
const isWindows = process.platform === "win32";
|
|
70
|
-
const command = isWindows ? "cmd.exe" : "sh";
|
|
71
|
-
const args = [
|
|
72
|
-
...(isWindows ? ["/c", "gradlew.bat"] : ["./gradlew"]),
|
|
73
|
-
"assembleRelease",
|
|
74
|
-
`-Pandroid.injected.signing.store.file=${keystorePath}`,
|
|
75
|
-
`-Pandroid.injected.signing.store.password=${storePassword}`,
|
|
76
|
-
`-Pandroid.injected.signing.key.alias=${keyAlias}`,
|
|
77
|
-
`-Pandroid.injected.signing.key.password=${keyPassword}`,
|
|
78
|
-
];
|
|
79
|
-
|
|
80
|
-
// Run Gradle
|
|
81
|
-
const gradle = spawn(command, args, {
|
|
82
|
-
cwd: androidPath,
|
|
83
|
-
stdio: "inherit",
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
gradle.on("error", (error) => {
|
|
87
|
-
console.error("❌ Could not start Gradle:", error.message);
|
|
88
|
-
process.exit(1);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
gradle.on("close", (code) => {
|
|
92
|
-
if (code === 0) {
|
|
93
|
-
console.log("\n✅ Signed APK Generated Successfully!");
|
|
94
|
-
} else {
|
|
95
|
-
console.log("\n❌ Build Failed with code:", code);
|
|
96
|
-
process.exit(code ?? 1);
|
|
97
|
-
}
|
|
1
|
+
const { spawn } = require("child_process");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
|
|
5
|
+
// Paths
|
|
6
|
+
//const projectRoot = path.join(__dirname, "..");
|
|
7
|
+
const projectRoot = process.cwd();
|
|
8
|
+
const androidPath = path.join(projectRoot, "android");
|
|
9
|
+
const capacitorConfigPath = path.join(projectRoot, "capacitor.config.json");
|
|
10
|
+
|
|
11
|
+
// Read capacitor.config.json
|
|
12
|
+
if (!fs.existsSync(capacitorConfigPath)) {
|
|
13
|
+
console.error("❌ capacitor.config.json not found!");
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const config = JSON.parse(fs.readFileSync(capacitorConfigPath, "utf8"));
|
|
18
|
+
|
|
19
|
+
const buildOptions = config.android?.buildOptions;
|
|
20
|
+
|
|
21
|
+
if (!buildOptions) {
|
|
22
|
+
console.error("❌ android.buildOptions not found in capacitor.config.json");
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Resolve keystore path (relative → absolute)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
const storePassword = buildOptions.keystorePassword;
|
|
30
|
+
const keyAlias = buildOptions.keystoreAlias;
|
|
31
|
+
const keyPassword = buildOptions.keystoreAliasPassword;
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
const rawKeystorePath = buildOptions.keystorePath;
|
|
39
|
+
|
|
40
|
+
// First try normal resolve
|
|
41
|
+
let keystorePath = path.resolve(projectRoot, rawKeystorePath);
|
|
42
|
+
|
|
43
|
+
// If not found, try trimming one "../"
|
|
44
|
+
if (!fs.existsSync(keystorePath)) {
|
|
45
|
+
console.log("⚠️ Keystore not found, attempting path correction...");
|
|
46
|
+
|
|
47
|
+
const trimmedPath = rawKeystorePath.replace(/^\.\.\//, "");
|
|
48
|
+
keystorePath = path.resolve(projectRoot, trimmedPath);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Final validation
|
|
52
|
+
if (!fs.existsSync(keystorePath)) {
|
|
53
|
+
console.error("❌ Keystore file not found even after correction:", keystorePath);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
console.log("🔐 Using keystore:", keystorePath);
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
// Gradle args
|
|
69
|
+
const isWindows = process.platform === "win32";
|
|
70
|
+
const command = isWindows ? "cmd.exe" : "sh";
|
|
71
|
+
const args = [
|
|
72
|
+
...(isWindows ? ["/c", "gradlew.bat"] : ["./gradlew"]),
|
|
73
|
+
"assembleRelease",
|
|
74
|
+
`-Pandroid.injected.signing.store.file=${keystorePath}`,
|
|
75
|
+
`-Pandroid.injected.signing.store.password=${storePassword}`,
|
|
76
|
+
`-Pandroid.injected.signing.key.alias=${keyAlias}`,
|
|
77
|
+
`-Pandroid.injected.signing.key.password=${keyPassword}`,
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
// Run Gradle
|
|
81
|
+
const gradle = spawn(command, args, {
|
|
82
|
+
cwd: androidPath,
|
|
83
|
+
stdio: "inherit",
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
gradle.on("error", (error) => {
|
|
87
|
+
console.error("❌ Could not start Gradle:", error.message);
|
|
88
|
+
process.exit(1);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
gradle.on("close", (code) => {
|
|
92
|
+
if (code === 0) {
|
|
93
|
+
console.log("\n✅ Signed APK Generated Successfully!");
|
|
94
|
+
} else {
|
|
95
|
+
console.log("\n❌ Build Failed with code:", code);
|
|
96
|
+
process.exit(code ?? 1);
|
|
97
|
+
}
|
|
98
98
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// Version 8.3: update the system-bars package to the latest npm release before migration.
|
|
1
2
|
// Version 8.2: declare the installed SAF plugin's DocumentFile dependency before native sync.
|
|
2
3
|
// Version 8.1: prevent native app startup from requesting ATT before regional consent.
|
|
3
4
|
// Version 8.0: restore AdMob native settings when switching back to an AdMob store.
|
|
@@ -3229,18 +3230,30 @@ const syncCodeplaySystemBarsPackage = () => {
|
|
|
3229
3230
|
const declaredVersion = packageJson.dependencies?.[CODEPLAY_SYSTEM_BARS_PLUGIN];
|
|
3230
3231
|
const usesLocalReference = typeof declaredVersion === "string" && declaredVersion.startsWith("file:");
|
|
3231
3232
|
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
runNpmCommand(`npm install ${CODEPLAY_SYSTEM_BARS_PLUGIN}`);
|
|
3233
|
+
const installedVersion = getInstalledVersion(CODEPLAY_SYSTEM_BARS_PLUGIN);
|
|
3234
|
+
if (usesLocalReference || !installedVersion) {
|
|
3235
|
+
runNpmCommand(`npm install ${CODEPLAY_SYSTEM_BARS_PLUGIN}@latest`);
|
|
3235
3236
|
return;
|
|
3236
3237
|
}
|
|
3237
3238
|
|
|
3238
|
-
if (
|
|
3239
|
-
|
|
3239
|
+
if (skipOnlineVersionChecks) {
|
|
3240
|
+
console.log(`Keeping local ${CODEPLAY_SYSTEM_BARS_PLUGIN} ${installedVersion}; online version checks skipped.`);
|
|
3240
3241
|
return;
|
|
3241
3242
|
}
|
|
3242
3243
|
|
|
3243
|
-
|
|
3244
|
+
const latestVersion = getLatestVersion(CODEPLAY_SYSTEM_BARS_PLUGIN);
|
|
3245
|
+
if (!latestVersion) {
|
|
3246
|
+
console.warn(`Could not check ${CODEPLAY_SYSTEM_BARS_PLUGIN} updates; keeping installed ${installedVersion}.`);
|
|
3247
|
+
return;
|
|
3248
|
+
}
|
|
3249
|
+
|
|
3250
|
+
if (compareVersionStrings(installedVersion, latestVersion) < 0) {
|
|
3251
|
+
console.log(`Updating ${CODEPLAY_SYSTEM_BARS_PLUGIN} from ${installedVersion} to ${latestVersion}.`);
|
|
3252
|
+
runNpmCommand(`npm install ${CODEPLAY_SYSTEM_BARS_PLUGIN}@latest`);
|
|
3253
|
+
return;
|
|
3254
|
+
}
|
|
3255
|
+
|
|
3256
|
+
console.log(`${CODEPLAY_SYSTEM_BARS_PLUGIN} is up to date (${installedVersion}).`);
|
|
3244
3257
|
};
|
|
3245
3258
|
|
|
3246
3259
|
const ADMOB_NEXTGEN_DEFAULTS = {
|
|
@@ -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 };
|