mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-2897 All Content | Search, subscription fixes (#1627)
This commit is contained in:
parent
f71f86a054
commit
de63e10b02
3 changed files with 21 additions and 7 deletions
|
@ -112,7 +112,6 @@ class AllContentViewModel(
|
|||
init {
|
||||
Timber.d("AllContentViewModel init, spaceId:[${vmParams.spaceId.id}]")
|
||||
setupInitialStateParams()
|
||||
setupUiStateFlow()
|
||||
setupSearchStateFlow()
|
||||
setupMenuFlow()
|
||||
}
|
||||
|
@ -152,8 +151,13 @@ class AllContentViewModel(
|
|||
searchObjects(searchParams).process(
|
||||
success = { searchResults ->
|
||||
Timber.d("Search objects by query:[$query], size: : ${searchResults.size}")
|
||||
searchResultIds.value = searchResults.map { it.id }
|
||||
restartSubscription.value++
|
||||
if (searchResults.isEmpty()) {
|
||||
uiItemsState.value = emptyList()
|
||||
uiContentState.value = UiContentState.Empty
|
||||
} else {
|
||||
searchResultIds.value = searchResults.map { it.id }
|
||||
restartSubscription.value++
|
||||
}
|
||||
},
|
||||
failure = {
|
||||
Timber.e(it, "Error searching objects by query")
|
||||
|
@ -169,7 +173,7 @@ class AllContentViewModel(
|
|||
viewModelScope.launch {
|
||||
restartSubscription.flatMapLatest {
|
||||
loadData()
|
||||
}.collect { items ->
|
||||
}.collectLatest { items ->
|
||||
uiItemsState.value = items
|
||||
}
|
||||
}
|
||||
|
@ -506,6 +510,11 @@ class AllContentViewModel(
|
|||
}
|
||||
}
|
||||
|
||||
fun onStart() {
|
||||
Timber.d("onStart")
|
||||
setupUiStateFlow()
|
||||
}
|
||||
|
||||
fun onStop() {
|
||||
Timber.d("onStop")
|
||||
viewModelScope.launch {
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.anytypeio.anytype.feature_allcontent.ui
|
|||
import android.os.Build
|
||||
import androidx.compose.animation.core.animateFloatAsState
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.BoxScope
|
||||
import androidx.compose.foundation.layout.Column
|
||||
|
@ -53,6 +52,7 @@ import androidx.compose.ui.unit.dp
|
|||
import androidx.compose.ui.unit.sp
|
||||
import com.anytypeio.anytype.core_ui.common.DefaultPreviews
|
||||
import com.anytypeio.anytype.core_ui.foundation.Divider
|
||||
import com.anytypeio.anytype.core_ui.foundation.noRippleClickable
|
||||
import com.anytypeio.anytype.core_ui.views.ButtonSize
|
||||
import com.anytypeio.anytype.core_ui.views.Caption1Regular
|
||||
import com.anytypeio.anytype.core_ui.views.PreviewTitle1Medium
|
||||
|
@ -292,7 +292,7 @@ private fun ContentItems(
|
|||
.padding(horizontal = 16.dp)
|
||||
.bottomBorder()
|
||||
.animateItem()
|
||||
.clickable {
|
||||
.noRippleClickable {
|
||||
onItemClicked(item)
|
||||
},
|
||||
item = item
|
||||
|
@ -305,7 +305,7 @@ private fun ContentItems(
|
|||
.padding(horizontal = 16.dp)
|
||||
.bottomBorder()
|
||||
.animateItem()
|
||||
.clickable {
|
||||
.noRippleClickable {
|
||||
onTypeClicked(item)
|
||||
},
|
||||
item = item
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue