Fix tags tests

This commit is contained in:
2022-09-28 18:22:06 +02:00
parent 2968aee309
commit 219cae5d74
2 changed files with 36 additions and 5 deletions

View File

@@ -146,12 +146,14 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap
suspend fun getTags(): List<SelfossModel.Tag> {
return if (isNetworkAvailable()) {
val apiTags = api.tags()
if (apiTags.success && apiTags.data != null && (appSettingsService.isItemCachingEnabled() || !appSettingsService.isUpdateSourcesEnabled())) {
if (apiTags.success && apiTags.data != null && (appSettingsService.isItemCachingEnabled() || appSettingsService.isUpdateSourcesEnabled())) {
resetDBTagsWithData(apiTags.data)
}
apiTags.data ?: emptyList()
} else {
} else if (appSettingsService.isItemCachingEnabled() || appSettingsService.isUpdateSourcesEnabled()) {
getDBTags().map { it.toView() }
} else {
emptyList()
}
}