summaryrefslogtreecommitdiffhomepage
path: root/android/src
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2021-03-25 13:58:25 +0000
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2021-03-25 18:19:58 +0000
commit47559d086663ec3ff166b41ff5331e58339e68ce (patch)
tree2ba579ce0f14786bcc31bb8928dd423ce4a23b96 /android/src
parent1047d8fdd65fe63361cf0e2f88dde51cbd9a83ec (diff)
downloadmullvadvpn-47559d086663ec3ff166b41ff5331e58339e68ce.tar.xz
mullvadvpn-47559d086663ec3ff166b41ff5331e58339e68ce.zip
Add `location` property to `LocationConstraint`
Diffstat (limited to 'android/src')
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/model/LocationConstraint.kt26
1 files changed, 21 insertions, 5 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/model/LocationConstraint.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/model/LocationConstraint.kt
index 15937d7c67..55757e5b8f 100644
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/model/LocationConstraint.kt
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/model/LocationConstraint.kt
@@ -4,14 +4,30 @@ import android.os.Parcelable
import kotlinx.parcelize.Parcelize
sealed class LocationConstraint : Parcelable {
+ abstract val location: GeoIpLocation
+
@Parcelize
- data class Country(val countryCode: String) : LocationConstraint(), Parcelable
+ data class Country(val countryCode: String) : LocationConstraint(), Parcelable {
+ override val location: GeoIpLocation
+ get() = GeoIpLocation(null, null, countryCode, null, null)
+ }
@Parcelize
- data class City(val countryCode: String, val cityCode: String) :
- LocationConstraint(), Parcelable
+ data class City(
+ val countryCode: String,
+ val cityCode: String
+ ) : LocationConstraint(), Parcelable {
+ override val location: GeoIpLocation
+ get() = GeoIpLocation(null, null, countryCode, cityCode, null)
+ }
@Parcelize
- data class Hostname(val countryCode: String, val cityCode: String, val hostname: String) :
- LocationConstraint(), Parcelable
+ data class Hostname(
+ val countryCode: String,
+ val cityCode: String,
+ val hostname: String
+ ) : LocationConstraint(), Parcelable {
+ override val location: GeoIpLocation
+ get() = GeoIpLocation(null, null, countryCode, cityCode, hostname)
+ }
}