diff options
Diffstat (limited to 'ui/src/main/java/com/wireguard/android/viewmodel/ConfigProxy.kt')
-rw-r--r-- | ui/src/main/java/com/wireguard/android/viewmodel/ConfigProxy.kt | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/ui/src/main/java/com/wireguard/android/viewmodel/ConfigProxy.kt b/ui/src/main/java/com/wireguard/android/viewmodel/ConfigProxy.kt index e29de2dd..7d25c086 100644 --- a/ui/src/main/java/com/wireguard/android/viewmodel/ConfigProxy.kt +++ b/ui/src/main/java/com/wireguard/android/viewmodel/ConfigProxy.kt @@ -16,15 +16,18 @@ import java.util.ArrayList class ConfigProxy : Parcelable { val `interface`: InterfaceProxy val peers: ObservableList<PeerProxy> = ObservableArrayList() + val httpProxyItems: List<String> - private constructor(parcel: Parcel) { + private constructor(httpProxyItems: List<String>, parcel: Parcel) { + this.httpProxyItems = httpProxyItems `interface` = InterfaceProxy.CREATOR.createFromParcel(parcel) parcel.readTypedList(peers, PeerProxy.CREATOR) peers.forEach { it.bind(this) } } - constructor(other: Config) { - `interface` = InterfaceProxy(other.getInterface()) + constructor(httpProxyItems: List<String>, other: Config) { + this.httpProxyItems = httpProxyItems + `interface` = InterfaceProxy(httpProxyItems, other.getInterface()) other.peers.forEach { val proxy = PeerProxy(it) peers.add(proxy) @@ -32,8 +35,9 @@ class ConfigProxy : Parcelable { } } - constructor() { - `interface` = InterfaceProxy() + constructor(httpProxyItems: List<String>) { + this.httpProxyItems = httpProxyItems + `interface` = InterfaceProxy(httpProxyItems) } fun addPeer(): PeerProxy { @@ -60,9 +64,9 @@ class ConfigProxy : Parcelable { dest.writeTypedList(peers) } - private class ConfigProxyCreator : Parcelable.Creator<ConfigProxy> { + private class ConfigProxyCreator() : Parcelable.Creator<ConfigProxy> { override fun createFromParcel(parcel: Parcel): ConfigProxy { - return ConfigProxy(parcel) + return ConfigProxy(httpProxyItems, parcel) } override fun newArray(size: Int): Array<ConfigProxy?> { @@ -70,8 +74,8 @@ class ConfigProxy : Parcelable { } } - companion object { +// companion object { @JvmField val CREATOR: Parcelable.Creator<ConfigProxy> = ConfigProxyCreator() - } +// } } |