Issue #3: Added Settings class to store selected BlocklistOption. Update system DoH settings, when user selects another blocklist.
This commit is contained in:
parent
807176f0b5
commit
6cbad66a87
2 changed files with 39 additions and 10 deletions
24
dns/Settings.swift
Normal file
24
dns/Settings.swift
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
//
|
||||
// Settings.swift
|
||||
// dns
|
||||
//
|
||||
// Created by Benjamin Erhart on 15.04.26.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
class Settings {
|
||||
|
||||
private static let blocklistKey = "blocklist"
|
||||
|
||||
private static let defaults = UserDefaults.standard
|
||||
|
||||
class var blocklist: BlocklistOption {
|
||||
get {
|
||||
BlocklistOption(rawValue: defaults.string(forKey: blocklistKey) ?? BlocklistOption.secure.rawValue) ?? .secure
|
||||
}
|
||||
set {
|
||||
defaults.set(newValue.rawValue, forKey: blocklistKey)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue