From 3935a369b866c67705f3e27944be56b94ea2b245 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sat, 25 Sep 2021 22:22:09 -0600 Subject: ui,tunnel: support DNS search domains wg-quick has supported this for a while, but not the config layer, and not the Go backend, so wire this all up. Requested-by: Alexis Geoffrey Signed-off-by: Jason A. Donenfeld --- .../main/java/com/wireguard/android/databinding/BindingAdapters.kt | 6 ++++++ ui/src/main/java/com/wireguard/android/viewmodel/InterfaceProxy.kt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'ui/src/main/java/com/wireguard/android') diff --git a/ui/src/main/java/com/wireguard/android/databinding/BindingAdapters.kt b/ui/src/main/java/com/wireguard/android/databinding/BindingAdapters.kt index adc42e7b..e5ff4bc9 100644 --- a/ui/src/main/java/com/wireguard/android/databinding/BindingAdapters.kt +++ b/ui/src/main/java/com/wireguard/android/databinding/BindingAdapters.kt @@ -152,6 +152,12 @@ object BindingAdapters { view.text = if (addresses != null) Attribute.join(addresses.map { it?.hostAddress }) else "" } + @JvmStatic + @BindingAdapter("android:text") + fun setStringSetText(view: TextView, strings: Iterable?) { + view.text = if (strings != null) Attribute.join(strings) else "" + } + @JvmStatic fun tryParseInt(s: String?): Int { if (s == null) diff --git a/ui/src/main/java/com/wireguard/android/viewmodel/InterfaceProxy.kt b/ui/src/main/java/com/wireguard/android/viewmodel/InterfaceProxy.kt index bd2a9831..16af043c 100644 --- a/ui/src/main/java/com/wireguard/android/viewmodel/InterfaceProxy.kt +++ b/ui/src/main/java/com/wireguard/android/viewmodel/InterfaceProxy.kt @@ -81,7 +81,7 @@ class InterfaceProxy : BaseObservable, Parcelable { constructor(other: Interface) { addresses = Attribute.join(other.addresses) - val dnsServerStrings = other.dnsServers.map { it.hostAddress } + val dnsServerStrings = other.dnsServers.map { it.hostAddress }.plus(other.dnsSearchDomains) dnsServers = Attribute.join(dnsServerStrings) excludedApplications.addAll(other.excludedApplications) includedApplications.addAll(other.includedApplications) -- cgit v1.2.3