diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2019-06-14 09:44:19 -0300 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2019-06-14 09:44:19 -0300 |
| commit | 2de3cbdaacfde3940b40aff94ee4760bc6223840 (patch) | |
| tree | 62a726d300c03c0ac4d9002e96638bdd0b5c9891 /android | |
| parent | a5626795e89c18f3b7e4ab30f401fb9b0d4a00c9 (diff) | |
| parent | b2ebd898135209517de65d70f102c6f849726066 (diff) | |
| download | mullvadvpn-2de3cbdaacfde3940b40aff94ee4760bc6223840.tar.xz mullvadvpn-2de3cbdaacfde3940b40aff94ee4760bc6223840.zip | |
Merge branch 'wireguard-only-relays-on-android'
Diffstat (limited to 'android')
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/model/Relay.kt | 2 | ||||
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayList.kt | 22 |
2 files changed, 14 insertions, 10 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/model/Relay.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/model/Relay.kt index 85c062c4c6..4173af782b 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/model/Relay.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/model/Relay.kt @@ -1,4 +1,4 @@ package net.mullvad.mullvadvpn.model -data class Relay(val hostname: String) { +data class Relay(val hostname: String, val hasWireguardTunnels: Boolean) { } diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayList.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayList.kt index 809fa1265f..e6bd7728b0 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayList.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayList.kt @@ -7,17 +7,21 @@ 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(country.code, city.code, relay.hostname) - } + countries = model.countries + .map { country -> + val cities = country.cities + .map { city -> + val relays = city.relays + .filter { relay -> relay.hasWireguardTunnels } + .map { relay -> Relay(country.code, city.code, relay.hostname) } - RelayCity(city.name, country.code, city.code, false, relays) - } + RelayCity(city.name, country.code, city.code, false, relays) + } + .filter { city -> city.relays.isNotEmpty() } - RelayCountry(country.name, country.code, false, cities) - } + RelayCountry(country.name, country.code, false, cities) + } + .filter { country -> country.cities.isNotEmpty() } } fun findItemForLocation( |
