Closes #44
This commit is contained in:
@ -137,7 +137,11 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap
|
||||
|
||||
suspend fun getTags(): List<SelfossModel.Tag>? {
|
||||
return if (isNetworkAvailable()) {
|
||||
api.tags()
|
||||
val apiTags = api.tags()
|
||||
if (apiTags != null && (appSettingsService.isItemCachingEnabled() || !appSettingsService.isUpdateSourcesEnabled())) {
|
||||
resetDBTagsWithData(apiTags)
|
||||
}
|
||||
apiTags
|
||||
} else {
|
||||
getDBTags().map { it.toView() }
|
||||
}
|
||||
@ -152,9 +156,12 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap
|
||||
}
|
||||
|
||||
suspend fun getSources(): ArrayList<SelfossModel.Source>? {
|
||||
|
||||
return if (isNetworkAvailable()) {
|
||||
api.sources()
|
||||
val apiSources = api.sources()
|
||||
if (apiSources != null && (appSettingsService.isItemCachingEnabled() || !appSettingsService.isUpdateSourcesEnabled())) {
|
||||
resetDBSourcesWithData(apiSources)
|
||||
}
|
||||
apiSources
|
||||
} else {
|
||||
ArrayList(getDBSources().map { it.toView() })
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ class AppSettingsService {
|
||||
private var _periodicRefresh: Boolean? = null
|
||||
private var _refreshWhenChargingOnly: Boolean? = null
|
||||
private var _infiniteLoading: Boolean? = null
|
||||
private var _displayAccountHeader: Boolean? = null
|
||||
private var _notifyNewItems: Boolean? = null
|
||||
private var _itemsNumber: Int? = null
|
||||
private var _apiTimeout: Long? = null
|
||||
@ -34,9 +33,9 @@ class AppSettingsService {
|
||||
private var _markOnScroll: Boolean? = null
|
||||
private var _activeAlignment: Int? = null
|
||||
|
||||
private var _fontSize: Int? = null // settings.getString("reader_font_size", "16").toInt()
|
||||
private var _staticBar: Boolean? = null // settings.getBoolean("reader_static_bar", false)
|
||||
private var _font: String = "" // settings.getString("reader_font", "")
|
||||
private var _fontSize: Int? = null
|
||||
private var _staticBar: Boolean? = null
|
||||
private var _font: String = ""
|
||||
|
||||
|
||||
init {
|
||||
@ -247,17 +246,6 @@ class AppSettingsService {
|
||||
return _infiniteLoading == true
|
||||
}
|
||||
|
||||
private fun refreshDisplayAccountHeaderEnabled() {
|
||||
_displayAccountHeader = settings.getBoolean("account_header_displaying", false)
|
||||
}
|
||||
|
||||
fun isDisplayAccountHeaderEnabled(): Boolean {
|
||||
if (_displayAccountHeader != null) {
|
||||
refreshDisplayAccountHeaderEnabled()
|
||||
}
|
||||
return _displayAccountHeader == true
|
||||
}
|
||||
|
||||
private fun refreshItemCachingEnabled() {
|
||||
_itemsCaching = settings.getBoolean("items_caching", false)
|
||||
}
|
||||
@ -364,7 +352,6 @@ class AppSettingsService {
|
||||
refreshRefreshMinutes()
|
||||
refreshHiddenTags()
|
||||
refreshInfiniteLoadingEnabled()
|
||||
refreshDisplayAccountHeaderEnabled()
|
||||
refreshItemCachingEnabled()
|
||||
refreshNotifyNewItemsEnabled()
|
||||
refreshMarkOnScrollEnabled()
|
||||
|
Reference in New Issue
Block a user