Display RefreshScreen in TimelineTab only with a local account

This commit is contained in:
Shinokuni 2024-05-10 16:12:45 +02:00
parent f9a2eb5e2c
commit d19b8d90d4
2 changed files with 9 additions and 5 deletions

View File

@ -3,7 +3,7 @@ package com.readrops.app.compose.timelime
import android.content.Context
import android.content.Intent
import android.util.Log
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.Stable
import androidx.paging.Pager
import androidx.paging.PagingConfig
import androidx.paging.PagingData
@ -68,7 +68,8 @@ class TimelineScreenModel(
database.newItemDao().selectAll(query)
},
).flow
.cachedIn(screenModelScope)
.cachedIn(screenModelScope),
isAccountLocal = account.isLocal
)
}
@ -319,7 +320,7 @@ class TimelineScreenModel(
}
@Immutable
@Stable
data class TimelineState(
val isRefreshing: Boolean = false,
val isDrawerOpen: Boolean = false,
@ -334,10 +335,13 @@ data class TimelineState(
val filterFolderName: String = "",
val foldersAndFeeds: Map<Folder?, List<Feed>> = emptyMap(),
val itemState: Flow<PagingData<ItemWithFeed>> = emptyFlow(),
val dialog: DialogState? = null
val dialog: DialogState? = null,
val isAccountLocal: Boolean = false
) {
val showSubtitle = filters.subFilter != SubFilter.ALL
val displayRefreshScreen = isRefreshing && isAccountLocal
}
sealed interface DialogState {

View File

@ -293,7 +293,7 @@ object TimelineTab : Tab {
.nestedScroll(pullToRefreshState.nestedScrollConnection)
) {
when {
state.isRefreshing -> RefreshScreen(
state.displayRefreshScreen -> RefreshScreen(
currentFeed = state.currentFeed,
feedCount = state.feedCount,
feedMax = state.feedMax