mirror of
https://github.com/passepartoutvpn/passepartout-apple.git
synced 2025-01-17 22:19:08 +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) {
|
||||
TransientStore.shared.masksPrivateData = cell.isOn
|
||||
AppConstants.VPN.baseConfiguration.masksPrivateData = cell.isOn
|
||||
service.baseConfiguration = AppConstants.VPN.baseConfiguration.build()
|
||||
|
||||
@ -738,7 +739,7 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
|
||||
case .masksPrivateData:
|
||||
let cell = Cells.toggle.dequeue(from: tableView, for: indexPath, tag: row.rawValue, delegate: self)
|
||||
cell.caption = L10n.Service.Cells.MasksPrivateData.caption
|
||||
cell.isOn = AppConstants.VPN.baseConfiguration.masksPrivateData ?? true
|
||||
cell.isOn = TransientStore.shared.masksPrivateData
|
||||
return cell
|
||||
|
||||
// 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 = "$DHH:mm:ss$d $N.$F:$l - $M"
|
||||
builder.debugLogFormat = Log.debugFormat
|
||||
builder.masksPrivateData = true
|
||||
builder.masksPrivateData = TransientStore.shared.masksPrivateData
|
||||
return builder
|
||||
}()
|
||||
|
||||
|
@ -31,6 +31,8 @@ private let log = SwiftyBeaver.self
|
||||
public class TransientStore {
|
||||
private struct Keys {
|
||||
static let didHandleSubreddit = "DidHandleSubreddit"
|
||||
|
||||
static let masksPrivateData = "MasksPrivateData"
|
||||
}
|
||||
|
||||
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() {
|
||||
UserDefaults.standard.register(defaults: [
|
||||
Keys.didHandleSubreddit: false,
|
||||
Keys.masksPrivateData: true
|
||||
])
|
||||
|
||||
TransientStore.migrateDocumentsToAppGroup()
|
||||
|
||||
// this must be graceful
|
||||
|
Loading…
Reference in New Issue
Block a user