From 06feaa029afe16f6d87faf8ffeff88107c13a986 Mon Sep 17 00:00:00 2001 From: Kenta Kubo <601636+kkk669@users.noreply.github.com> Date: Mon, 6 Mar 2023 00:20:16 +0900 Subject: [PATCH] Fix the issue that Do*Sections has wrong servers --- DNSecure/Views/DoHSections.swift | 8 ++++++++ DNSecure/Views/DoTSections.swift | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/DNSecure/Views/DoHSections.swift b/DNSecure/Views/DoHSections.swift index 3de38bf..a47828f 100644 --- a/DNSecure/Views/DoHSections.swift +++ b/DNSecure/Views/DoHSections.swift @@ -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() } diff --git a/DNSecure/Views/DoTSections.swift b/DNSecure/Views/DoTSections.swift index 1817714..748e508 100644 --- a/DNSecure/Views/DoTSections.swift +++ b/DNSecure/Views/DoTSections.swift @@ -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() }