summaryrefslogtreecommitdiffhomepage
path: root/ui/src/main/java
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-10-24 21:57:35 +0200
commit700424edf26bd41683aa92964752e5e385bf2790 (patch)
tree485dc74577cdc77683d1d88ea30355089caec7bf /ui/src/main/java
parentf0b4783e2c82bcbada1a315bc85278aa66052fd7 (diff)
WIP: add dynamic addresses to tunnel details
Diffstat (limited to 'ui/src/main/java')
-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() {