mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-1972 Navigation | Fix | Set-to-set navigation (#602)
This commit is contained in:
parent
f3ef8a34c5
commit
08656b3f77
8 changed files with 36 additions and 14 deletions
|
@ -685,7 +685,7 @@ object ObjectSearchConstants {
|
|||
}
|
||||
}
|
||||
|
||||
fun defaultDataViewFilters(space: Id) = listOf(
|
||||
fun defaultDataViewFilters(space: Id, context: Id) = listOf(
|
||||
DVFilter(
|
||||
relation = Relations.IS_HIDDEN,
|
||||
condition = Condition.NOT_EQUAL,
|
||||
|
@ -705,6 +705,11 @@ object ObjectSearchConstants {
|
|||
relation = Relations.SPACE_ID,
|
||||
condition = DVFilterCondition.EQUAL,
|
||||
value = space
|
||||
),
|
||||
DVFilter(
|
||||
relation = Relations.ID,
|
||||
condition = DVFilterCondition.NOT_EQUAL,
|
||||
value = context
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ import com.anytypeio.anytype.core_models.InternalFlags
|
|||
import com.anytypeio.anytype.core_models.Key
|
||||
import com.anytypeio.anytype.core_models.ObjectType
|
||||
import com.anytypeio.anytype.core_models.ObjectTypeIds
|
||||
import com.anytypeio.anytype.core_models.ObjectTypeUniqueKeys
|
||||
import com.anytypeio.anytype.core_models.ObjectWrapper
|
||||
import com.anytypeio.anytype.core_models.Payload
|
||||
import com.anytypeio.anytype.core_models.Relation
|
||||
|
@ -76,7 +75,6 @@ import com.anytypeio.anytype.presentation.relations.ObjectSetConfig.DEFAULT_LIMI
|
|||
import com.anytypeio.anytype.presentation.relations.RelationListViewModel
|
||||
import com.anytypeio.anytype.presentation.relations.render
|
||||
import com.anytypeio.anytype.presentation.search.ObjectSearchConstants
|
||||
import com.anytypeio.anytype.presentation.search.Subscriptions.SUBSCRIPTION_SET_TEMPLATES
|
||||
import com.anytypeio.anytype.presentation.sets.model.CellView
|
||||
import com.anytypeio.anytype.presentation.sets.model.Viewer
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.anytypeio.anytype.domain.search.DataViewState
|
|||
import com.anytypeio.anytype.domain.search.DataViewSubscriptionContainer
|
||||
import com.anytypeio.anytype.presentation.relations.ObjectSetConfig
|
||||
import com.anytypeio.anytype.presentation.search.ObjectSearchConstants
|
||||
import com.anytypeio.anytype.presentation.search.ObjectSearchConstants.defaultDataViewFilters
|
||||
import com.anytypeio.anytype.presentation.sets.filterOutDeletedAndMissingObjects
|
||||
import com.anytypeio.anytype.presentation.sets.getSetOfValue
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
|
@ -59,10 +60,15 @@ class DefaultDataViewSubscription(
|
|||
Timber.w("Data view collection subscription: active viewer is null")
|
||||
return emptyFlow()
|
||||
}
|
||||
val filters =
|
||||
activeViewer.filters.updateFormatForSubscription(storeOfRelations) + ObjectSearchConstants.defaultDataViewFilters(
|
||||
space = space
|
||||
val filters = buildList {
|
||||
addAll(activeViewer.filters.updateFormatForSubscription(storeOfRelations))
|
||||
addAll(
|
||||
defaultDataViewFilters(
|
||||
space = space,
|
||||
context = context
|
||||
)
|
||||
)
|
||||
}
|
||||
val dataViewLinksKeys = state.dataViewContent.relationLinks.map { it.key }
|
||||
val keys = ObjectSearchConstants.defaultDataViewKeys + dataViewLinksKeys
|
||||
|
||||
|
@ -112,10 +118,15 @@ class DefaultDataViewSubscription(
|
|||
return emptyFlow()
|
||||
}
|
||||
|
||||
val filters =
|
||||
activeViewer.filters.updateFormatForSubscription(storeOfRelations) + ObjectSearchConstants.defaultDataViewFilters(
|
||||
space = space
|
||||
val filters = buildList {
|
||||
addAll(activeViewer.filters.updateFormatForSubscription(storeOfRelations))
|
||||
addAll(
|
||||
defaultDataViewFilters(
|
||||
space = space,
|
||||
context = context
|
||||
)
|
||||
)
|
||||
}
|
||||
val dataViewLinksKeys = state.dataViewContent.relationLinks.map { it.key }
|
||||
val keys = ObjectSearchConstants.defaultDataViewKeys + dataViewLinksKeys
|
||||
|
||||
|
|
|
@ -159,7 +159,12 @@ class DataViewListWidgetContainer(
|
|||
}.distinct(),
|
||||
filters = buildList {
|
||||
addAll(view.filters)
|
||||
addAll(ObjectSearchConstants.defaultDataViewFilters(space))
|
||||
addAll(
|
||||
ObjectSearchConstants.defaultDataViewFilters(
|
||||
space = space,
|
||||
context = root
|
||||
)
|
||||
)
|
||||
add(
|
||||
DVFilter(
|
||||
relation = Relations.TYPE_UNIQUE_KEY,
|
||||
|
|
|
@ -328,7 +328,8 @@ class ObjectStateSetViewTest : ObjectSetViewModelTestSetup() {
|
|||
eq(listOf()),
|
||||
eq(
|
||||
mockObjectSet.filters + ObjectSearchConstants.defaultDataViewFilters(
|
||||
mockObjectSet.spaceId
|
||||
mockObjectSet.spaceId,
|
||||
root
|
||||
)
|
||||
),
|
||||
eq(ObjectSearchConstants.defaultDataViewKeys + mockObjectSet.dvKeys),
|
||||
|
|
|
@ -2440,7 +2440,7 @@ class HomeScreenViewModelTest {
|
|||
val firstTimeParams = StoreSearchParams(
|
||||
subscription = widgetBlock.id,
|
||||
filters = buildList {
|
||||
addAll(ObjectSearchConstants.defaultDataViewFilters(defaultSpaceConfig.space))
|
||||
addAll(ObjectSearchConstants.defaultDataViewFilters(defaultSpaceConfig.space, currentWidgetSourceObject.id))
|
||||
add(
|
||||
DVFilter(
|
||||
relation = Relations.TYPE_UNIQUE_KEY,
|
||||
|
|
|
@ -98,7 +98,8 @@ class ObjectSetConvertToCollectionTest : ObjectSetViewModelTestSetup() {
|
|||
eq(listOf()),
|
||||
eq(
|
||||
mockObjectSet.filters + ObjectSearchConstants.defaultDataViewFilters(
|
||||
mockObjectSet.spaceId
|
||||
mockObjectSet.spaceId,
|
||||
mockObjectSet.root
|
||||
)
|
||||
),
|
||||
eq(ObjectSearchConstants.defaultDataViewKeys + mockObjectSet.dvKeys),
|
||||
|
|
|
@ -341,7 +341,8 @@ open class ObjectSetViewModelTestSetup {
|
|||
subscription = subscription,
|
||||
collection = collection,
|
||||
filters = dvFilters.updateFormatForSubscription(storeOfRelations) + ObjectSearchConstants.defaultDataViewFilters(
|
||||
space = spaceId
|
||||
space = spaceId,
|
||||
context = root
|
||||
),
|
||||
sorts = dvSorts,
|
||||
keys = dvKeys,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue