mirror of
https://github.com/passepartoutvpn/passepartout-apple.git
synced 2025-01-29 12:02:11 +00:00
Disconnect on masking change
To ensure that the stale log is erased immediately.
This commit is contained in:
parent
fdc3869d29
commit
c45e741750
@ -401,16 +401,31 @@ class ServiceViewController: UIViewController, TableModelHost {
|
||||
}
|
||||
|
||||
private func togglePrivateDataMasking(cell: ToggleTableViewCell) {
|
||||
TransientStore.masksPrivateData = cell.isOn
|
||||
service.baseConfiguration = TransientStore.baseVPNConfiguration.build()
|
||||
|
||||
// for privacy, delete potentially unmasked data
|
||||
if vpn.status != .disconnected {
|
||||
shouldDeleteLogOnDisconnection = true
|
||||
} else {
|
||||
service.eraseVpnLog()
|
||||
shouldDeleteLogOnDisconnection = false
|
||||
let handler = {
|
||||
TransientStore.masksPrivateData = cell.isOn
|
||||
self.service.baseConfiguration = TransientStore.baseVPNConfiguration.build()
|
||||
}
|
||||
|
||||
guard vpn.status == .disconnected else {
|
||||
let alert = Macros.alert(
|
||||
L10n.Service.Cells.MasksPrivateData.caption,
|
||||
L10n.Service.Alerts.MasksPrivateData.Messages.mustDisconnect
|
||||
)
|
||||
alert.addDestructiveAction(L10n.Service.Alerts.Buttons.disconnect) {
|
||||
handler()
|
||||
self.shouldDeleteLogOnDisconnection = true
|
||||
self.vpn.disconnect(completionHandler: nil)
|
||||
}
|
||||
alert.addCancelAction(L10n.Global.cancel) {
|
||||
cell.setOn(!cell.isOn, animated: true)
|
||||
}
|
||||
present(alert, animated: true, completion: nil)
|
||||
return
|
||||
}
|
||||
|
||||
handler()
|
||||
service.eraseVpnLog()
|
||||
shouldDeleteLogOnDisconnection = false
|
||||
}
|
||||
|
||||
private func postSupportRequest() {
|
||||
|
@ -121,6 +121,8 @@
|
||||
"service.alerts.test_connectivity.messages.failure" = "Your device has no Internet connectivity, please review your profile parameters.";
|
||||
"service.alerts.data_count.messages.current" = "Received: %llu\nSent: %llu";
|
||||
"service.alerts.data_count.messages.not_available" = "Information not available, are you connected?";
|
||||
"service.alerts.masks_private_data.messages.must_disconnect" = "In order to safely reset the current debug log and apply the new masking preference, you must disconnect from the VPN now.";
|
||||
"service.alerts.buttons.disconnect" = "Disconnect";
|
||||
|
||||
"account.cells.username.caption" = "Username";
|
||||
"account.cells.username.placeholder" = "username";
|
||||
|
@ -454,6 +454,10 @@ public enum L10n {
|
||||
|
||||
public enum Service {
|
||||
public enum Alerts {
|
||||
public enum Buttons {
|
||||
/// Disconnect
|
||||
public static let disconnect = L10n.tr("Localizable", "service.alerts.buttons.disconnect")
|
||||
}
|
||||
public enum CredentialsNeeded {
|
||||
/// You need to enter account credentials first.
|
||||
public static let message = L10n.tr("Localizable", "service.alerts.credentials_needed.message")
|
||||
@ -468,6 +472,12 @@ public enum L10n {
|
||||
public static let notAvailable = L10n.tr("Localizable", "service.alerts.data_count.messages.not_available")
|
||||
}
|
||||
}
|
||||
public enum MasksPrivateData {
|
||||
public enum Messages {
|
||||
/// In order to safely reset the current debug log and apply the new masking preference, you must disconnect from the VPN now.
|
||||
public static let mustDisconnect = L10n.tr("Localizable", "service.alerts.masks_private_data.messages.must_disconnect")
|
||||
}
|
||||
}
|
||||
public enum ReconnectVpn {
|
||||
/// Do you want to reconnect to the VPN?
|
||||
public static let message = L10n.tr("Localizable", "service.alerts.reconnect_vpn.message")
|
||||
|
Loading…
Reference in New Issue
Block a user