Issue #6: Show UI to explain user's next steps to enable. Disable toggle as this cannot be used to activate DNS settings.
This commit is contained in:
parent
2e069897db
commit
0b2885461a
3 changed files with 43 additions and 10 deletions
|
|
@ -12,6 +12,8 @@ import OSLog
|
|||
|
||||
class ViewModel: NSObject, ObservableObject {
|
||||
|
||||
static let title = "SR2® Cloud DNS"
|
||||
|
||||
// MARK: Public Properties
|
||||
|
||||
@Published
|
||||
|
|
@ -29,11 +31,7 @@ class ViewModel: NSObject, ObservableObject {
|
|||
}
|
||||
|
||||
@Published
|
||||
var isDnsEnabled = false {
|
||||
didSet {
|
||||
toggleDns()
|
||||
}
|
||||
}
|
||||
var isDnsEnabled = false
|
||||
|
||||
@Published
|
||||
var summaryStatus: SummaryStatus = .pending
|
||||
|
|
@ -51,6 +49,8 @@ class ViewModel: NSObject, ObservableObject {
|
|||
override init() {
|
||||
super.init()
|
||||
|
||||
isDnsEnabled = manager.isEnabled
|
||||
|
||||
isProgrammaticChange = true
|
||||
blocklist = Settings.blocklist
|
||||
|
||||
|
|
@ -60,11 +60,9 @@ class ViewModel: NSObject, ObservableObject {
|
|||
}
|
||||
catch {
|
||||
log.error("Error loading preferences: \(error)")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if manager.isEnabled, let settings = manager.dnsSettings {
|
||||
if let settings = manager.dnsSettings {
|
||||
for dnsServer in BlocklistOption.allCases {
|
||||
if settings.servers.contains(dnsServer.ipv4) {
|
||||
await MainActor.run {
|
||||
|
|
@ -99,7 +97,7 @@ class ViewModel: NSObject, ObservableObject {
|
|||
Task {
|
||||
if isDnsEnabled {
|
||||
manager.dnsSettings = blocklist.settings
|
||||
manager.localizedDescription = blocklist.description
|
||||
manager.localizedDescription = blocklist.title
|
||||
|
||||
do {
|
||||
try await manager.saveToPreferences()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue