Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions lib/modules/core/vpn.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ class VPN {
final ref = _container!;
final loggerNotifier = ref.read(loggerStateProvider.notifier);
final groupNotifier = ref.read(groupStateProvider.notifier);
final connectionState = ref.read(connectionStateProvider);

final connectionStateIsError =
connectionState.status == ConnectionStatus.error;

if (msg.startsWith("Data: Config index: ")) {
final configIndex = msg.replaceAll("Data: Config index: ", "");
Expand All @@ -144,13 +148,13 @@ class VPN {
_onFailerConnect();
}
if (msg.startsWith("Data: VPN cancelled")) {
_closeTunnel();
_closeTunnel(keepConnectionStatus: connectionStateIsError);
}
if (msg.startsWith("Data: VPN group failed")) {
loggerNotifier.setSwitchingMethod();
}
if (msg.startsWith("Data: VPN stopped")) {
_closeTunnel();
_closeTunnel(keepConnectionStatus: connectionStateIsError);
}
if (msg.startsWith("Data: VPN connecting")) {
_onLoading();
Expand Down Expand Up @@ -410,17 +414,22 @@ class VPN {
analyticsService.logVpnDisconnected();
}

Future<void> _closeTunnel() async {
Future<void> _closeTunnel({bool keepConnectionStatus = false}) async {
final connectionNotifier = _container?.read(
connectionStateProvider.notifier,
);
final vpnData = await _container?.read(vpnDataProvider.future);
connectionNotifier?.setDisconnecting();

if (!keepConnectionStatus) {
connectionNotifier?.setDisconnecting();
}
if (Platform.isIOS) {
await _vpnBridge.disconnectVpn();
}
await vpnData?.disableVPN();
connectionNotifier?.setDisconnected();
if (!keepConnectionStatus) {
connectionNotifier?.setDisconnected();
}
analyticsService.logVpnDisconnected();
_isReconnectMode = false;
}
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: defyx_vpn
description: "Defyx VPN - Secure, fast, and reliable VPN service providing global privacy protection with advanced encryption and multi-platform support"
publish_to: "none"
version: 5.7.5+286
version: 5.8.0+287

environment:
sdk: ^3.8.0
Expand Down Expand Up @@ -105,7 +105,7 @@ msix_config:
display_name: Defyx VPN
publisher_display_name: UnboundTech UG
identity_name: UnboundTechUG.6065AEC5A207
msix_version: 5.7.4.285
msix_version: 5.8.0.287
publisher: "CN=62937938-2AE2-4C12-9ED8-4C418C0CADF2"
logo_path: assets/images/logo.png
capabilities: runFullTrust,internetClientServer,privateNetworkClientServer,unvirtualizedResources
Expand Down