File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff 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 ( / i m p o r t .* \n (? ! i m p o r t ) / ) ;
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
You can’t perform that action at this time.
0 commit comments