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:
Benjamin Erhart 2026-05-29 15:41:27 +02:00
parent 2e069897db
commit 0b2885461a
3 changed files with 43 additions and 10 deletions

View file

@ -31,11 +31,37 @@ struct HomeView: View {
Toggle("", isOn: $viewModel.isDnsEnabled)
.labelsHidden()
.disabled(true)
.tint(.green)
}
.padding(.vertical, 4)
}
if !viewModel.isDnsEnabled {
Section {
VStack(alignment: .leading, spacing: 4) {
Text(String(format: NSLocalizedString("To enable %@:", comment: ""), ViewModel.title))
Text(String(format: NSLocalizedString("%1$@ Tap \"%2$@\"", comment: ""), "", NSLocalizedString("Open Settings", comment: "")))
Text(String(format: NSLocalizedString("%1$@ Go to General", comment: ""), ""))
Text(String(format: NSLocalizedString("%1$@ VPN & Network", comment: ""), ""))
Text(String(format: NSLocalizedString("%1$@ DNS", comment: ""), ""))
Text(String(format: NSLocalizedString("%1$@ Select \"%2$@\"", comment: ""), "", viewModel.blocklist.title))
Spacer()
Button {
if let url = URL(string: UIApplication.openSettingsURLString) {
UIApplication.shared.open(url)
}
} label: {
Text(NSLocalizedString("Open Settings", comment: ""))
.frame(maxWidth: .infinity, minHeight: 32)
}
.buttonStyle(.borderedProminent)
}
}
}
// Blocklist selection
Section {
ForEach(BlocklistOption.allCases) { option in
@ -176,7 +202,7 @@ struct HomeView: View {
}.foregroundStyle(.primary)
}
}
.navigationTitle("SR2® Cloud DNS")
.navigationTitle(ViewModel.title)
.animation(.default, value: viewModel.isDnsEnabled)
}
}