Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Cwa App Android
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Felix Foertsch
Cwa App Android
Commits
5b2187df
Unverified
Commit
5b2187df
authored
4 years ago
by
Kolya Opahle
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Plain Diff
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/interoperability/InteroperabilityRepository.kt
+13
-11
13 additions, 11 deletions
...pp/storage/interoperability/InteroperabilityRepository.kt
with
13 additions
and
11 deletions
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/interoperability/InteroperabilityRepository.kt
+
13
−
11
View file @
5b2187df
...
@@ -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
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment