Skip to content

Commit 3882bb8

Browse files
committed
feat: add onDemand
1 parent 7010697 commit 3882bb8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ios/Openvpn.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ - (void)connect:(JS::NativeOpenvpn::ConnectionParams &)params resolve:(nonnull R
4949

5050
self.providerManager.localizedDescription = @"F1VPNs OpenVPN";
5151
[self.providerManager setEnabled:YES];
52-
[self.providerManager setOnDemandEnabled:NO];
52+
[self.providerManager setOnDemandEnabled:YES];
5353
[self.providerManager setProtocolConfiguration:tunel];
5454

5555
[self.providerManager saveToPreferencesWithCompletionHandler:^(NSError *error) {
@@ -125,7 +125,7 @@ - (void)prepare:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromi
125125

126126
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
127127
self.vpnStateObserver = [center addObserverForName:NEVPNStatusDidChangeNotification
128-
object:self.providerManager.connection
128+
object:nil
129129
queue:nil
130130
usingBlock:^(NSNotification *notification) {
131131
NEVPNConnection *nevpnConnection = (NEVPNConnection *)notification.object;

0 commit comments

Comments
 (0)