fix search pull-to-refresh (#4915)
Before this, refreshing the status search would show the loading spinner but not actually do something (account and hashtag search worked fine).
This commit is contained in:
parent
bc78af47ba
commit
759902b280
2 changed files with 12 additions and 3 deletions
|
|
@ -60,9 +60,9 @@ class SearchViewModel @Inject constructor(
|
|||
val activeAccount: AccountEntity?
|
||||
get() = accountManager.activeAccount
|
||||
|
||||
val mediaPreviewEnabled = activeAccount?.mediaPreviewEnabled ?: false
|
||||
val alwaysShowSensitiveMedia = activeAccount?.alwaysShowSensitiveMedia ?: false
|
||||
val alwaysOpenSpoiler = activeAccount?.alwaysOpenSpoiler ?: false
|
||||
val mediaPreviewEnabled = activeAccount?.mediaPreviewEnabled == true
|
||||
val alwaysShowSensitiveMedia = activeAccount?.alwaysShowSensitiveMedia == true
|
||||
val alwaysOpenSpoiler = activeAccount?.alwaysOpenSpoiler == true
|
||||
|
||||
private val loadedStatuses: MutableList<StatusViewData.Concrete> = mutableListOf()
|
||||
|
||||
|
|
@ -131,6 +131,10 @@ class SearchViewModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
fun clearStatusCache() {
|
||||
loadedStatuses.clear()
|
||||
}
|
||||
|
||||
fun expandedChange(statusViewData: StatusViewData.Concrete, expanded: Boolean) {
|
||||
updateStatusViewData(statusViewData.copy(isExpanded = expanded))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,6 +147,11 @@ class SearchStatusesFragment : SearchFragment<StatusViewData.Concrete>(), Status
|
|||
return adapter
|
||||
}
|
||||
|
||||
override fun onRefresh() {
|
||||
viewModel.clearStatusCache()
|
||||
super.onRefresh()
|
||||
}
|
||||
|
||||
override fun onContentHiddenChange(isShowing: Boolean, position: Int) {
|
||||
adapter?.peek(position)?.let {
|
||||
viewModel.contentHiddenChange(it, isShowing)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue