@@ -147,9 +147,10 @@ class VpnclientEngineFlutter {
147147
148148 // Static methods for backward compatibility
149149 /// Initialize the plugin (static method)
150- static Future <void > initialize () async {
150+ static Future <void > initialize ({ VpnStatusCallback ? onStatusChanged} ) async {
151151 _log ('Initializing VpnclientEngineFlutter plugin (static)' );
152- // Plugin is ready to use
152+ instance.setStatusCallback (onStatusChanged);
153+ await instance.initialize ();
153154 }
154155
155156 /// Get platform version
@@ -175,46 +176,46 @@ class VpnclientEngineFlutter {
175176
176177 /// Connect using specified engine (static method)
177178 static Future <bool > connect (EngineType engine, String config) async {
178- return await client .connect (engine, config);
179+ return await instance .connect (engine, config);
179180 }
180181
181182 /// Disconnect current connection (static method)
182183 static Future <void > disconnect () async {
183- await client .disconnect ();
184+ await instance .disconnect ();
184185 }
185186
186187 /// Test configuration with specified engine (static method)
187188 static Future <bool > testConfig (EngineType engine, String config) async {
188- return await client .testConfig (engine, config);
189+ return await instance .testConfig (engine, config);
189190 }
190191
191192 /// Ping server with specified engine (static method)
192193 static Future <int > ping (EngineType engine, String config, String url, {int timeout = 10 }) async {
193- return await client .ping (engine, config, url, timeout: timeout);
194+ return await instance .ping (engine, config, url, timeout: timeout);
194195 }
195196
196197 /// Get version of specified engine (static method)
197198 static Future <String > getVersion (EngineType engine) async {
198- return await client .getVersion (engine);
199+ return await instance .getVersion (engine);
199200 }
200201
201202 /// Get current connection status (static method)
202203 static Future <ConnectionStatus > getConnectionStatus () async {
203- return await client .getConnectionStatus ();
204+ return await instance .getConnectionStatus ();
204205 }
205206
206207 /// Request permissions for specified engine (static method)
207208 static Future <bool > requestPermissions (EngineType engine) async {
208- return await client .requestPermissions (engine);
209+ return await instance .requestPermissions (engine);
209210 }
210211
211212 /// Get current engine (static method)
212213 static VpnEngine ? getCurrentEngine () {
213- return client.currentEngine ;
214+ return instance. getCurrentEngine () ;
214215 }
215216
216217 /// Get current engine type (static method)
217218 static EngineType ? getCurrentEngineType () {
218- return client.currentEngineType ;
219+ return instance. getCurrentEngineType () ;
219220 }
220221}
0 commit comments