forked from Louvorg/ReaderForSelfoss-multiplatform
Fix sources tests
This commit is contained in:
@@ -171,15 +171,17 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun getSources(): ArrayList<SelfossModel.Source>? {
|
||||
suspend fun getSources(): ArrayList<SelfossModel.Source> {
|
||||
return if (isNetworkAvailable()) {
|
||||
val apiSources = api.sources()
|
||||
if (apiSources.success && apiSources.data != null && (appSettingsService.isItemCachingEnabled() || !appSettingsService.isUpdateSourcesEnabled())) {
|
||||
if (apiSources.success && apiSources.data != null && (appSettingsService.isItemCachingEnabled() || appSettingsService.isUpdateSourcesEnabled())) {
|
||||
resetDBSourcesWithData(apiSources.data)
|
||||
}
|
||||
apiSources.data
|
||||
} else {
|
||||
apiSources.data ?: ArrayList()
|
||||
} else if (appSettingsService.isItemCachingEnabled() || appSettingsService.isUpdateSourcesEnabled()) {
|
||||
ArrayList(getDBSources().map { it.toView() })
|
||||
} else {
|
||||
ArrayList()
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user