summaryrefslogtreecommitdiffhomepage
path: root/ui/src/main/java/com
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2023-03-03 00:39:07 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2023-06-01 21:08:03 +0200
commit828cba172ac744dee15289e7ff574b42ff752425 (patch)
tree178f527e8c91ee73c0beed3acc933bb75b29aee0 /ui/src/main/java/com
parent7e5360f1cc8460cc9cc2a1ae8607c781c6caacdb (diff)
WIP: add dynamic addresses to tunnel details
Diffstat (limited to 'ui/src/main/java/com')
-rw-r--r--ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt15
1 files changed, 15 insertions, 0 deletions
diff --git a/ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt b/ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt
index 03280b2f..55c84df5 100644
--- a/ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt
+++ b/ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt
@@ -9,6 +9,7 @@ import androidx.databinding.BaseObservable
import androidx.databinding.Bindable
import com.wireguard.android.Application
import com.wireguard.android.BR
+import com.wireguard.android.backend.Dhcp
import com.wireguard.android.backend.Statistics
import com.wireguard.android.backend.Tunnel
import com.wireguard.android.databinding.Keyed
@@ -64,6 +65,7 @@ class ObservableTunnel internal constructor(
fun onStateChanged(state: Tunnel.State): Tunnel.State {
if (state != Tunnel.State.UP) {
onStatisticsChanged(null)
+ onDhcpChanged(null)
Application.getCoroutineScope().launch {
onPeersReset()
}
@@ -159,6 +161,19 @@ class ObservableTunnel internal constructor(
return statistics
}
+ @get:Bindable
+ var dhcp: Dhcp? = null
+ private set
+
+ override fun onDhcpChange(newDhcp: Dhcp) {
+ onDhcpChanged(newDhcp)
+ }
+
+ fun onDhcpChanged(dhcp: Dhcp?): Dhcp? {
+ this.dhcp = dhcp
+ notifyPropertyChanged(BR.dhcp)
+ return dhcp
+ }
// Remove dynamic peers, and reset static peers
fun onPeersReset() {