codeplay-common 4.8.0 → 4.8.2
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/.gitattributes +2 -2
- package/LICENSE +21 -21
- package/README.md +154 -154
- package/files/buildCodeplay/codeplayBeforeBuild-6.4.js +4329 -4329
- 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/release-sync.config.json +4 -4
- package/files/buildCodeplay/remove-force-kotlin-disable.js +43 -43
- package/files/buildCodeplay/setSplashAnimation-1.4.js +70 -70
- package/files/buildCodeplay/versions.json +4 -4
- package/files/finalrelease +49 -49
- package/files/generate-ai-promo-video.js +23 -23
- package/files/iap-install-2.js +145 -145
- package/files/ionic.config.json +6 -6
- package/files/scripts/setup-baseline-profile.js +265 -265
- package/files/scripts-screenshot/screenshot/background-decorations.js +120 -120
- package/files/scripts-screenshot/screenshot/frame-samples.js +117 -117
- package/files/scripts-screenshot/screenshot/screenshot-copy.json +3 -44
- package/files/scripts-screenshot/screenshot/screenshot-info.json +1737 -1737
- package/files/take-screen-image.js +3968 -3949
- package/files/take-screen-video.js +644 -644
- package/package.json +15 -15
- package/scripts/sync-files.js +104 -104
- package/scripts/uninstall.js +109 -109
|
@@ -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.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{
|
|
2
|
-
"url": "https://htmlcodeplay.com/codeplay/api/v1/release/sync",
|
|
3
|
-
"token": "b_TiY0Lu7q7Yb0Kx9djVxA6ST8k4CFiwFQNxgci7AAU"
|
|
4
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"url": "https://htmlcodeplay.com/codeplay/api/v1/release/sync",
|
|
3
|
+
"token": "b_TiY0Lu7q7Yb0Kx9djVxA6ST8k4CFiwFQNxgci7AAU"
|
|
4
|
+
}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
const legacyPluginXmlPath = path.resolve(
|
|
5
|
-
__dirname,
|
|
6
|
-
'../node_modules/emi-indo-cordova-plugin-admob/plugin.xml'
|
|
7
|
-
);
|
|
8
|
-
|
|
9
|
-
const nextGenPackagePath = path.resolve(
|
|
10
|
-
__dirname,
|
|
11
|
-
'../node_modules/capacitor-admob-nextgen/package.json'
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
if (!fs.existsSync(legacyPluginXmlPath)) {
|
|
15
|
-
if (fs.existsSync(nextGenPackagePath)) {
|
|
16
|
-
console.log('ℹ️ Skipping legacy Kotlin patch. capacitor-admob-nextgen is installed and does not use plugin.xml.');
|
|
17
|
-
process.exit(0);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
console.log('ℹ️ Legacy AdMob plugin.xml not found, skipping Kotlin patch.');
|
|
21
|
-
process.exit(0);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
fs.readFile(legacyPluginXmlPath, 'utf8', (err, data) => {
|
|
25
|
-
if (err) {
|
|
26
|
-
console.error('Error reading plugin.xml:', err);
|
|
27
|
-
process.exit(1);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const modifiedData = data.replace(
|
|
31
|
-
/<framework\s+src="src\/android\/force-kotlin\.gradle"\s+custom="true"\s+type="gradleReference"\s*\/>\s*\n?/g,
|
|
32
|
-
''
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
fs.writeFile(legacyPluginXmlPath, modifiedData, 'utf8', (writeErr) => {
|
|
36
|
-
if (writeErr) {
|
|
37
|
-
console.error('Error writing plugin.xml:', writeErr);
|
|
38
|
-
process.exit(1);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
console.log('plugin.xml updated successfully.');
|
|
42
|
-
});
|
|
43
|
-
});
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
const legacyPluginXmlPath = path.resolve(
|
|
5
|
+
__dirname,
|
|
6
|
+
'../node_modules/emi-indo-cordova-plugin-admob/plugin.xml'
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
const nextGenPackagePath = path.resolve(
|
|
10
|
+
__dirname,
|
|
11
|
+
'../node_modules/capacitor-admob-nextgen/package.json'
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
if (!fs.existsSync(legacyPluginXmlPath)) {
|
|
15
|
+
if (fs.existsSync(nextGenPackagePath)) {
|
|
16
|
+
console.log('ℹ️ Skipping legacy Kotlin patch. capacitor-admob-nextgen is installed and does not use plugin.xml.');
|
|
17
|
+
process.exit(0);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
console.log('ℹ️ Legacy AdMob plugin.xml not found, skipping Kotlin patch.');
|
|
21
|
+
process.exit(0);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
fs.readFile(legacyPluginXmlPath, 'utf8', (err, data) => {
|
|
25
|
+
if (err) {
|
|
26
|
+
console.error('Error reading plugin.xml:', err);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const modifiedData = data.replace(
|
|
31
|
+
/<framework\s+src="src\/android\/force-kotlin\.gradle"\s+custom="true"\s+type="gradleReference"\s*\/>\s*\n?/g,
|
|
32
|
+
''
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
fs.writeFile(legacyPluginXmlPath, modifiedData, 'utf8', (writeErr) => {
|
|
36
|
+
if (writeErr) {
|
|
37
|
+
console.error('Error writing plugin.xml:', writeErr);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
console.log('plugin.xml updated successfully.');
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -122,74 +122,74 @@ animations.forEach((animation) => {
|
|
|
122
122
|
const newMainActivityCode =
|
|
123
123
|
`package ${findPackageName()};
|
|
124
124
|
|
|
125
|
-
import android.os.Build;
|
|
126
|
-
import android.os.Bundle;
|
|
127
|
-
import android.view.View;
|
|
128
|
-
import android.webkit.WebView;
|
|
129
|
-
import com.getcapacitor.BridgeActivity;
|
|
130
|
-
import com.getcapacitor.CapConfig;
|
|
131
|
-
import com.getcapacitor.WebViewListener;
|
|
132
|
-
import org.json.JSONException;
|
|
133
|
-
import java.util.Locale;
|
|
134
|
-
|
|
135
|
-
import androidx.activity.EdgeToEdge;
|
|
136
|
-
import androidx.core.graphics.Insets;
|
|
137
|
-
import androidx.core.view.ViewCompat;
|
|
138
|
-
import androidx.core.view.WindowInsetsCompat;
|
|
139
|
-
|
|
140
|
-
public class MainActivity extends BridgeActivity {
|
|
141
|
-
@Override
|
|
142
|
-
protected void load() {
|
|
143
|
-
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.VANILLA_ICE_CREAM) {
|
|
144
|
-
config = CapConfig.loadDefault(this);
|
|
145
|
-
try {
|
|
146
|
-
config.getPluginConfiguration("SystemBars").getConfigJSON().put("insetsHandling", "disable");
|
|
147
|
-
} catch (JSONException e) {
|
|
148
|
-
throw new IllegalStateException("Unable to configure system bars", e);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
super.load();
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
@Override
|
|
155
|
-
protected void onCreate(Bundle savedInstanceState) {
|
|
156
|
-
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.VANILLA_ICE_CREAM) {
|
|
157
|
-
bridgeBuilder.addWebViewListener(new WebViewListener() {
|
|
158
|
-
@Override
|
|
159
|
-
public void onPageCommitVisible(WebView webView, String url) {
|
|
160
|
-
ViewCompat.requestApplyInsets(getWindow().getDecorView());
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
super.onCreate(savedInstanceState);
|
|
165
|
-
|
|
166
|
-
EdgeToEdge.enable(this);
|
|
167
|
-
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.VANILLA_ICE_CREAM) {
|
|
168
|
-
View decorView = getWindow().getDecorView();
|
|
169
|
-
ViewCompat.setOnApplyWindowInsetsListener(decorView, (view, insets) -> {
|
|
170
|
-
Insets bars = insets.getInsets(WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.displayCutout());
|
|
171
|
-
float density = getResources().getDisplayMetrics().density;
|
|
172
|
-
int top = Math.round(bars.top / density);
|
|
173
|
-
int right = Math.round(bars.right / density);
|
|
174
|
-
int bottom = insets.isVisible(WindowInsetsCompat.Type.ime()) ? 0 : Math.round(bars.bottom / density);
|
|
175
|
-
int left = Math.round(bars.left / density);
|
|
176
|
-
|
|
177
|
-
if (bridge != null && bridge.getWebView() != null) {
|
|
178
|
-
String script = String.format(Locale.US, """
|
|
179
|
-
try {
|
|
180
|
-
const root = document.documentElement;
|
|
181
|
-
root.style.setProperty('--android-system-bar-top', '%dpx');
|
|
182
|
-
root.style.setProperty('--android-system-bar-right', '%dpx');
|
|
183
|
-
root.style.setProperty('--android-system-bar-bottom', '%dpx');
|
|
184
|
-
root.style.setProperty('--android-system-bar-left', '%dpx');
|
|
185
|
-
} catch (e) {}
|
|
186
|
-
""", top, right, bottom, left);
|
|
187
|
-
bridge.getWebView().evaluateJavascript(script, null);
|
|
188
|
-
}
|
|
189
|
-
return insets;
|
|
190
|
-
});
|
|
191
|
-
ViewCompat.requestApplyInsets(decorView);
|
|
192
|
-
}
|
|
125
|
+
import android.os.Build;
|
|
126
|
+
import android.os.Bundle;
|
|
127
|
+
import android.view.View;
|
|
128
|
+
import android.webkit.WebView;
|
|
129
|
+
import com.getcapacitor.BridgeActivity;
|
|
130
|
+
import com.getcapacitor.CapConfig;
|
|
131
|
+
import com.getcapacitor.WebViewListener;
|
|
132
|
+
import org.json.JSONException;
|
|
133
|
+
import java.util.Locale;
|
|
134
|
+
|
|
135
|
+
import androidx.activity.EdgeToEdge;
|
|
136
|
+
import androidx.core.graphics.Insets;
|
|
137
|
+
import androidx.core.view.ViewCompat;
|
|
138
|
+
import androidx.core.view.WindowInsetsCompat;
|
|
139
|
+
|
|
140
|
+
public class MainActivity extends BridgeActivity {
|
|
141
|
+
@Override
|
|
142
|
+
protected void load() {
|
|
143
|
+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.VANILLA_ICE_CREAM) {
|
|
144
|
+
config = CapConfig.loadDefault(this);
|
|
145
|
+
try {
|
|
146
|
+
config.getPluginConfiguration("SystemBars").getConfigJSON().put("insetsHandling", "disable");
|
|
147
|
+
} catch (JSONException e) {
|
|
148
|
+
throw new IllegalStateException("Unable to configure system bars", e);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
super.load();
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
@Override
|
|
155
|
+
protected void onCreate(Bundle savedInstanceState) {
|
|
156
|
+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.VANILLA_ICE_CREAM) {
|
|
157
|
+
bridgeBuilder.addWebViewListener(new WebViewListener() {
|
|
158
|
+
@Override
|
|
159
|
+
public void onPageCommitVisible(WebView webView, String url) {
|
|
160
|
+
ViewCompat.requestApplyInsets(getWindow().getDecorView());
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
super.onCreate(savedInstanceState);
|
|
165
|
+
|
|
166
|
+
EdgeToEdge.enable(this);
|
|
167
|
+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.VANILLA_ICE_CREAM) {
|
|
168
|
+
View decorView = getWindow().getDecorView();
|
|
169
|
+
ViewCompat.setOnApplyWindowInsetsListener(decorView, (view, insets) -> {
|
|
170
|
+
Insets bars = insets.getInsets(WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.displayCutout());
|
|
171
|
+
float density = getResources().getDisplayMetrics().density;
|
|
172
|
+
int top = Math.round(bars.top / density);
|
|
173
|
+
int right = Math.round(bars.right / density);
|
|
174
|
+
int bottom = insets.isVisible(WindowInsetsCompat.Type.ime()) ? 0 : Math.round(bars.bottom / density);
|
|
175
|
+
int left = Math.round(bars.left / density);
|
|
176
|
+
|
|
177
|
+
if (bridge != null && bridge.getWebView() != null) {
|
|
178
|
+
String script = String.format(Locale.US, """
|
|
179
|
+
try {
|
|
180
|
+
const root = document.documentElement;
|
|
181
|
+
root.style.setProperty('--android-system-bar-top', '%dpx');
|
|
182
|
+
root.style.setProperty('--android-system-bar-right', '%dpx');
|
|
183
|
+
root.style.setProperty('--android-system-bar-bottom', '%dpx');
|
|
184
|
+
root.style.setProperty('--android-system-bar-left', '%dpx');
|
|
185
|
+
} catch (e) {}
|
|
186
|
+
""", top, right, bottom, left);
|
|
187
|
+
bridge.getWebView().evaluateJavascript(script, null);
|
|
188
|
+
}
|
|
189
|
+
return insets;
|
|
190
|
+
});
|
|
191
|
+
ViewCompat.requestApplyInsets(decorView);
|
|
192
|
+
}
|
|
193
193
|
|
|
194
194
|
// Handle custom splash screen exit animation
|
|
195
195
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
|
@@ -204,8 +204,8 @@ import androidx.core.view.WindowInsetsCompat;
|
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
}
|
|
208
|
-
`;
|
|
207
|
+
}
|
|
208
|
+
`;
|
|
209
209
|
|
|
210
210
|
// Write the new MainActivity.java content
|
|
211
211
|
writeMainActivity(newMainActivityCode);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"plugins":[
|
|
3
3
|
{"name":"backbutton","pattern":"backbutton-(\\d+\\.\\d+)\\.js$","minVersion":"2.1","baseDir":"js","mandatoryUpdate":true},
|
|
4
|
-
{"name":"common-js","pattern":"common-(\\d+\\.\\d+)(?:-beta-(\\d+))?\\.js$","minVersion":"6.7","baseDir":"js","mandatoryUpdate":true},
|
|
4
|
+
{"name":"common-js","pattern":"common-(\\d+\\.\\d+)(?:-beta-(\\d+))?\\.js$","minVersion":"6.7","baseDir":"js","mandatoryUpdate":true},
|
|
5
5
|
|
|
6
|
-
{"name":"admob-emi-nextgen","pattern":"Ads[\\\\/]admob-emi-nextgen-(\\d+\\.\\d+)\\.js$","minVersion":"2.5","baseDir":"js","mandatoryUpdate":true},
|
|
6
|
+
{"name":"admob-emi-nextgen","pattern":"Ads[\\\\/]admob-emi-nextgen-(\\d+\\.\\d+)\\.js$","minVersion":"2.5","baseDir":"js","mandatoryUpdate":true},
|
|
7
7
|
{"name":"video-player","pattern":"video-player-(\\d+\\.\\d+)\\.js$","minVersion":"1.6","baseDir":"js","mandatoryUpdate":true},
|
|
8
8
|
{"name":"image-cropper","pattern":"image-cropper-(\\d+\\.\\d+)\\.js$","minVersion":"1.1","baseDir":"js","mandatoryUpdate":true},
|
|
9
9
|
{"name":"beautify","pattern":"beautify-(\\d+\\.\\d+)\\.js$","minVersion":"1.1","baseDir":"js","mandatoryUpdate":true},
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
{"name":"ffmpeg","pattern":"ffmpeg-(\\d+\\.\\d+)$","minVersion":"1.6","baseDir":"js","mandatoryUpdate":true,"isFolder":true},
|
|
18
18
|
{"name":"theme","pattern":"theme-(\\d+\\.\\d+)$","minVersion":"3.5","baseDir":"theme","destDir":"theme","mandatoryUpdate":true,"isFolder":true},
|
|
19
19
|
{"name":"certificatejs","pattern":"certificatejs-(\\d+\\.\\d+)$","minVersion":"1.9","baseDir":"certificate","destDir":"certificate","mandatoryUpdate":true,"isFolder":true},
|
|
20
|
-
{"name":"IAP","pattern":"IAP-(\\d+\\.\\d+)$","minVersion":"4.2","baseDir":"js/Ads","mandatoryUpdate":true,"isFolder":true},
|
|
20
|
+
{"name":"IAP","pattern":"IAP-(\\d+\\.\\d+)$","minVersion":"4.2","baseDir":"js/Ads","mandatoryUpdate":true,"isFolder":true},
|
|
21
21
|
{"name":"common-less","pattern":"common-(\\d+\\.\\d+)\\.less$","minVersion":"1.8","baseDir":"assets/css","mandatoryUpdate":true},
|
|
22
22
|
{"name":"localNotification_AppSettings","pattern":"localNotification_AppSettings-(\\d+\\.\\d+)\\.js$","minVersion":"1.0","baseDir":"js","mandatoryUpdate":true},
|
|
23
23
|
{"name":"localNotification","pattern":"localNotification-(\\d+\\.\\d+)\\.js$","minVersion":"2.2","baseDir":"js","mandatoryUpdate":true},
|
|
24
24
|
{"name":"onesignal","pattern":"onesignal-(\\d+\\.\\d+)\\.js$","minVersion":"2.4","baseDir":"js","mandatoryUpdate":true},
|
|
25
25
|
{"name":"saveToGalleryAndSaveAnyFile","pattern":"saveToGalleryAndSaveAnyFile-(\\d+\\.\\d+)(-ios)?\\.js$","minVersion":"3.1","baseDir":"js","mandatoryUpdate":true}
|
|
26
26
|
]
|
|
27
|
-
}
|
|
27
|
+
}
|