summaryrefslogtreecommitdiffhomepage
path: root/ui/src/main
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2023-10-28 23:14:12 +0200
committerMikael Magnusson <mikma@users.sourceforge.net>2024-01-08 00:15:09 +0100
commit8ab1a26560868f947adf9a2774d3712ae45c9ac0 (patch)
treed42889a1bd52b292ed7e6f201933bef78d718fbe /ui/src/main
parentf95f7d93d98a385a0d2ebf91de5a558c3671da05 (diff)
WIP: add persistent keepalive to observable tunnel
WIP: add default persistent keepalive to bgp code WIP: tunnel: fix onPersistentKeepaliveChange WIP: ui: fix onPersistentKeepaliveChange WIP: ui: fix onPersistentKeepaliveChanged WIP: fix peer detail persistent keepalive WIP: ui: notify persistentKeepalive
Diffstat (limited to 'ui/src/main')
-rw-r--r--ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt12
-rw-r--r--ui/src/main/java/com/wireguard/android/viewmodel/PeerDetail.kt4
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