mirror of
https://github.com/passepartoutvpn/passepartout-apple.git
synced 2025-01-29 20:12:12 +00:00
Persist masking flag
This commit is contained in:
parent
e4c1ea4def
commit
c391663d11
@ -401,6 +401,7 @@ class ServiceViewController: UIViewController, TableModelHost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func togglePrivateDataMasking(cell: ToggleTableViewCell) {
|
private func togglePrivateDataMasking(cell: ToggleTableViewCell) {
|
||||||
|
TransientStore.shared.masksPrivateData = cell.isOn
|
||||||
AppConstants.VPN.baseConfiguration.masksPrivateData = cell.isOn
|
AppConstants.VPN.baseConfiguration.masksPrivateData = cell.isOn
|
||||||
service.baseConfiguration = AppConstants.VPN.baseConfiguration.build()
|
service.baseConfiguration = AppConstants.VPN.baseConfiguration.build()
|
||||||
|
|
||||||
@ -738,7 +739,7 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
|
|||||||
case .masksPrivateData:
|
case .masksPrivateData:
|
||||||
let cell = Cells.toggle.dequeue(from: tableView, for: indexPath, tag: row.rawValue, delegate: self)
|
let cell = Cells.toggle.dequeue(from: tableView, for: indexPath, tag: row.rawValue, delegate: self)
|
||||||
cell.caption = L10n.Service.Cells.MasksPrivateData.caption
|
cell.caption = L10n.Service.Cells.MasksPrivateData.caption
|
||||||
cell.isOn = AppConstants.VPN.baseConfiguration.masksPrivateData ?? true
|
cell.isOn = TransientStore.shared.masksPrivateData
|
||||||
return cell
|
return cell
|
||||||
|
|
||||||
// feedback
|
// feedback
|
||||||
|
@ -55,7 +55,7 @@ public class AppConstants {
|
|||||||
// builder.debugLogFormat = "$Dyyyy-MM-dd HH:mm:ss.SSS$d $L $N.$F:$l - $M"
|
// builder.debugLogFormat = "$Dyyyy-MM-dd HH:mm:ss.SSS$d $L $N.$F:$l - $M"
|
||||||
// builder.debugLogFormat = "$DHH:mm:ss$d $N.$F:$l - $M"
|
// builder.debugLogFormat = "$DHH:mm:ss$d $N.$F:$l - $M"
|
||||||
builder.debugLogFormat = Log.debugFormat
|
builder.debugLogFormat = Log.debugFormat
|
||||||
builder.masksPrivateData = true
|
builder.masksPrivateData = TransientStore.shared.masksPrivateData
|
||||||
return builder
|
return builder
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -31,6 +31,8 @@ private let log = SwiftyBeaver.self
|
|||||||
public class TransientStore {
|
public class TransientStore {
|
||||||
private struct Keys {
|
private struct Keys {
|
||||||
static let didHandleSubreddit = "DidHandleSubreddit"
|
static let didHandleSubreddit = "DidHandleSubreddit"
|
||||||
|
|
||||||
|
static let masksPrivateData = "MasksPrivateData"
|
||||||
}
|
}
|
||||||
|
|
||||||
public static let shared = TransientStore()
|
public static let shared = TransientStore()
|
||||||
@ -50,7 +52,21 @@ public class TransientStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public var masksPrivateData: Bool {
|
||||||
|
get {
|
||||||
|
return UserDefaults.standard.bool(forKey: Keys.masksPrivateData)
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
UserDefaults.standard.set(newValue, forKey: Keys.masksPrivateData)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private init() {
|
private init() {
|
||||||
|
UserDefaults.standard.register(defaults: [
|
||||||
|
Keys.didHandleSubreddit: false,
|
||||||
|
Keys.masksPrivateData: true
|
||||||
|
])
|
||||||
|
|
||||||
TransientStore.migrateDocumentsToAppGroup()
|
TransientStore.migrateDocumentsToAppGroup()
|
||||||
|
|
||||||
// this must be graceful
|
// this must be graceful
|
||||||
|
Loading…
Reference in New Issue
Block a user