Skip to content

Commit 27f00c9

Browse files
committed
clean up
1 parent 5fb7446 commit 27f00c9

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/RelayListRepository.kt

+10-10
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ class RelayListRepository(
4242
private fun List<RelayItem.Location.Country>.translateRelay(
4343
translations: Map<String, String>
4444
): List<RelayItem.Location.Country> {
45-
return if (translations.isEmpty()) {
45+
if (translations.isEmpty()) {
4646
return this
47-
} else {
48-
Every.list<RelayItem.Location.Country>().modify(this) {
49-
it.copy<RelayItem.Location.Country> {
50-
RelayItem.Location.Country.name set translations.getOrDefault(it.name, it.name)
51-
RelayItem.Location.Country.cities.every(Every.list()).name transform
52-
{ cityName ->
53-
translations.getOrDefault(cityName, cityName)
54-
}
55-
}
47+
}
48+
49+
return Every.list<RelayItem.Location.Country>().modify(this) {
50+
it.copy<RelayItem.Location.Country> {
51+
RelayItem.Location.Country.name set translations.getOrDefault(it.name, it.name)
52+
RelayItem.Location.Country.cities.every(Every.list()).name transform
53+
{ cityName ->
54+
translations.getOrDefault(cityName, cityName)
55+
}
5656
}
5757
}
5858
}

android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/TunnelState.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package net.mullvad.mullvadvpn.lib.model
22

33
sealed class TunnelState {
4-
data class Disconnected(val location: GeoIpLocation? = null, val age: Int = 0) : TunnelState()
4+
data class Disconnected(val location: GeoIpLocation? = null) : TunnelState()
55

66
data class Connecting(val endpoint: TunnelEndpoint?, val location: GeoIpLocation?) :
77
TunnelState()

android/lib/shared/src/main/kotlin/net/mullvad/mullvadvpn/lib/shared/RelayLocationTranslationRepository.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import kotlin.to
1313
import kotlinx.coroutines.CoroutineDispatcher
1414
import kotlinx.coroutines.CoroutineScope
1515
import kotlinx.coroutines.Dispatchers
16+
import kotlinx.coroutines.MainScope
1617
import kotlinx.coroutines.flow.SharingStarted
1718
import kotlinx.coroutines.flow.StateFlow
1819
import kotlinx.coroutines.flow.map
@@ -24,14 +25,13 @@ typealias Translations = Map<String, String>
2425
class RelayLocationTranslationRepository(
2526
val context: Context,
2627
val localeRepository: LocaleRepository,
27-
externalScpoe: CoroutineScope,
28+
externalScope: CoroutineScope = MainScope(),
2829
val dispatcher: CoroutineDispatcher = Dispatchers.IO
2930
) {
30-
3131
val translations: StateFlow<Translations> =
3232
localeRepository.currentLocale
3333
.map { loadTranslations(it) }
34-
.stateIn(externalScpoe, SharingStarted.Eagerly, emptyMap())
34+
.stateIn(externalScope, SharingStarted.Eagerly, emptyMap())
3535

3636
private val defaultTranslation: Map<String, String>
3737

0 commit comments

Comments
 (0)