private bool Reconnecting(VpnStateChangedEventArgs e) { return(e.State.Status == VpnStatus.Reconnecting && e.NetworkBlocked && _connected && _appSettings.KillSwitch); }
public Task OnVpnStateChanged(VpnStateChangedEventArgs e) { var status = e.State.Status; if (status == VpnStatus.Reconnecting && e.NetworkBlocked && _connected && _appSettings.KillSwitch || (status == VpnStatus.Disconnected || status == VpnStatus.Disconnecting) && e.Error != VpnError.None) { Post(() => ShowModal(e)); } else { if (status == VpnStatus.Connecting || status == VpnStatus.Connected || (status == VpnStatus.Disconnecting || status == VpnStatus.Disconnected) && e.Error == VpnError.None) { Post(CloseModal); } _connected = status == VpnStatus.Connected; } return(Task.CompletedTask); }
public Task OnVpnStateChanged(VpnStateChangedEventArgs e) { if (!_config.MaintenanceTrackerEnabled) { return(Task.CompletedTask); } _state = e.State; if (e.State.Status == VpnStatus.Connected) { if (!_timer.IsEnabled) { _timer.Interval = _config.MaintenanceCheckInterval; _timer.Start(); } } else { if (_timer.IsEnabled) { _timer.Stop(); } } return(Task.CompletedTask); }
private async Task ShowModalAsync(VpnStateChangedEventArgs e) { VpnError error = e.Error; if (error == VpnError.AuthorizationError) { error = await _connectionErrorResolver.ResolveError(); } switch (error) { case VpnError.UserTierTooLowError: await ForceReconnectAsync(); break; case VpnError.Unpaid: await ShowDelinquencyPopupViewModelAsync(); break; case VpnError.SessionLimitReached: ShowMaximumDeviceLimitModalViewModel(); break; default: ShowDisconnectErrorModalViewModel(error, e.NetworkBlocked); break; } }
public Task OnVpnStateChanged(VpnStateChangedEventArgs e) { if (_appSettings.UseTunAdapter && e.Error == VpnError.TapAdapterInUseError) { _modals.Show <TunInUseModalViewModel>(); return(Task.CompletedTask); } VpnStatus status = e.State.Status; if (ModalShouldBeShown(e)) { Post(() => ShowModal(e)); } else { if (status == VpnStatus.Connecting || status == VpnStatus.Connected || (status == VpnStatus.Disconnecting || status == VpnStatus.Disconnected) && e.Error == VpnError.None) { Post(CloseModal); _modalShowed = false; } } return(Task.CompletedTask); }
public override void OnVpnStateChanged(VpnStateChangedEventArgs e) { _vpnStatus = e.State.Status; Connected = e.State.Status == VpnStatus.Connected && e.State.Server.EntryCountry.EqualsIgnoringCase(CountryCode); }
private bool ModalShouldBeShown(VpnStateChangedEventArgs e) { return(_loggedIn && e.Error != VpnError.NoneKeepEnabledKillSwitch && e.State.Status == VpnStatus.Disconnected && e.UnexpectedDisconnect); }
public ServiceSettingsStateChangedEventArgs(VpnStateChangedEventArgs currentState) { Ensure.NotNull(currentState, nameof(currentState)); IsNetworkBlocked = currentState.NetworkBlocked; CurrentState = currentState; }
public Task OnVpnStateChanged(VpnStateChangedEventArgs e) { _networkBlocked = e.NetworkBlocked && (e.State.Status == VpnStatus.Disconnecting || e.State.Status == VpnStatus.Disconnected); return(Task.CompletedTask); }
private void ShowModal(VpnStateChangedEventArgs e) { dynamic options = new ExpandoObject(); options.NetworkBlocked = e.NetworkBlocked; options.Error = e.Error; _modals.Show <DisconnectErrorModalViewModel>(options); }
private void OnVpnStateChanged(object sender, VpnStateChangedEventArgs e) { if (e.VpnState == 3) { this._timer.Start(); return; } this._timer.Stop(); }
public void OnVpnStateChanged(VpnStateChangedEventArgs e) { if (_guestHoleState.Active || _userStorage.User().Empty()) { return; } SetPropertiesOnVpnStateChanged(e); }
public async Task OnVpnStateChanged(VpnStateChangedEventArgs e) { if (_vpnStatus == e.State.Status) { return; } _vpnStatus = e.State.Status; HandleNotification(); }
public async Task OnVpnStateChanged(VpnStateChangedEventArgs e) { if (e.State.Status == VpnStatus.Connected) { Server currentServer = e.State.Server; ShowVpnAcceleratorReconnectionPopupIfPossible(currentServer); ResetReconnectionStep(); _lastConnectedServer = currentServer; } }
public Task OnVpnStateChanged(VpnStateChangedEventArgs e) { _vpnStatus = e.State.Status; if (_vpnStatus == VpnStatus.Connected) { _reconnectRequiredSettings = _settingsBuilder.Build(); } return(Task.CompletedTask); }
public async Task OnVpnStateChanged(VpnStateChangedEventArgs e) { if (_appSettings.NetworkAdapterType == OpenVpnAdapter.Tun && e.Error == VpnError.TapAdapterInUseError) { _modals.Show <TunInUseModalViewModel>(); return; } VpnStatus status = e.State.Status; switch (e.Error) { case VpnError.CertRevokedOrExpired: await _authCertificateManager.ForceRequestNewKeyPairAndCertificateAsync(); await _vpnManager.ReconnectAsync(new VpnReconnectionSettings { IsToReconnectIfDisconnected = true }); return; case VpnError.CertificateExpired when e.State.Status == VpnStatus.ActionRequired: _lastAuthCertificate = _appSettings.AuthenticationCertificatePem; await _authCertificateManager.ForceRequestNewCertificateAsync(); if (FailedToUpdateAuthCert()) { await _vpnManager.ReconnectAsync(new VpnReconnectionSettings { IsToReconnectIfDisconnected = true }); } else { await _vpnServiceManager.UpdateAuthCertificate(_appSettings.AuthenticationCertificatePem); } return; } if (ModalShouldBeShown(e)) { Post(() => ShowModalAsync(e)); } else { if (status == VpnStatus.Pinging || status == VpnStatus.Connecting || status == VpnStatus.Connected || (status == VpnStatus.Disconnecting || status == VpnStatus.Disconnected) && e.Error == VpnError.None) { Post(CloseModalAsync); } } }
public Task OnVpnStateChanged(VpnStateChangedEventArgs e) { _vpnStatus = e.State.Status; if (_vpnStatus == VpnStatus.Disconnected && !string.IsNullOrEmpty(_name)) { ShowNotification(); } return(Task.CompletedTask); }
private void SetPropertiesOnVpnStateChanged(VpnStateChangedEventArgs e) { if (!string.IsNullOrEmpty(e.State.EntryIp)) { LastServer = LastServerCandidates.ServerByEntryIpAndLabel(e.State.EntryIp, e.State.Label); } State = new VpnState(e.State.Status, LastServer); NetworkBlocked = e.NetworkBlocked; RaiseVpnStateChanged(new VpnStateChangedEventArgs(State, e.Error, e.NetworkBlocked, e.Protocol)); }
public Task OnVpnStateChanged(VpnStateChangedEventArgs e) { _vpnStatus = e.State.Status; _server = e.State.Server; if (_vpnStatus == VpnStatus.Connected || _vpnStatus == VpnStatus.Disconnected) { _pendingReconnect = false; } return(Task.CompletedTask); }
public async Task OnVpnStateChanged(VpnStateChangedEventArgs e) { if (!e.State.Status.Equals(VpnStatus.Connected)) { return; } User user = _userStorage.User(); if (user.TrialStatus().Equals(PlanStatus.TrialNotStarted)) { await Start(); } }
public void OnVpnStateChanged(VpnStateChangedEventArgs e) { var state = e.State; if (!string.IsNullOrEmpty(state.EntryIp)) { _lastServer = _lastServerCandidates.ServerByEntryIp(state.EntryIp); } State = new VpnState(state.Status, _lastServer); _networkBlocked = e.NetworkBlocked; RaiseVpnStateChanged(new VpnStateChangedEventArgs(State, e.Error, e.NetworkBlocked, e.Protocol)); }
public Task OnVpnStateChanged(VpnStateChangedEventArgs e) { if (e.State.Status == VpnStatus.Connected && _proxy.Enabled() && !_modalShown) { _modalShown = true; _dialogs.ShowWarning(Translation.Get("Dialogs_Proxy_msg_ProxyDetected")); } if (e.State.Status == VpnStatus.Disconnected) { _modalShown = false; } return(Task.CompletedTask); }
public Task OnVpnStateChanged(VpnStateChangedEventArgs e) { _vpnState = e.State; if (e.State.Status.Equals(VpnStatus.Connected)) { StartTimer(); } else { StopTimer(); } return(Task.CompletedTask); }
public Task OnVpnStateChanged(VpnStateChangedEventArgs e) { var connected = e.State.Status == VpnStatus.Connected; if (connected) { _timer.Start(); } else { _timer.Stop(); } return(Task.CompletedTask); }
public Task OnVpnStateChanged(VpnStateChangedEventArgs e) { var status = e.State.Status; _disconnected = status == VpnStatus.Disconnected; _connected = status == VpnStatus.Connected; if ((status == VpnStatus.Connecting || status == VpnStatus.Reconnecting || status == VpnStatus.Disconnected) && _networkAddressChanged) { _updateAction.Run(); } return(Task.CompletedTask); }
public void OnVpnStateChanged(VpnStateChangedEventArgs e) { var state = e.State; switch (state.Status) { case VpnStatus.Connecting: case VpnStatus.Reconnecting: _lastServer = _lastServerCandidates.ServerByEntryIp(state.EntryIp); break; } State = new VpnState(state.Status, _lastServer); _networkBlocked = e.NetworkBlocked; RaiseVpnStateChanged(new VpnStateChangedEventArgs(State, e.Error, e.NetworkBlocked, e.Protocol)); }
public void OnVpnStateChanged(VpnStateChangedEventArgs e) { if (_guestHoleState.Active || _userStorage.User().Empty()) { return; } VpnState state = e.State; if (!string.IsNullOrEmpty(state.EntryIp)) { _lastServer = _lastServerCandidates.ServerByEntryIp(state.EntryIp); } _state = new VpnState(state.Status, _lastServer); _networkBlocked = e.NetworkBlocked; RaiseVpnStateChanged(new VpnStateChangedEventArgs(_state, e.Error, e.NetworkBlocked, e.Protocol)); }
public async Task OnVpnStateChanged(VpnStateChangedEventArgs e) { if (_notifyOnNextConnection && ( (e.State.Status == VpnStatus.Disconnected && !e.UnexpectedDisconnect) || (e.State.Status == VpnStatus.Connected && !_isAwaitingNextConnection))) { _notifyOnNextConnection = false; NotifyUserOfReconnectionDueToDowngradeToFreeTier(e.State.Server); } if (e.State.Status != VpnStatus.Connected && _isAwaitingNextConnection) { _isAwaitingNextConnection = false; } if (e.State.Status == VpnStatus.Connected) { _lastConnectedServer = e.State.Server; } _vpnState = e.State; }
public Task OnVpnStateChanged(VpnStateChangedEventArgs e) { _vpnState = e; var pins = GetPins(); foreach (var pin in pins) { pin.Value.OnVpnStateChanged(e); } var secureCorePins = GetSecureCorePins(); foreach (var pin in secureCorePins) { pin.OnVpnStateChanged(e); } return(Task.CompletedTask); }
public Task OnVpnStateChanged(VpnStateChangedEventArgs e) { var server = e.State.Server; switch (e.State.Status) { case VpnStatus.Connected: _systemNotification.Show(Translation.Format("Notifications_VpnState_msg_Connected", server?.Name, Environment.NewLine, server?.ExitIp)); break; case VpnStatus.Disconnecting when _lastVpnStatus == VpnStatus.Connected: case VpnStatus.Disconnected when _lastVpnStatus == VpnStatus.Connected: _systemNotification.Show(Translation.Get("Notifications_VpnState_msg_Disconnected")); break; } _lastVpnStatus = e.State.Status; return(Task.CompletedTask); }