mirror of
https://github.com/passepartoutvpn/passepartout-apple.git
synced 2025-01-29 12:02:11 +00:00
Delete log on masking change
It may contain stale and either sensitive or irrelevant data.
This commit is contained in:
parent
96f5210c7c
commit
e4c1ea4def
@ -48,6 +48,8 @@ class ServiceViewController: UIViewController, TableModelHost {
|
||||
|
||||
private var lastInfrastructureUpdate: Date?
|
||||
|
||||
private var shouldDeleteLogOnDisconnection = false
|
||||
|
||||
// MARK: Table
|
||||
|
||||
var model: TableModel<SectionType, RowType> = TableModel()
|
||||
@ -401,6 +403,14 @@ class ServiceViewController: UIViewController, TableModelHost {
|
||||
private func togglePrivateDataMasking(cell: ToggleTableViewCell) {
|
||||
AppConstants.VPN.baseConfiguration.masksPrivateData = cell.isOn
|
||||
service.baseConfiguration = AppConstants.VPN.baseConfiguration.build()
|
||||
|
||||
// for privacy, delete potentially unmasked data
|
||||
if vpn.status != .disconnected {
|
||||
shouldDeleteLogOnDisconnection = true
|
||||
} else {
|
||||
service.eraseVpnLog()
|
||||
shouldDeleteLogOnDisconnection = false
|
||||
}
|
||||
}
|
||||
|
||||
private func postSupportRequest() {
|
||||
@ -417,8 +427,21 @@ class ServiceViewController: UIViewController, TableModelHost {
|
||||
@objc private func vpnDidUpdate() {
|
||||
reloadVpnStatus()
|
||||
|
||||
if vpn.status == .connected {
|
||||
guard let status = vpn.status else {
|
||||
return
|
||||
}
|
||||
switch status {
|
||||
case .connected:
|
||||
Reviewer.shared.reportEvent()
|
||||
|
||||
case .disconnected:
|
||||
if shouldDeleteLogOnDisconnection {
|
||||
service.eraseVpnLog()
|
||||
shouldDeleteLogOnDisconnection = false
|
||||
}
|
||||
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -510,7 +510,11 @@ public class ConnectionService: Codable {
|
||||
baseConfiguration.clearLastError(in: appGroup)
|
||||
}
|
||||
|
||||
// public func eraseVpnLog() {
|
||||
// defaults.removeObject(forKey: Keys.vpnLog)
|
||||
// }
|
||||
public func eraseVpnLog() {
|
||||
log.info("Erasing VPN log...")
|
||||
guard let url = baseConfiguration.urlForLog(in: appGroup) else {
|
||||
return
|
||||
}
|
||||
try? FileManager.default.removeItem(at: url)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user