Skip to content

Commit 9ef80ae

Browse files
committed
feat: enhance VPN integration by adding import statement for VPNPackage
1 parent 0211ae6 commit 9ef80ae

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

plugins/withVPNModule.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ const withVPNModule = (config) => {
2626
if (fs.existsSync(mainApplicationPath)) {
2727
let content = fs.readFileSync(mainApplicationPath, 'utf-8');
2828

29+
// Add import statement for VPNPackage if not present
30+
if (!content.includes('import com.cbv.vpn.VPNPackage')) {
31+
// Find the last import statement and add our import after it
32+
const lastImportMatch = content.match(/import .*\n(?!import)/);
33+
if (lastImportMatch) {
34+
const lastImportIndex = content.indexOf(lastImportMatch[0]) + lastImportMatch[0].length;
35+
content = content.slice(0, lastImportIndex) +
36+
'\n// Import VPN package\nimport com.cbv.vpn.VPNPackage\n' +
37+
content.slice(lastImportIndex);
38+
}
39+
}
40+
2941
// Add VPNPackage to packages list if not present
3042
if (!content.includes('VPNPackage()')) {
3143
content = content.replace(
@@ -35,7 +47,7 @@ const withVPNModule = (config) => {
3547
}
3648

3749
fs.writeFileSync(mainApplicationPath, content);
38-
console.log('✅ Added VPNPackage to MainApplication.kt');
50+
console.log('✅ Added VPNPackage import and registration to MainApplication.kt');
3951
}
4052

4153
// Copy native files from template

0 commit comments

Comments
 (0)