mirror of
https://github.com/kkebo/DNSecure.git
synced 2026-03-11 08:54:36 +00:00
Add the feature to delete or reorder DNS servers
This commit is contained in:
parent
2a6b4dd5dd
commit
9105f3b8f0
1 changed files with 22 additions and 2 deletions
|
|
@ -28,7 +28,9 @@ extension DetailView: View {
|
|||
switch self.server.configuration {
|
||||
case var .dnsOverTLS(configuration):
|
||||
Section(
|
||||
header: Text("Servers"),
|
||||
header: EditButton()
|
||||
.frame(maxWidth: .infinity, alignment: .trailing)
|
||||
.overlay(Text("Servers"), alignment: .leading),
|
||||
footer: Text("The DNS server IP addresses.")
|
||||
) {
|
||||
ForEach(0..<configuration.servers.count, id: \.self) { i in
|
||||
|
|
@ -47,6 +49,14 @@ extension DetailView: View {
|
|||
.autocapitalization(.none)
|
||||
.disableAutocorrection(true)
|
||||
}
|
||||
.onDelete {
|
||||
configuration.servers.remove(atOffsets: $0)
|
||||
self.server.configuration = .dnsOverTLS(configuration)
|
||||
}
|
||||
.onMove {
|
||||
configuration.servers.move(fromOffsets: $0, toOffset: $1)
|
||||
self.server.configuration = .dnsOverTLS(configuration)
|
||||
}
|
||||
Button("Add New Server") {
|
||||
configuration.servers.append("")
|
||||
self.server.configuration = .dnsOverTLS(configuration)
|
||||
|
|
@ -82,7 +92,9 @@ extension DetailView: View {
|
|||
}
|
||||
case var .dnsOverHTTPS(configuration):
|
||||
Section(
|
||||
header: Text("Servers"),
|
||||
header: EditButton()
|
||||
.frame(maxWidth: .infinity, alignment: .trailing)
|
||||
.overlay(Text("Servers"), alignment: .leading),
|
||||
footer: Text("The DNS server IP addresses.")
|
||||
) {
|
||||
ForEach(0..<configuration.servers.count, id: \.self) { i in
|
||||
|
|
@ -101,6 +113,14 @@ extension DetailView: View {
|
|||
.autocapitalization(.none)
|
||||
.disableAutocorrection(true)
|
||||
}
|
||||
.onDelete {
|
||||
configuration.servers.remove(atOffsets: $0)
|
||||
self.server.configuration = .dnsOverHTTPS(configuration)
|
||||
}
|
||||
.onMove {
|
||||
configuration.servers.move(fromOffsets: $0, toOffset: $1)
|
||||
self.server.configuration = .dnsOverHTTPS(configuration)
|
||||
}
|
||||
Button("Add New Server") {
|
||||
configuration.servers.append("")
|
||||
self.server.configuration = .dnsOverHTTPS(configuration)
|
||||
|
|
|
|||
Loading…
Reference in a new issue