From 95dc49e86527ec9c705e5d7b3c58377a70807888 Mon Sep 17 00:00:00 2001
From: Jamie <5356206+Stoom@users.noreply.github.com>
Date: Sun, 11 Aug 2024 09:03:43 -0500
Subject: [PATCH 1/2] feat: Auto connect on insecure wifi
---
src/ProtonVPN.App/App.config | 3 +++
.../Diagnostic/UserSettingsLog.cs | 1 +
src/ProtonVPN.App/Core/AppSettings.cs | 6 +++++
src/ProtonVPN.App/Core/AutoConnect.cs | 27 +++++++++++++++++++
.../Properties/Settings.Designer.cs | 12 +++++++++
.../Properties/Settings.settings | 3 +++
.../v1_27_1/AppSettingsMigration.cs | 7 +++++
.../Settings/SettingsModalView.xaml | 16 +++++++++++
.../Settings/SettingsModalViewModel.cs | 6 +++++
src/ProtonVPN.Core/ProtonVPN.Core.csproj | 1 +
src/ProtonVPN.Core/Settings/IAppSettings.cs | 1 +
.../Automation/Config.xaml | 1 +
.../Properties/Resources.Designer.cs | 20 +++++++++++++-
.../Properties/Resources.en-US.resx | 8 ++++++
.../Windows/SettingsWindow.cs | 7 +++++
15 files changed, 118 insertions(+), 1 deletion(-)
diff --git a/src/ProtonVPN.App/App.config b/src/ProtonVPN.App/App.config
index 8a3ae4b87..6b4df2f54 100644
--- a/src/ProtonVPN.App/App.config
+++ b/src/ProtonVPN.App/App.config
@@ -370,6 +370,9 @@
True
+
+ True
+
True
diff --git a/src/ProtonVPN.App/BugReporting/Diagnostic/UserSettingsLog.cs b/src/ProtonVPN.App/BugReporting/Diagnostic/UserSettingsLog.cs
index 321f373bc..7e7adb956 100644
--- a/src/ProtonVPN.App/BugReporting/Diagnostic/UserSettingsLog.cs
+++ b/src/ProtonVPN.App/BugReporting/Diagnostic/UserSettingsLog.cs
@@ -71,6 +71,7 @@ private IEnumerable> GetProperties()
yield return new(nameof(IAppSettings.AppFirstRun), _appSettings.AppFirstRun);
yield return new(nameof(IAppSettings.ShowNotifications), _appSettings.ShowNotifications);
yield return new(nameof(IAppSettings.ConnectOnAppStart), _appSettings.ConnectOnAppStart);
+ yield return new(nameof(IAppSettings.ConnectOnInsecureWifi), _appSettings.ConnectOnInsecureWifi);
yield return new(nameof(IAppSettings.QuickConnect), _appSettings.QuickConnect);
yield return new(nameof(IAppSettings.StartOnBoot), _appSettings.StartOnBoot);
yield return new(nameof(IAppSettings.StartMinimized), _appSettings.StartMinimized);
diff --git a/src/ProtonVPN.App/Core/AppSettings.cs b/src/ProtonVPN.App/Core/AppSettings.cs
index 0ac2ead78..c1f05d25b 100644
--- a/src/ProtonVPN.App/Core/AppSettings.cs
+++ b/src/ProtonVPN.App/Core/AppSettings.cs
@@ -498,6 +498,12 @@ public bool ConnectOnAppStart
set => Set(value);
}
+ public bool ConnectOnInsecureWifi
+ {
+ get => Get();
+ set => Set(value);
+ }
+
[Obsolete(
"Use this only for checking if the user enabled/disabled the feature." +
"Use IsSmartReconnectEnabled() for checking if Smart Reconnect is/should be enabled.")]
diff --git a/src/ProtonVPN.App/Core/AutoConnect.cs b/src/ProtonVPN.App/Core/AutoConnect.cs
index 464f376c0..1866e3097 100644
--- a/src/ProtonVPN.App/Core/AutoConnect.cs
+++ b/src/ProtonVPN.App/Core/AutoConnect.cs
@@ -26,24 +26,30 @@
using ProtonVPN.Core.Service.Vpn;
using ProtonVPN.Core.Settings;
using ProtonVPN.Core.Vpn;
+using ProtonVPN.Core.Network;
namespace ProtonVPN.Core
{
internal class AutoConnect : IVpnStateAware
{
private readonly IAppSettings _appSettings;
+ private readonly INetworkClient _networkClient;
private readonly IVpnManager _vpnManager;
private readonly ILogger _logger;
private VpnStatus _vpnStatus;
public AutoConnect(
IAppSettings appSettings,
+ INetworkClient networkClient,
IVpnManager vpnManager,
ILogger logger)
{
_appSettings = appSettings;
+ _networkClient = networkClient;
_vpnManager = vpnManager;
_logger = logger;
+
+ _networkClient.WifiChangeDetected += OnWifiChangeDetected;
}
public async Task LoadAsync(bool autoLogin)
@@ -75,5 +81,26 @@ public Task OnVpnStateChanged(VpnStateChangedEventArgs e)
return Task.CompletedTask;
}
+
+ private void OnWifiChangeDetected(object sender, WifiChangeEventArgs e)
+ {
+ if (e.Secure || !_appSettings.ConnectOnInsecureWifi)
+ {
+ return;
+ }
+
+ Task.Factory.StartNew(async () =>
+ {
+ try
+ {
+ _logger.Info("Automatically connecting on insecure wifi");
+ await _vpnManager.QuickConnectAsync();
+ }
+ catch (OperationCanceledException ex)
+ {
+ _logger.Error("An error occurred when connecting automatically on insecure wifi.", ex);
+ }
+ });
+ }
}
}
\ No newline at end of file
diff --git a/src/ProtonVPN.App/Properties/Settings.Designer.cs b/src/ProtonVPN.App/Properties/Settings.Designer.cs
index 28fb95f79..326397c13 100644
--- a/src/ProtonVPN.App/Properties/Settings.Designer.cs
+++ b/src/ProtonVPN.App/Properties/Settings.Designer.cs
@@ -1458,6 +1458,18 @@ public bool ConnectOnAppStart {
}
}
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("True")]
+ public bool ConnectOnInsecureWifi {
+ get {
+ return ((bool)(this["ConnectOnInsecureWifi"]));
+ }
+ set {
+ this["ConnectOnInsecureWifi"] = value;
+ }
+ }
+
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
diff --git a/src/ProtonVPN.App/Properties/Settings.settings b/src/ProtonVPN.App/Properties/Settings.settings
index 276ed6166..bf2cbe1b3 100644
--- a/src/ProtonVPN.App/Properties/Settings.settings
+++ b/src/ProtonVPN.App/Properties/Settings.settings
@@ -362,6 +362,9 @@
True
+
+ True
+
True
diff --git a/src/ProtonVPN.App/Settings/Migrations/v1_27_1/AppSettingsMigration.cs b/src/ProtonVPN.App/Settings/Migrations/v1_27_1/AppSettingsMigration.cs
index 72793e1d8..47959d22a 100644
--- a/src/ProtonVPN.App/Settings/Migrations/v1_27_1/AppSettingsMigration.cs
+++ b/src/ProtonVPN.App/Settings/Migrations/v1_27_1/AppSettingsMigration.cs
@@ -28,6 +28,7 @@ namespace ProtonVPN.Settings.Migrations.v1_27_1
internal class AppSettingsMigration : BaseAppSettingsMigration
{
private const string UserAutoConnectKey = "UserAutoConnect";
+ private const string UserAutoConnectOnInsecureWifiKey = "ConnectOnInsecureWifi";
private const string StartOnStartupKey = "StartOnStartup";
private readonly InitialAppSettingsMigration _initialAppSettingsMigration;
@@ -53,6 +54,12 @@ private void MigrateAutoConnect()
bool autoConnect = autoConnectSettings.Any(setting => !setting.Value.IsNullOrEmpty());
Settings.Set(nameof(IAppSettings.ConnectOnAppStart), _initialAppSettingsMigration.IsCleanInstall || autoConnect);
}
+ PerUser[] autoConnectOnInsecureSettings = Settings.Get[]>(UserAutoConnectOnInsecureWifiKey);
+ if (autoConnectOnInsecureSettings != null)
+ {
+ bool autoConnect = autoConnectOnInsecureSettings.Any(setting => !setting.Value.IsNullOrEmpty());
+ Settings.Set(nameof(IAppSettings.ConnectOnInsecureWifi), _initialAppSettingsMigration.IsCleanInstall || autoConnect);
+ }
}
private void MigrateStartOnStartup()
diff --git a/src/ProtonVPN.App/Settings/SettingsModalView.xaml b/src/ProtonVPN.App/Settings/SettingsModalView.xaml
index e8147b6f4..34efb104a 100644
--- a/src/ProtonVPN.App/Settings/SettingsModalView.xaml
+++ b/src/ProtonVPN.App/Settings/SettingsModalView.xaml
@@ -210,6 +210,22 @@ along with ProtonVPN. If not, see .
+
+
+
+
+
+
+
+
+
+
diff --git a/src/ProtonVPN.App/Settings/SettingsModalViewModel.cs b/src/ProtonVPN.App/Settings/SettingsModalViewModel.cs
index 430e4a46d..d6c279f04 100644
--- a/src/ProtonVPN.App/Settings/SettingsModalViewModel.cs
+++ b/src/ProtonVPN.App/Settings/SettingsModalViewModel.cs
@@ -439,6 +439,12 @@ public bool ConnectOnAppStart
set => _appSettings.ConnectOnAppStart = value;
}
+ public bool ConnectOnInsecureWifi
+ {
+ get => _appSettings.ConnectOnInsecureWifi;
+ set => _appSettings.ConnectOnInsecureWifi = value;
+ }
+
public bool ShowNotifications
{
get => _appSettings.ShowNotifications;
diff --git a/src/ProtonVPN.Core/ProtonVPN.Core.csproj b/src/ProtonVPN.Core/ProtonVPN.Core.csproj
index 7e532cf41..6e03d26d9 100644
--- a/src/ProtonVPN.Core/ProtonVPN.Core.csproj
+++ b/src/ProtonVPN.Core/ProtonVPN.Core.csproj
@@ -32,6 +32,7 @@
13.0.3
+
diff --git a/src/ProtonVPN.Core/Settings/IAppSettings.cs b/src/ProtonVPN.Core/Settings/IAppSettings.cs
index 8c3e9ee7d..1cc1e6ba7 100644
--- a/src/ProtonVPN.Core/Settings/IAppSettings.cs
+++ b/src/ProtonVPN.Core/Settings/IAppSettings.cs
@@ -106,6 +106,7 @@ public interface IAppSettings
bool FeaturePromoCodeEnabled { get; set; }
bool FeatureFreeRescopeEnabled { get; set; }
bool ConnectOnAppStart { get; set; }
+ bool ConnectOnInsecureWifi { get; set; }
bool FeatureSmartReconnectEnabled { get; set; }
bool ShowNonStandardPortsToFreeUsers { get; set; }
bool SmartReconnectEnabled { get; set; }
diff --git a/src/ProtonVPN.Resources/Automation/Config.xaml b/src/ProtonVPN.Resources/Automation/Config.xaml
index 7f12b5119..0eae8721c 100644
--- a/src/ProtonVPN.Resources/Automation/Config.xaml
+++ b/src/ProtonVPN.Resources/Automation/Config.xaml
@@ -97,6 +97,7 @@ along with ProtonVPN. If not, see .
PortForwardingOnButton
PortForwardingOffButton
ConnectOnBootCheckbox
+ ConnectOnInsecureWifi
CancelActionButton
QuickLaunchFlag
UpsellModalTitle
diff --git a/src/ProtonVPN.Translations/Properties/Resources.Designer.cs b/src/ProtonVPN.Translations/Properties/Resources.Designer.cs
index 9117df9cd..68abdc413 100644
--- a/src/ProtonVPN.Translations/Properties/Resources.Designer.cs
+++ b/src/ProtonVPN.Translations/Properties/Resources.Designer.cs
@@ -6241,7 +6241,7 @@ public static string Settings_General_lbl_ConnectOnAppStart {
}
///
- /// Looks up a localized string similar to Automatically connect to the Quick Connect profile when Proton VPN starts..
+ /// Looks up a localized string similar to Automatically connect to the Quick Connect profile when Proton VPN starts.
///
public static string Settings_General_lbl_ConnectOnAppStart_Info {
get {
@@ -6249,6 +6249,24 @@ public static string Settings_General_lbl_ConnectOnAppStart_Info {
}
}
+ ///
+ /// Looks up a localized string similar to Connect on insecure wifi.
+ ///
+ public static string Settings_General_lbl_ConnectOnInsecureWifi {
+ get {
+ return ResourceManager.GetString("Settings_General_lbl_ConnectOnInsecureWifi", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Automatically connect to the Quick Connect profile when connecting to inseucre wifi.
+ ///
+ public static string Settings_General_lbl_ConnectOnInsecureWifi_Info {
+ get {
+ return ResourceManager.GetString("Settings_General_lbl_ConnectOnInsecureWifi_Info", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Early Access.
///
diff --git a/src/ProtonVPN.Translations/Properties/Resources.en-US.resx b/src/ProtonVPN.Translations/Properties/Resources.en-US.resx
index 9ae4b53ad..052e4f698 100644
--- a/src/ProtonVPN.Translations/Properties/Resources.en-US.resx
+++ b/src/ProtonVPN.Translations/Properties/Resources.en-US.resx
@@ -277,6 +277,10 @@
Automatically connect to the Quick Connect profile when Proton VPN starts.
The description of Connect on boot setting displayed in the tooltip of ( i ) image next to the label for Connect on boot combo box in General tab of Settings window
+
+ Automatically connect to the Quick Connect profile when connecting to an insecure wifi.
+ The description of Connect on insecure wifi setting displayed in the tooltip of ( i ) image next to the label for Connect on insecure wifi combo box in General tab of Settings window
+
Disabled
The name of start minimized mode displayed in Start Minimized combo box in General tab of Settings window
@@ -709,6 +713,10 @@ This setting instructs the Proton VPN to start automatically when the user logs
Connect on app start
The label for Connect on boot combo box in General tab of Settings window
+
+ Connect when connected to an insecure wifi
+ The label for Connect on insecure wifi combo box in General tab of Settings window
+
Changelog of v.{0}
The title of app version in change log in About window. The {0} is a placeholder for app version number.
diff --git a/src/Tests/ProtonVPN.UI.Tests/Windows/SettingsWindow.cs b/src/Tests/ProtonVPN.UI.Tests/Windows/SettingsWindow.cs
index 6ea8b9792..579118929 100644
--- a/src/Tests/ProtonVPN.UI.Tests/Windows/SettingsWindow.cs
+++ b/src/Tests/ProtonVPN.UI.Tests/Windows/SettingsWindow.cs
@@ -29,6 +29,7 @@ public class SettingsWindow : UIActions
private ListBoxItem OptionDisabled => StartMinimizedComboBox.FindFirstChild().AsListBoxItem();
private Button SettingsCloseButton => ElementByAutomationId("ModalCloseButton").AsButton();
private CheckBox ConnectOnBootCheckBox => ElementByAutomationId("ConnectOnBootCheckbox").AsCheckBox();
+ private CheckBox ConnectOnInsecureWifiCheckBox => ElementByAutomationId("ConnectOnInsecureWifiCheckbox").AsCheckBox();
private AutomationElement ConnectionTab => ElementByName("Connection").FindFirstChild();
private AutomationElement AdvancedTab => ElementByName("Advanced").FindFirstChild();
private CheckBox CustomDnsCheckBox => ElementByAutomationId("CheckBoxCustomDnsServers").AsCheckBox();
@@ -55,6 +56,12 @@ public SettingsWindow ClickOnConnectOnBoot()
return this;
}
+ public SettingsWindow ClickOnConnectOnInsecureWifi()
+ {
+ ConnectOnInsecureWifiCheckBox.Click();
+ return this;
+ }
+
public HomeWindow CloseSettings()
{
SettingsCloseButton.Invoke();
From 69527695a7355792c36803e845f64d9d61531a89 Mon Sep 17 00:00:00 2001
From: Jamie <5356206+Stoom@users.noreply.github.com>
Date: Sun, 11 Aug 2024 09:50:12 -0500
Subject: [PATCH 2/2] feat: disconnect once on a secure network again
---
src/ProtonVPN.App/App.config | 3 ++
src/ProtonVPN.App/Core/AppSettings.cs | 6 +++
src/ProtonVPN.App/Core/AutoConnect.cs | 52 ++++++++++++++-----
.../Properties/Settings.Designer.cs | 12 +++++
.../Properties/Settings.settings | 3 ++
.../v1_27_1/AppSettingsMigration.cs | 7 +++
.../Settings/SettingsModalView.xaml | 20 ++++++-
.../Settings/SettingsModalViewModel.cs | 6 +++
src/ProtonVPN.Core/Settings/IAppSettings.cs | 1 +
.../Automation/Config.xaml | 1 +
.../Properties/Resources.Designer.cs | 18 +++++++
.../Properties/Resources.en-US.resx | 8 +++
.../Windows/SettingsWindow.cs | 7 +++
13 files changed, 131 insertions(+), 13 deletions(-)
diff --git a/src/ProtonVPN.App/App.config b/src/ProtonVPN.App/App.config
index 6b4df2f54..5e9c93504 100644
--- a/src/ProtonVPN.App/App.config
+++ b/src/ProtonVPN.App/App.config
@@ -373,6 +373,9 @@
True
+
+ True
+
True
diff --git a/src/ProtonVPN.App/Core/AppSettings.cs b/src/ProtonVPN.App/Core/AppSettings.cs
index c1f05d25b..59e75b92f 100644
--- a/src/ProtonVPN.App/Core/AppSettings.cs
+++ b/src/ProtonVPN.App/Core/AppSettings.cs
@@ -504,6 +504,12 @@ public bool ConnectOnInsecureWifi
set => Set(value);
}
+ public bool SecureDisconnect
+ {
+ get => Get();
+ set => Set(value);
+ }
+
[Obsolete(
"Use this only for checking if the user enabled/disabled the feature." +
"Use IsSmartReconnectEnabled() for checking if Smart Reconnect is/should be enabled.")]
diff --git a/src/ProtonVPN.App/Core/AutoConnect.cs b/src/ProtonVPN.App/Core/AutoConnect.cs
index 1866e3097..4a44812bd 100644
--- a/src/ProtonVPN.App/Core/AutoConnect.cs
+++ b/src/ProtonVPN.App/Core/AutoConnect.cs
@@ -37,6 +37,7 @@ internal class AutoConnect : IVpnStateAware
private readonly IVpnManager _vpnManager;
private readonly ILogger _logger;
private VpnStatus _vpnStatus;
+ private bool _connectedToInsecureWifi;
public AutoConnect(
IAppSettings appSettings,
@@ -82,25 +83,52 @@ public Task OnVpnStateChanged(VpnStateChangedEventArgs e)
return Task.CompletedTask;
}
- private void OnWifiChangeDetected(object sender, WifiChangeEventArgs e)
+ private bool InsecureWifiAutoConnectionRequired(bool isSecure)
{
- if (e.Secure || !_appSettings.ConnectOnInsecureWifi)
- {
- return;
- }
+ return !isSecure && _vpnStatus.Equals(VpnStatus.Disconnected) && _appSettings.ConnectOnInsecureWifi;
+ }
+ private bool InsecureWifiSecureDisconnectRequired(bool isSecure)
+ {
+ return isSecure && _vpnStatus.Equals(VpnStatus.Connected) && _connectedToInsecureWifi && _appSettings.SecureDisconnect;
+ }
- Task.Factory.StartNew(async () =>
+ private void OnWifiChangeDetected(object sender, WifiChangeEventArgs e)
+ {
+ if (_appSettings.ConnectOnInsecureWifi)
{
- try
+ if (InsecureWifiSecureDisconnectRequired(e.Secure))
{
- _logger.Info("Automatically connecting on insecure wifi");
- await _vpnManager.QuickConnectAsync();
+ Task.Factory.StartNew(async () =>
+ {
+ try
+ {
+ _logger.Info("Automatically disconnecting on secure wifi");
+ await _vpnManager.DisconnectAsync();
+ }
+ catch (OperationCanceledException ex)
+ {
+ _logger.Error("An error occurred when disconnecting automatically on secure wifi.", ex);
+ }
+ });
}
- catch (OperationCanceledException ex)
+ else if (InsecureWifiAutoConnectionRequired(e.Secure))
{
- _logger.Error("An error occurred when connecting automatically on insecure wifi.", ex);
+ Task.Factory.StartNew(async () =>
+ {
+ try
+ {
+ _logger.Info("Automatically connecting on insecure wifi");
+ await _vpnManager.QuickConnectAsync();
+ }
+ catch (OperationCanceledException ex)
+ {
+ _logger.Error("An error occurred when connecting automatically on insecure wifi.", ex);
+ }
+ });
}
- });
+ }
+
+ _connectedToInsecureWifi = !e.Secure;
}
}
}
\ No newline at end of file
diff --git a/src/ProtonVPN.App/Properties/Settings.Designer.cs b/src/ProtonVPN.App/Properties/Settings.Designer.cs
index 326397c13..05e0f2152 100644
--- a/src/ProtonVPN.App/Properties/Settings.Designer.cs
+++ b/src/ProtonVPN.App/Properties/Settings.Designer.cs
@@ -1470,6 +1470,18 @@ public bool ConnectOnInsecureWifi {
}
}
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("True")]
+ public bool SecureDisconnect {
+ get {
+ return ((bool)(this["SecureDisconnect"]));
+ }
+ set {
+ this["SecureDisconnect"] = value;
+ }
+ }
+
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
diff --git a/src/ProtonVPN.App/Properties/Settings.settings b/src/ProtonVPN.App/Properties/Settings.settings
index bf2cbe1b3..d4532e1bb 100644
--- a/src/ProtonVPN.App/Properties/Settings.settings
+++ b/src/ProtonVPN.App/Properties/Settings.settings
@@ -365,6 +365,9 @@
True
+
+ True
+
True
diff --git a/src/ProtonVPN.App/Settings/Migrations/v1_27_1/AppSettingsMigration.cs b/src/ProtonVPN.App/Settings/Migrations/v1_27_1/AppSettingsMigration.cs
index 47959d22a..78c15790d 100644
--- a/src/ProtonVPN.App/Settings/Migrations/v1_27_1/AppSettingsMigration.cs
+++ b/src/ProtonVPN.App/Settings/Migrations/v1_27_1/AppSettingsMigration.cs
@@ -29,6 +29,7 @@ internal class AppSettingsMigration : BaseAppSettingsMigration
{
private const string UserAutoConnectKey = "UserAutoConnect";
private const string UserAutoConnectOnInsecureWifiKey = "ConnectOnInsecureWifi";
+ private const string UserSecureDisconnectKey = "SecureDisconnect";
private const string StartOnStartupKey = "StartOnStartup";
private readonly InitialAppSettingsMigration _initialAppSettingsMigration;
@@ -60,6 +61,12 @@ private void MigrateAutoConnect()
bool autoConnect = autoConnectOnInsecureSettings.Any(setting => !setting.Value.IsNullOrEmpty());
Settings.Set(nameof(IAppSettings.ConnectOnInsecureWifi), _initialAppSettingsMigration.IsCleanInstall || autoConnect);
}
+ PerUser[] secureDisconnectSettings = Settings.Get[]>(UserSecureDisconnectKey);
+ if (secureDisconnectSettings != null)
+ {
+ bool secureDisconnect = secureDisconnectSettings.Any(setting => !setting.Value.IsNullOrEmpty());
+ Settings.Set(nameof(IAppSettings.SecureDisconnect), _initialAppSettingsMigration.IsCleanInstall || secureDisconnect);
+ }
}
private void MigrateStartOnStartup()
diff --git a/src/ProtonVPN.App/Settings/SettingsModalView.xaml b/src/ProtonVPN.App/Settings/SettingsModalView.xaml
index 34efb104a..1aea47632 100644
--- a/src/ProtonVPN.App/Settings/SettingsModalView.xaml
+++ b/src/ProtonVPN.App/Settings/SettingsModalView.xaml
@@ -210,7 +210,7 @@ along with ProtonVPN. If not, see .
-
+
.
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/ProtonVPN.App/Settings/SettingsModalViewModel.cs b/src/ProtonVPN.App/Settings/SettingsModalViewModel.cs
index d6c279f04..e191505ba 100644
--- a/src/ProtonVPN.App/Settings/SettingsModalViewModel.cs
+++ b/src/ProtonVPN.App/Settings/SettingsModalViewModel.cs
@@ -445,6 +445,12 @@ public bool ConnectOnInsecureWifi
set => _appSettings.ConnectOnInsecureWifi = value;
}
+ public bool SecureDisconnect
+ {
+ get => _appSettings.SecureDisconnect;
+ set => _appSettings.SecureDisconnect = value;
+ }
+
public bool ShowNotifications
{
get => _appSettings.ShowNotifications;
diff --git a/src/ProtonVPN.Core/Settings/IAppSettings.cs b/src/ProtonVPN.Core/Settings/IAppSettings.cs
index 1cc1e6ba7..c366c14eb 100644
--- a/src/ProtonVPN.Core/Settings/IAppSettings.cs
+++ b/src/ProtonVPN.Core/Settings/IAppSettings.cs
@@ -107,6 +107,7 @@ public interface IAppSettings
bool FeatureFreeRescopeEnabled { get; set; }
bool ConnectOnAppStart { get; set; }
bool ConnectOnInsecureWifi { get; set; }
+ bool SecureDisconnect { get; set; }
bool FeatureSmartReconnectEnabled { get; set; }
bool ShowNonStandardPortsToFreeUsers { get; set; }
bool SmartReconnectEnabled { get; set; }
diff --git a/src/ProtonVPN.Resources/Automation/Config.xaml b/src/ProtonVPN.Resources/Automation/Config.xaml
index 0eae8721c..98e5e98d7 100644
--- a/src/ProtonVPN.Resources/Automation/Config.xaml
+++ b/src/ProtonVPN.Resources/Automation/Config.xaml
@@ -98,6 +98,7 @@ along with ProtonVPN. If not, see .
PortForwardingOffButton
ConnectOnBootCheckbox
ConnectOnInsecureWifi
+ SecureDisconnect
CancelActionButton
QuickLaunchFlag
UpsellModalTitle
diff --git a/src/ProtonVPN.Translations/Properties/Resources.Designer.cs b/src/ProtonVPN.Translations/Properties/Resources.Designer.cs
index 68abdc413..b37884876 100644
--- a/src/ProtonVPN.Translations/Properties/Resources.Designer.cs
+++ b/src/ProtonVPN.Translations/Properties/Resources.Designer.cs
@@ -6267,6 +6267,24 @@ public static string Settings_General_lbl_ConnectOnInsecureWifi_Info {
}
}
+ ///
+ /// Looks up a localized string similar to Disconnect on secured wifi.
+ ///
+ public static string Settings_General_lbl_SecureDisconnect {
+ get {
+ return ResourceManager.GetString("Settings_General_lbl_SecureDisconnect", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Disconnect when connecting to secure wifi.
+ ///
+ public static string Settings_General_lbl_SecureDisconnect_Info {
+ get {
+ return ResourceManager.GetString("Settings_General_lbl_SecureDisconnect_Info", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Early Access.
///
diff --git a/src/ProtonVPN.Translations/Properties/Resources.en-US.resx b/src/ProtonVPN.Translations/Properties/Resources.en-US.resx
index 052e4f698..1e870d837 100644
--- a/src/ProtonVPN.Translations/Properties/Resources.en-US.resx
+++ b/src/ProtonVPN.Translations/Properties/Resources.en-US.resx
@@ -281,6 +281,10 @@
Automatically connect to the Quick Connect profile when connecting to an insecure wifi.
The description of Connect on insecure wifi setting displayed in the tooltip of ( i ) image next to the label for Connect on insecure wifi combo box in General tab of Settings window
+
+ Automatically disconnect once connected to a secure wifi.
+ The description of Connect on insecure wifi setting displayed in the tooltip of ( i ) image next to the label for Disconnect on secure wifi combo box in General tab of Settings window
+
Disabled
The name of start minimized mode displayed in Start Minimized combo box in General tab of Settings window
@@ -717,6 +721,10 @@ This setting instructs the Proton VPN to start automatically when the user logs
Connect when connected to an insecure wifi
The label for Connect on insecure wifi combo box in General tab of Settings window
+
+ Disconnect on secured wifi
+ The label for Disconnecting when connected to a secured wifi combo box in General tab of Settings window
+
Changelog of v.{0}
The title of app version in change log in About window. The {0} is a placeholder for app version number.
diff --git a/src/Tests/ProtonVPN.UI.Tests/Windows/SettingsWindow.cs b/src/Tests/ProtonVPN.UI.Tests/Windows/SettingsWindow.cs
index 579118929..252352f61 100644
--- a/src/Tests/ProtonVPN.UI.Tests/Windows/SettingsWindow.cs
+++ b/src/Tests/ProtonVPN.UI.Tests/Windows/SettingsWindow.cs
@@ -30,6 +30,7 @@ public class SettingsWindow : UIActions
private Button SettingsCloseButton => ElementByAutomationId("ModalCloseButton").AsButton();
private CheckBox ConnectOnBootCheckBox => ElementByAutomationId("ConnectOnBootCheckbox").AsCheckBox();
private CheckBox ConnectOnInsecureWifiCheckBox => ElementByAutomationId("ConnectOnInsecureWifiCheckbox").AsCheckBox();
+ private CheckBox SecureDisconnectCheckBox => ElementByAutomationId("SecureDisconnectCheckbox").AsCheckBox();
private AutomationElement ConnectionTab => ElementByName("Connection").FindFirstChild();
private AutomationElement AdvancedTab => ElementByName("Advanced").FindFirstChild();
private CheckBox CustomDnsCheckBox => ElementByAutomationId("CheckBoxCustomDnsServers").AsCheckBox();
@@ -62,6 +63,12 @@ public SettingsWindow ClickOnConnectOnInsecureWifi()
return this;
}
+ public SettingsWindow ClickOnSecureDisconnect()
+ {
+ SecureDisconnectCheckBox.Click();
+ return this;
+ }
+
public HomeWindow CloseSettings()
{
SettingsCloseButton.Invoke();