codeplay-common 4.5.3 โ 4.5.4
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/files/buildCodeplay/codeplayBeforeBuild-6.2.js +138 -138
- package/files/buildCodeplay/ios-emi-admob-modification.js +25 -25
- package/files/buildCodeplay/manifestModification.js +12 -12
- package/files/buildCodeplay/newly added.txt +89 -89
- package/files/buildCodeplay/packageidBaseModification-1.4.js +7 -1
- package/files/buildCodeplay/remove-force-kotlin-disable.js +43 -43
- package/files/buildCodeplay/versions.json +4 -4
- package/files/finalrelease +169 -169
- package/files/scripts/setup-baseline-profile.js +3 -3
- package/files/take-screen-image.js +2269 -2269
- package/package.json +1 -1
- package/scripts/sync-files.js +1 -1
|
@@ -20,12 +20,12 @@ const updateLogFile = path.join(process.cwd(), "", "plugin-update-log.txt");
|
|
|
20
20
|
const ADMOB_NEXTGEN_PLUGIN_NAME = "admob-emi-nextgen";
|
|
21
21
|
const ADMOB_NEXTGEN_FILE_PATTERN = new RegExp(`^${ADMOB_NEXTGEN_PLUGIN_NAME}-\\d+(?:\\.\\d+)*\\.js$`);
|
|
22
22
|
const ADMOB_NEXTGEN_CONFIG = "admob-ad-configuration-nextgen.json";
|
|
23
|
-
const ADMOB_OLD_CONFIG = "admob-ad-configuration.json";
|
|
24
|
-
const AGENT_INSTRUCTIONS_VERSION_KEY = "agents";
|
|
25
|
-
const AGENT_INSTRUCTIONS_ZIP_PREFIX = "agents";
|
|
26
|
-
const AGENT_INSTRUCTIONS_FILE = "AGENTS.md";
|
|
27
|
-
const AGENT_INSTRUCTIONS_DIR = "AGENTS";
|
|
28
|
-
const AGENT_INSTRUCTIONS_VERSION_FILE = ".codeplay-version";
|
|
23
|
+
const ADMOB_OLD_CONFIG = "admob-ad-configuration.json";
|
|
24
|
+
const AGENT_INSTRUCTIONS_VERSION_KEY = "agents";
|
|
25
|
+
const AGENT_INSTRUCTIONS_ZIP_PREFIX = "agents";
|
|
26
|
+
const AGENT_INSTRUCTIONS_FILE = "AGENTS.md";
|
|
27
|
+
const AGENT_INSTRUCTIONS_DIR = "AGENTS";
|
|
28
|
+
const AGENT_INSTRUCTIONS_VERSION_FILE = ".codeplay-version";
|
|
29
29
|
|
|
30
30
|
const parseVersionParts = (version) => String(version || "0")
|
|
31
31
|
.trim()
|
|
@@ -1871,7 +1871,7 @@ function updateImports(oldName, newName) {
|
|
|
1871
1871
|
|
|
1872
1872
|
|
|
1873
1873
|
let _serverVersions = null;
|
|
1874
|
-
async function fetchVersions() {
|
|
1874
|
+
async function fetchVersions() {
|
|
1875
1875
|
|
|
1876
1876
|
if (_serverVersions) return _serverVersions;
|
|
1877
1877
|
|
|
@@ -1908,133 +1908,133 @@ async function fetchVersions() {
|
|
|
1908
1908
|
|
|
1909
1909
|
});
|
|
1910
1910
|
|
|
1911
|
-
}
|
|
1912
|
-
|
|
1913
|
-
function getAgentInstructionsZipLayout(zip) {
|
|
1914
|
-
const entries = zip.getEntries().filter(entry => !entry.isDirectory);
|
|
1915
|
-
|
|
1916
|
-
for (const entry of entries) {
|
|
1917
|
-
const normalizedName = entry.entryName.replace(/\\/g, "/");
|
|
1918
|
-
if (
|
|
1919
|
-
normalizedName.startsWith("/") ||
|
|
1920
|
-
normalizedName.split("/").includes("..") ||
|
|
1921
|
-
path.isAbsolute(entry.entryName)
|
|
1922
|
-
) {
|
|
1923
|
-
throw new Error(`Unsafe path in agent instructions ZIP: ${entry.entryName}`);
|
|
1924
|
-
}
|
|
1925
|
-
}
|
|
1926
|
-
|
|
1927
|
-
const normalizedEntries = entries.map(entry => ({
|
|
1928
|
-
entry,
|
|
1929
|
-
name: entry.entryName.replace(/\\/g, "/")
|
|
1930
|
-
}));
|
|
1931
|
-
const agentFile = normalizedEntries.find(({ name }) =>
|
|
1932
|
-
name.toLowerCase() === AGENT_INSTRUCTIONS_FILE.toLowerCase()
|
|
1933
|
-
);
|
|
1934
|
-
const agentDirectoryPrefix = `${AGENT_INSTRUCTIONS_DIR.toLowerCase()}/`;
|
|
1935
|
-
const nestedSupportFiles = normalizedEntries
|
|
1936
|
-
.filter(({ name }) => name.toLowerCase().startsWith(agentDirectoryPrefix))
|
|
1937
|
-
.map(({ entry, name }) => ({
|
|
1938
|
-
entry,
|
|
1939
|
-
relativePath: name.slice(name.indexOf("/") + 1)
|
|
1940
|
-
}))
|
|
1941
|
-
.filter(({ relativePath }) => relativePath && relativePath !== AGENT_INSTRUCTIONS_VERSION_FILE);
|
|
1942
|
-
const flatSupportFiles = normalizedEntries
|
|
1943
|
-
.filter(({ name }) =>
|
|
1944
|
-
!name.includes("/") &&
|
|
1945
|
-
name.toLowerCase() !== AGENT_INSTRUCTIONS_FILE.toLowerCase() &&
|
|
1946
|
-
name.toLowerCase() !== AGENT_INSTRUCTIONS_VERSION_FILE.toLowerCase() &&
|
|
1947
|
-
name.toLowerCase().endsWith(".md")
|
|
1948
|
-
)
|
|
1949
|
-
.map(({ entry, name }) => ({ entry, relativePath: name }));
|
|
1950
|
-
const supportFiles = nestedSupportFiles.length ? nestedSupportFiles : flatSupportFiles;
|
|
1951
|
-
|
|
1952
|
-
if (!agentFile || !supportFiles.length) {
|
|
1953
|
-
throw new Error(
|
|
1954
|
-
`Agent instructions ZIP must contain ${AGENT_INSTRUCTIONS_FILE} (case-insensitive) and either files inside ${AGENT_INSTRUCTIONS_DIR}/ or supporting Markdown files at the archive root.`
|
|
1955
|
-
);
|
|
1956
|
-
}
|
|
1957
|
-
|
|
1958
|
-
return { agentFile: agentFile.entry, supportFiles };
|
|
1959
|
-
}
|
|
1960
|
-
|
|
1961
|
-
function readInstalledAgentInstructionsVersion(projectRoot) {
|
|
1962
|
-
const versionFile = path.join(projectRoot, AGENT_INSTRUCTIONS_DIR, AGENT_INSTRUCTIONS_VERSION_FILE);
|
|
1963
|
-
if (!fs.existsSync(versionFile)) return "0";
|
|
1964
|
-
|
|
1965
|
-
const installedVersion = String(fs.readFileSync(versionFile, "utf8")).trim();
|
|
1966
|
-
return /^\d+(?:\.\d+)*$/.test(installedVersion) ? installedVersion : "0";
|
|
1967
|
-
}
|
|
1968
|
-
|
|
1969
|
-
async function syncAgentInstructions() {
|
|
1970
|
-
const projectRoot = process.cwd();
|
|
1971
|
-
const targetAgentFile = path.join(projectRoot, AGENT_INSTRUCTIONS_FILE);
|
|
1972
|
-
const targetAgentDir = path.join(projectRoot, AGENT_INSTRUCTIONS_DIR);
|
|
1973
|
-
const hasAgentDirectoryFiles =
|
|
1974
|
-
fs.existsSync(targetAgentDir) &&
|
|
1975
|
-
fs.statSync(targetAgentDir).isDirectory() &&
|
|
1976
|
-
fs.readdirSync(targetAgentDir).some(name => name !== AGENT_INSTRUCTIONS_VERSION_FILE);
|
|
1977
|
-
const requiredFilesExist = fs.existsSync(targetAgentFile) && hasAgentDirectoryFiles;
|
|
1978
|
-
const localVersion = readInstalledAgentInstructionsVersion(projectRoot);
|
|
1979
|
-
|
|
1980
|
-
const versions = await fetchVersions();
|
|
1981
|
-
const remoteVersion = String(versions?.[AGENT_INSTRUCTIONS_VERSION_KEY] || "").trim();
|
|
1982
|
-
|
|
1983
|
-
if (!/^\d+(?:\.\d+)*$/.test(remoteVersion)) {
|
|
1984
|
-
throw new Error(`Required agent instructions could not be resolved from the server.`);
|
|
1985
|
-
}
|
|
1986
|
-
|
|
1987
|
-
const remoteIsNewer = compareVersionStrings(remoteVersion, localVersion) > 0;
|
|
1988
|
-
if (requiredFilesExist && !remoteIsNewer) {
|
|
1989
|
-
console.log(`โ
Agent instructions do not need an update (local ${localVersion}, online ${remoteVersion}).`);
|
|
1990
|
-
return;
|
|
1991
|
-
}
|
|
1992
|
-
|
|
1993
|
-
const zipName = `${AGENT_INSTRUCTIONS_ZIP_PREFIX}-${remoteVersion}.zip`;
|
|
1994
|
-
const url = `https://htmlcodeplay.com/code-play-plugin/${zipName}`;
|
|
1995
|
-
const tempRoot = fs.mkdtempSync(path.join(require("os").tmpdir(), "codeplay-agents-"));
|
|
1996
|
-
const zipPath = path.join(tempRoot, zipName);
|
|
1997
|
-
const extractPath = path.join(tempRoot, "extracted");
|
|
1998
|
-
|
|
1999
|
-
try {
|
|
2000
|
-
console.log(`๐ Checking latest agent instructions: ${zipName}`);
|
|
2001
|
-
if (!(await urlExists(url))) {
|
|
2002
|
-
throw new Error(`Required agent instructions archive not found: ${url}`);
|
|
2003
|
-
}
|
|
2004
|
-
|
|
2005
|
-
await downloadFile(url, zipPath);
|
|
2006
|
-
console.log(`โฌ๏ธ Downloaded agent instructions archive: ${zipName}`);
|
|
2007
|
-
const zip = new AdmZip(zipPath);
|
|
2008
|
-
const archiveLayout = getAgentInstructionsZipLayout(zip);
|
|
2009
|
-
|
|
2010
|
-
const stagedAgentFile = path.join(extractPath, AGENT_INSTRUCTIONS_FILE);
|
|
2011
|
-
const stagedAgentDir = path.join(extractPath, AGENT_INSTRUCTIONS_DIR);
|
|
2012
|
-
fs.mkdirSync(stagedAgentDir, { recursive: true });
|
|
2013
|
-
fs.writeFileSync(stagedAgentFile, archiveLayout.agentFile.getData());
|
|
2014
|
-
archiveLayout.supportFiles.forEach(({ entry, relativePath }) => {
|
|
2015
|
-
const stagedSupportFile = path.join(stagedAgentDir, relativePath);
|
|
2016
|
-
fs.mkdirSync(path.dirname(stagedSupportFile), { recursive: true });
|
|
2017
|
-
fs.writeFileSync(stagedSupportFile, entry.getData());
|
|
2018
|
-
});
|
|
2019
|
-
|
|
2020
|
-
fs.rmSync(targetAgentDir, { recursive: true, force: true });
|
|
2021
|
-
fs.mkdirSync(targetAgentDir, { recursive: true });
|
|
2022
|
-
fs.copyFileSync(stagedAgentFile, targetAgentFile);
|
|
2023
|
-
fs.cpSync(stagedAgentDir, targetAgentDir, { recursive: true, force: true });
|
|
2024
|
-
fs.writeFileSync(
|
|
2025
|
-
path.join(targetAgentDir, AGENT_INSTRUCTIONS_VERSION_FILE),
|
|
2026
|
-
`${remoteVersion}\n`,
|
|
2027
|
-
"utf8"
|
|
2028
|
-
);
|
|
2029
|
-
|
|
2030
|
-
writeUpdateLine(`Agent instructions ${localVersion} -> ${remoteVersion}`);
|
|
2031
|
-
console.log(`โ
Agent instructions replaced in the project root โ v${remoteVersion}.`);
|
|
2032
|
-
} catch (error) {
|
|
2033
|
-
throw new Error(`Required agent instructions installation failed: ${error?.message || error}`);
|
|
2034
|
-
} finally {
|
|
2035
|
-
fs.rmSync(tempRoot, { recursive: true, force: true });
|
|
2036
|
-
}
|
|
2037
|
-
}
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1913
|
+
function getAgentInstructionsZipLayout(zip) {
|
|
1914
|
+
const entries = zip.getEntries().filter(entry => !entry.isDirectory);
|
|
1915
|
+
|
|
1916
|
+
for (const entry of entries) {
|
|
1917
|
+
const normalizedName = entry.entryName.replace(/\\/g, "/");
|
|
1918
|
+
if (
|
|
1919
|
+
normalizedName.startsWith("/") ||
|
|
1920
|
+
normalizedName.split("/").includes("..") ||
|
|
1921
|
+
path.isAbsolute(entry.entryName)
|
|
1922
|
+
) {
|
|
1923
|
+
throw new Error(`Unsafe path in agent instructions ZIP: ${entry.entryName}`);
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
const normalizedEntries = entries.map(entry => ({
|
|
1928
|
+
entry,
|
|
1929
|
+
name: entry.entryName.replace(/\\/g, "/")
|
|
1930
|
+
}));
|
|
1931
|
+
const agentFile = normalizedEntries.find(({ name }) =>
|
|
1932
|
+
name.toLowerCase() === AGENT_INSTRUCTIONS_FILE.toLowerCase()
|
|
1933
|
+
);
|
|
1934
|
+
const agentDirectoryPrefix = `${AGENT_INSTRUCTIONS_DIR.toLowerCase()}/`;
|
|
1935
|
+
const nestedSupportFiles = normalizedEntries
|
|
1936
|
+
.filter(({ name }) => name.toLowerCase().startsWith(agentDirectoryPrefix))
|
|
1937
|
+
.map(({ entry, name }) => ({
|
|
1938
|
+
entry,
|
|
1939
|
+
relativePath: name.slice(name.indexOf("/") + 1)
|
|
1940
|
+
}))
|
|
1941
|
+
.filter(({ relativePath }) => relativePath && relativePath !== AGENT_INSTRUCTIONS_VERSION_FILE);
|
|
1942
|
+
const flatSupportFiles = normalizedEntries
|
|
1943
|
+
.filter(({ name }) =>
|
|
1944
|
+
!name.includes("/") &&
|
|
1945
|
+
name.toLowerCase() !== AGENT_INSTRUCTIONS_FILE.toLowerCase() &&
|
|
1946
|
+
name.toLowerCase() !== AGENT_INSTRUCTIONS_VERSION_FILE.toLowerCase() &&
|
|
1947
|
+
name.toLowerCase().endsWith(".md")
|
|
1948
|
+
)
|
|
1949
|
+
.map(({ entry, name }) => ({ entry, relativePath: name }));
|
|
1950
|
+
const supportFiles = nestedSupportFiles.length ? nestedSupportFiles : flatSupportFiles;
|
|
1951
|
+
|
|
1952
|
+
if (!agentFile || !supportFiles.length) {
|
|
1953
|
+
throw new Error(
|
|
1954
|
+
`Agent instructions ZIP must contain ${AGENT_INSTRUCTIONS_FILE} (case-insensitive) and either files inside ${AGENT_INSTRUCTIONS_DIR}/ or supporting Markdown files at the archive root.`
|
|
1955
|
+
);
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
return { agentFile: agentFile.entry, supportFiles };
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
function readInstalledAgentInstructionsVersion(projectRoot) {
|
|
1962
|
+
const versionFile = path.join(projectRoot, AGENT_INSTRUCTIONS_DIR, AGENT_INSTRUCTIONS_VERSION_FILE);
|
|
1963
|
+
if (!fs.existsSync(versionFile)) return "0";
|
|
1964
|
+
|
|
1965
|
+
const installedVersion = String(fs.readFileSync(versionFile, "utf8")).trim();
|
|
1966
|
+
return /^\d+(?:\.\d+)*$/.test(installedVersion) ? installedVersion : "0";
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1969
|
+
async function syncAgentInstructions() {
|
|
1970
|
+
const projectRoot = process.cwd();
|
|
1971
|
+
const targetAgentFile = path.join(projectRoot, AGENT_INSTRUCTIONS_FILE);
|
|
1972
|
+
const targetAgentDir = path.join(projectRoot, AGENT_INSTRUCTIONS_DIR);
|
|
1973
|
+
const hasAgentDirectoryFiles =
|
|
1974
|
+
fs.existsSync(targetAgentDir) &&
|
|
1975
|
+
fs.statSync(targetAgentDir).isDirectory() &&
|
|
1976
|
+
fs.readdirSync(targetAgentDir).some(name => name !== AGENT_INSTRUCTIONS_VERSION_FILE);
|
|
1977
|
+
const requiredFilesExist = fs.existsSync(targetAgentFile) && hasAgentDirectoryFiles;
|
|
1978
|
+
const localVersion = readInstalledAgentInstructionsVersion(projectRoot);
|
|
1979
|
+
|
|
1980
|
+
const versions = await fetchVersions();
|
|
1981
|
+
const remoteVersion = String(versions?.[AGENT_INSTRUCTIONS_VERSION_KEY] || "").trim();
|
|
1982
|
+
|
|
1983
|
+
if (!/^\d+(?:\.\d+)*$/.test(remoteVersion)) {
|
|
1984
|
+
throw new Error(`Required agent instructions could not be resolved from the server.`);
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1987
|
+
const remoteIsNewer = compareVersionStrings(remoteVersion, localVersion) > 0;
|
|
1988
|
+
if (requiredFilesExist && !remoteIsNewer) {
|
|
1989
|
+
console.log(`โ
Agent instructions do not need an update (local ${localVersion}, online ${remoteVersion}).`);
|
|
1990
|
+
return;
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
const zipName = `${AGENT_INSTRUCTIONS_ZIP_PREFIX}-${remoteVersion}.zip`;
|
|
1994
|
+
const url = `https://htmlcodeplay.com/code-play-plugin/${zipName}`;
|
|
1995
|
+
const tempRoot = fs.mkdtempSync(path.join(require("os").tmpdir(), "codeplay-agents-"));
|
|
1996
|
+
const zipPath = path.join(tempRoot, zipName);
|
|
1997
|
+
const extractPath = path.join(tempRoot, "extracted");
|
|
1998
|
+
|
|
1999
|
+
try {
|
|
2000
|
+
console.log(`๐ Checking latest agent instructions: ${zipName}`);
|
|
2001
|
+
if (!(await urlExists(url))) {
|
|
2002
|
+
throw new Error(`Required agent instructions archive not found: ${url}`);
|
|
2003
|
+
}
|
|
2004
|
+
|
|
2005
|
+
await downloadFile(url, zipPath);
|
|
2006
|
+
console.log(`โฌ๏ธ Downloaded agent instructions archive: ${zipName}`);
|
|
2007
|
+
const zip = new AdmZip(zipPath);
|
|
2008
|
+
const archiveLayout = getAgentInstructionsZipLayout(zip);
|
|
2009
|
+
|
|
2010
|
+
const stagedAgentFile = path.join(extractPath, AGENT_INSTRUCTIONS_FILE);
|
|
2011
|
+
const stagedAgentDir = path.join(extractPath, AGENT_INSTRUCTIONS_DIR);
|
|
2012
|
+
fs.mkdirSync(stagedAgentDir, { recursive: true });
|
|
2013
|
+
fs.writeFileSync(stagedAgentFile, archiveLayout.agentFile.getData());
|
|
2014
|
+
archiveLayout.supportFiles.forEach(({ entry, relativePath }) => {
|
|
2015
|
+
const stagedSupportFile = path.join(stagedAgentDir, relativePath);
|
|
2016
|
+
fs.mkdirSync(path.dirname(stagedSupportFile), { recursive: true });
|
|
2017
|
+
fs.writeFileSync(stagedSupportFile, entry.getData());
|
|
2018
|
+
});
|
|
2019
|
+
|
|
2020
|
+
fs.rmSync(targetAgentDir, { recursive: true, force: true });
|
|
2021
|
+
fs.mkdirSync(targetAgentDir, { recursive: true });
|
|
2022
|
+
fs.copyFileSync(stagedAgentFile, targetAgentFile);
|
|
2023
|
+
fs.cpSync(stagedAgentDir, targetAgentDir, { recursive: true, force: true });
|
|
2024
|
+
fs.writeFileSync(
|
|
2025
|
+
path.join(targetAgentDir, AGENT_INSTRUCTIONS_VERSION_FILE),
|
|
2026
|
+
`${remoteVersion}\n`,
|
|
2027
|
+
"utf8"
|
|
2028
|
+
);
|
|
2029
|
+
|
|
2030
|
+
writeUpdateLine(`Agent instructions ${localVersion} -> ${remoteVersion}`);
|
|
2031
|
+
console.log(`โ
Agent instructions replaced in the project root โ v${remoteVersion}.`);
|
|
2032
|
+
} catch (error) {
|
|
2033
|
+
throw new Error(`Required agent instructions installation failed: ${error?.message || error}`);
|
|
2034
|
+
} finally {
|
|
2035
|
+
fs.rmSync(tempRoot, { recursive: true, force: true });
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
2038
|
|
|
2039
2039
|
|
|
2040
2040
|
|
|
@@ -4143,10 +4143,10 @@ async function main() {
|
|
|
4143
4143
|
validateAndRestoreSignDetails();
|
|
4144
4144
|
execSync('node buildCodeplay/fix-onesignal-plugin.js', { stdio: 'inherit' });
|
|
4145
4145
|
|
|
4146
|
-
await loadPluginVersions(); // ๐ฅ NEW
|
|
4147
|
-
await syncAgentInstructions();
|
|
4148
|
-
|
|
4149
|
-
await syncAdmobNextgenMigration();
|
|
4146
|
+
await loadPluginVersions(); // ๐ฅ NEW
|
|
4147
|
+
await syncAgentInstructions();
|
|
4148
|
+
|
|
4149
|
+
await syncAdmobNextgenMigration();
|
|
4150
4150
|
syncSystemBarsSafeAreaMigration();
|
|
4151
4151
|
await checkPlugins();
|
|
4152
4152
|
syncRevenueCatIapSetup();
|
|
@@ -1,14 +1,14 @@
|
|
|
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)) {
|
|
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
12
|
let fileContent = fs.readFileSync(filePath, 'utf8');
|
|
13
13
|
|
|
14
14
|
// match the hideBannerAd method
|
|
@@ -33,17 +33,17 @@ const replaceEmiPluginCode=()=>
|
|
|
33
33
|
fileContent.slice(match.index + match[0].length);
|
|
34
34
|
|
|
35
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();
|
|
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();
|
|
@@ -19,17 +19,17 @@ const addToolAttribute=()=>{
|
|
|
19
19
|
let manifest = fs.readFileSync(manifestPath, 'utf8');
|
|
20
20
|
|
|
21
21
|
// Check if xmlns:tools exists
|
|
22
|
-
if (!manifest.includes('xmlns:tools="http://schemas.android.com/tools"')) {
|
|
23
|
-
// Add the tools namespace to the <manifest> tag.
|
|
24
|
-
manifest = manifest.replace('<manifest', '<manifest xmlns:tools="http://schemas.android.com/tools"');
|
|
25
|
-
fs.writeFileSync(manifestPath, manifest, 'utf8');
|
|
26
|
-
console.log('โ
Added xmlns:tools to AndroidManifest.xml');
|
|
27
|
-
} else {
|
|
28
|
-
console.log('โน๏ธ xmlns:tools already exists, skipping...');
|
|
29
|
-
}
|
|
30
|
-
} else {
|
|
31
|
-
console.log('โน๏ธ capacitor-cordova-android-plugins AndroidManifest.xml not found, skipping tools namespace update.');
|
|
32
|
-
}
|
|
33
|
-
};
|
|
22
|
+
if (!manifest.includes('xmlns:tools="http://schemas.android.com/tools"')) {
|
|
23
|
+
// Add the tools namespace to the <manifest> tag.
|
|
24
|
+
manifest = manifest.replace('<manifest', '<manifest xmlns:tools="http://schemas.android.com/tools"');
|
|
25
|
+
fs.writeFileSync(manifestPath, manifest, 'utf8');
|
|
26
|
+
console.log('โ
Added xmlns:tools to AndroidManifest.xml');
|
|
27
|
+
} else {
|
|
28
|
+
console.log('โน๏ธ xmlns:tools already exists, skipping...');
|
|
29
|
+
}
|
|
30
|
+
} else {
|
|
31
|
+
console.log('โน๏ธ capacitor-cordova-android-plugins AndroidManifest.xml not found, skipping tools namespace update.');
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
34
|
|
|
35
35
|
addToolAttribute()
|
|
@@ -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.
|
|
@@ -435,5 +435,11 @@ else if(targetAppId=="image.to.text.document")
|
|
|
435
435
|
'<uses-feature android:name="android.hardware.camera" android:required="true" />',
|
|
436
436
|
];
|
|
437
437
|
}
|
|
438
|
-
|
|
438
|
+
else if(targetAppId=="codeplay.love.calculator")
|
|
439
|
+
{
|
|
440
|
+
permissions=[
|
|
441
|
+
'<uses-permission android:name="android.permission.CAMERA" />',
|
|
442
|
+
'<uses-feature android:name="android.hardware.camera" android:required="true" />',
|
|
443
|
+
];
|
|
444
|
+
}
|
|
439
445
|
addAndroidPermissions(permissions);
|