From 77c5f849a374cb19b1c28edfcffc386cecc94464 Mon Sep 17 00:00:00 2001 From: Jonatan Rhodin Date: Mon, 18 Nov 2024 14:56:55 +0100 Subject: [PATCH] Fix trailing comma when location has no city --- .../net/mullvad/mullvadvpn/compose/screen/ConnectScreen.kt | 4 ++-- .../net/mullvad/mullvadvpn/lib/daemon/grpc/mapper/ToDomain.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ConnectScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ConnectScreen.kt index 26a3382a5fbd..71e7f66d0fa2 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ConnectScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ConnectScreen.kt @@ -431,9 +431,9 @@ private fun GeoIpLocation?.asString(): String { else { buildString { append(country) - city?.let { + if (!city.isNullOrBlank()) { append(", ") - append(it) + append(city) } } } diff --git a/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/mapper/ToDomain.kt b/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/mapper/ToDomain.kt index 9c54bc5bc5c4..236d4aa19ca9 100644 --- a/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/mapper/ToDomain.kt +++ b/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/mapper/ToDomain.kt @@ -134,7 +134,7 @@ internal fun ManagementInterface.GeoIpLocation.toDomain(): GeoIpLocation = null }, country = country, - city = city, + city = if (hasCity()) city else null, latitude = latitude, longitude = longitude, hostname = if (hasHostname()) hostname else null,