Display RefreshScreen in TimelineTab only with a local account
This commit is contained in:
parent
f9a2eb5e2c
commit
d19b8d90d4
@ -3,7 +3,7 @@ package com.readrops.app.compose.timelime
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.compose.runtime.Immutable
|
import androidx.compose.runtime.Stable
|
||||||
import androidx.paging.Pager
|
import androidx.paging.Pager
|
||||||
import androidx.paging.PagingConfig
|
import androidx.paging.PagingConfig
|
||||||
import androidx.paging.PagingData
|
import androidx.paging.PagingData
|
||||||
@ -68,7 +68,8 @@ class TimelineScreenModel(
|
|||||||
database.newItemDao().selectAll(query)
|
database.newItemDao().selectAll(query)
|
||||||
},
|
},
|
||||||
).flow
|
).flow
|
||||||
.cachedIn(screenModelScope)
|
.cachedIn(screenModelScope),
|
||||||
|
isAccountLocal = account.isLocal
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,7 +320,7 @@ class TimelineScreenModel(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Immutable
|
@Stable
|
||||||
data class TimelineState(
|
data class TimelineState(
|
||||||
val isRefreshing: Boolean = false,
|
val isRefreshing: Boolean = false,
|
||||||
val isDrawerOpen: Boolean = false,
|
val isDrawerOpen: Boolean = false,
|
||||||
@ -334,10 +335,13 @@ data class TimelineState(
|
|||||||
val filterFolderName: String = "",
|
val filterFolderName: String = "",
|
||||||
val foldersAndFeeds: Map<Folder?, List<Feed>> = emptyMap(),
|
val foldersAndFeeds: Map<Folder?, List<Feed>> = emptyMap(),
|
||||||
val itemState: Flow<PagingData<ItemWithFeed>> = emptyFlow(),
|
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 showSubtitle = filters.subFilter != SubFilter.ALL
|
||||||
|
|
||||||
|
val displayRefreshScreen = isRefreshing && isAccountLocal
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed interface DialogState {
|
sealed interface DialogState {
|
||||||
|
@ -293,7 +293,7 @@ object TimelineTab : Tab {
|
|||||||
.nestedScroll(pullToRefreshState.nestedScrollConnection)
|
.nestedScroll(pullToRefreshState.nestedScrollConnection)
|
||||||
) {
|
) {
|
||||||
when {
|
when {
|
||||||
state.isRefreshing -> RefreshScreen(
|
state.displayRefreshScreen -> RefreshScreen(
|
||||||
currentFeed = state.currentFeed,
|
currentFeed = state.currentFeed,
|
||||||
feedCount = state.feedCount,
|
feedCount = state.feedCount,
|
||||||
feedMax = state.feedMax
|
feedMax = state.feedMax
|
||||||
|
Loading…
x
Reference in New Issue
Block a user