Skip to content
Snippets Groups Projects
Unverified Commit 5b2187df authored by Kolya Opahle's avatar Kolya Opahle Committed by GitHub
Browse files

Merge branch 'release/1.8.x' into fix/3770-warn-others-app-reset

parents bbabe50c 3be0e1a7
No related branches found
No related tags found
No related merge requests found
...@@ -5,9 +5,12 @@ import androidx.lifecycle.asLiveData ...@@ -5,9 +5,12 @@ import androidx.lifecycle.asLiveData
import de.rki.coronawarnapp.appconfig.AppConfigProvider import de.rki.coronawarnapp.appconfig.AppConfigProvider
import de.rki.coronawarnapp.storage.LocalData import de.rki.coronawarnapp.storage.LocalData
import de.rki.coronawarnapp.ui.Country import de.rki.coronawarnapp.ui.Country
import de.rki.coronawarnapp.util.coroutine.AppScope
import de.rki.coronawarnapp.util.coroutine.DefaultDispatcherProvider
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.launch
import timber.log.Timber import timber.log.Timber
import java.util.Locale import java.util.Locale
import javax.inject.Inject import javax.inject.Inject
...@@ -15,13 +18,11 @@ import javax.inject.Singleton ...@@ -15,13 +18,11 @@ import javax.inject.Singleton
@Singleton @Singleton
class InteroperabilityRepository @Inject constructor( class InteroperabilityRepository @Inject constructor(
private val appConfigProvider: AppConfigProvider private val appConfigProvider: AppConfigProvider,
@AppScope private val appScope: CoroutineScope,
private val dispatcherProvider: DefaultDispatcherProvider
) { ) {
fun saveInteroperabilityUsed() {
LocalData.isInteroperabilityShownAtLeastOnce = true
}
private val countryListFlowInternal = MutableStateFlow(listOf<Country>()) private val countryListFlowInternal = MutableStateFlow(listOf<Country>())
val countryListFlow: Flow<List<Country>> = countryListFlowInternal val countryListFlow: Flow<List<Country>> = countryListFlowInternal
...@@ -32,12 +33,9 @@ class InteroperabilityRepository @Inject constructor( ...@@ -32,12 +33,9 @@ class InteroperabilityRepository @Inject constructor(
getAllCountries() getAllCountries()
} }
/**
* Gets all countries from @see ApplicationConfigurationService.asyncRetrieveApplicationConfiguration
* Also changes every country code to lower case
*/
fun getAllCountries() { fun getAllCountries() {
runBlocking { // TODO Make this reactive, the AppConfigProvider should refresh itself on network changes.
appScope.launch(context = dispatcherProvider.IO) {
try { try {
val countries = appConfigProvider.getAppConfig() val countries = appConfigProvider.getAppConfig()
.supportedCountries .supportedCountries
...@@ -60,4 +58,8 @@ class InteroperabilityRepository @Inject constructor( ...@@ -60,4 +58,8 @@ class InteroperabilityRepository @Inject constructor(
fun clear() { fun clear() {
countryListFlowInternal.value = emptyList() countryListFlowInternal.value = emptyList()
} }
fun saveInteroperabilityUsed() {
LocalData.isInteroperabilityShownAtLeastOnce = true
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment