diff options
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/model/LocationConstraint.kt | 26 |
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) + } } |
