Skip to content

Commit

Permalink
[优化]
Browse files Browse the repository at this point in the history
  • Loading branch information
luke committed Apr 28, 2023
1 parent dcf24f6 commit da23cfb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
5 changes: 1 addition & 4 deletions ios/Classes/SwiftOpenVPNFlutterPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,7 @@ class VPNUtils {
}
})
} else {
guard let err = error else { return }
if err.localizedDescription == "permission denied" {
completion(error);
}
completion(error);
}
})
}
Expand Down
9 changes: 4 additions & 5 deletions lib/src/vpn_engine.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,26 +121,25 @@ class OpenVPN {
///username & password : set your username and password if your config file has auth-user-pass
///
///bypassPackages : exclude some apps to access/use the VPN Connection, it was List<String> of applications package's name (Android Only)
Future<dynamic> connect(String config, String name,
Future connect(String config, String name,
{String? username,
String? password,
List<String>? bypassPackages,
bool certIsRequired = false}) async {
bool certIsRequired = false}) {
if (!initialized) throw ("OpenVPN need to be initialized");
if (!certIsRequired) config += "client-cert-not-required";
_tempDateTime = DateTime.now();

try {
return await _channelControl.invokeMethod("connect", {
return _channelControl.invokeMethod("connect", {
"config": config,
"name": name,
"username": username,
"password": password,
"bypass_packages": bypassPackages ?? []
});
} on PlatformException catch (e) {
return e.message;
// throw FlutterError('${e.message}}');
throw ArgumentError(e.message);
}
}

Expand Down

0 comments on commit da23cfb

Please sign in to comment.