Issue #3: First implementation of a DoH configuration setting.

This commit is contained in:
Benjamin Erhart 2026-04-14 18:57:37 +02:00
parent c25505dc5f
commit 822202e37d
2 changed files with 84 additions and 6 deletions

View file

@ -39,7 +39,6 @@ struct HomeView: View {
@EnvironmentObject
private var viewModel: ViewModel
@State private var isEnabled = false
@State private var serviceStatus: ServiceStatus = .operational
private let falsePositiveURL = URL(string: "https://www.sr2.uk/contact")!
@ -58,14 +57,14 @@ struct HomeView: View {
VStack(alignment: .leading, spacing: 4) {
Text("DNS Protection")
.font(.headline)
Text(isEnabled ? "Active" : "Inactive")
Text(viewModel.isDnsEnabled ? "Active" : "Inactive")
.font(.caption)
.foregroundStyle(isEnabled ? .green : .secondary)
.foregroundStyle(viewModel.isDnsEnabled ? .green : .secondary)
}
Spacer()
Toggle("", isOn: $isEnabled)
Toggle("", isOn: $viewModel.isDnsEnabled)
.labelsHidden()
.tint(.green)
}
@ -95,7 +94,7 @@ struct HomeView: View {
}
// Status section
if isEnabled {
if viewModel.isDnsEnabled {
Section {
HStack {
Label("Status", systemImage: "checkmark.circle.fill")
@ -213,7 +212,7 @@ struct HomeView: View {
}
}
.navigationTitle("SR2® Cloud DNS")
.animation(.default, value: isEnabled)
.animation(.default, value: viewModel.isDnsEnabled)
}
}
}