summaryrefslogtreecommitdiffhomepage
path: root/android
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2019-03-25 15:48:33 +0000
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2019-05-22 21:18:39 +0000
commitf51e43aaa4bc5fe7ee6d77d206acb22c5176818d (patch)
tree1975843025e1baa003a824ec56fc98ca2dcc6d61 /android
parentae60742f00911df185fe12b2e4de08dff4c954b4 (diff)
downloadmullvadvpn-f51e43aaa4bc5fe7ee6d77d206acb22c5176818d.tar.xz
mullvadvpn-f51e43aaa4bc5fe7ee6d77d206acb22c5176818d.zip
Create view-model representation of relay list
Constructed from the model relay list.
Diffstat (limited to 'android')
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayList.kt17
1 files changed, 17 insertions, 0 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayList.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayList.kt
new file mode 100644
index 0000000000..45374f6f84
--- /dev/null
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayList.kt
@@ -0,0 +1,17 @@
+package net.mullvad.mullvadvpn.relaylist
+
+class RelayList {
+ val countries: List<RelayCountry>
+
+ constructor(model: net.mullvad.mullvadvpn.model.RelayList) {
+ countries = model.countries.map { country ->
+ val cities = country.cities.map { city ->
+ val relays = city.relays.map { relay -> Relay(relay.hostname) }
+
+ RelayCity(city.name, "${country.code}-${city.code}", false, relays)
+ }
+
+ RelayCountry(country.name, country.code, false, cities)
+ }
+ }
+}