diff options
Diffstat (limited to 'ui/src/main/java/com/wireguard/android')
-rw-r--r-- | ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt | 15 |
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() { |