diff options
Diffstat (limited to 'ui/src/main')
-rw-r--r-- | ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt | 12 | ||||
-rw-r--r-- | ui/src/main/java/com/wireguard/android/viewmodel/PeerDetail.kt | 4 |
2 files changed, 16 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 97aae280..03529454 100644 --- a/ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt +++ b/ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt @@ -228,6 +228,18 @@ class ObservableTunnel internal constructor( return peer } + override fun onPersistentKeepaliveChange(publicKey: Key, newPersistentKeepalive: Int?) { + Application.getCoroutineScope().launch { + onPersistentKeepaliveChanged(publicKey, newPersistentKeepalive) + } + } + + private fun onPersistentKeepaliveChanged(publicKey: Key, newPersistentKeepalive: Int?) { + var peer: PeerDetail = lookupPeer(publicKey) + + peer.persistentKeepalive = Optional.ofNullable(newPersistentKeepalive) + } + override fun onAllowedIpsChange(publicKey: Key, addNetworks: List<InetNetwork>?, removeNetworks: List<InetNetwork>?) { Application.getCoroutineScope().launch { onAllowedIpsChanged(publicKey, addNetworks, removeNetworks) diff --git a/ui/src/main/java/com/wireguard/android/viewmodel/PeerDetail.kt b/ui/src/main/java/com/wireguard/android/viewmodel/PeerDetail.kt index 80b32fd5..3b6f42be 100644 --- a/ui/src/main/java/com/wireguard/android/viewmodel/PeerDetail.kt +++ b/ui/src/main/java/com/wireguard/android/viewmodel/PeerDetail.kt @@ -46,6 +46,10 @@ class PeerDetail : BaseObservable { @get:Bindable var persistentKeepalive: Optional<Int> = Optional.empty() + set(value) { + field = value + notifyPropertyChanged(BR.persistentKeepalive) + } constructor(other: Peer) { peer = other |