Fix the issue that Do*Sections has wrong servers

This commit is contained in:
Kenta Kubo 2023-03-06 00:20:16 +09:00
parent 4928a71787
commit 06feaa029a
2 changed files with 16 additions and 0 deletions

View file

@ -97,6 +97,14 @@ extension DoHSections: View {
self.commit()
}
}
.onChange(of: self.server) { server in
switch server.configuration {
case .dnsOverTLS:
preconditionFailure("unreachable")
case .dnsOverHTTPS(let configuration):
self.configuration = configuration
}
}
.onDisappear {
self.commit()
}

View file

@ -94,6 +94,14 @@ extension DoTSections: View {
self.commit()
}
}
.onChange(of: self.server) { server in
switch server.configuration {
case .dnsOverTLS(let configuration):
self.configuration = configuration
case .dnsOverHTTPS:
preconditionFailure("unreachable")
}
}
.onDisappear {
self.commit()
}