diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/search/ObjectSearchConstants.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/search/ObjectSearchConstants.kt index 15e4c2a603..32bd82d4c2 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/search/ObjectSearchConstants.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/search/ObjectSearchConstants.kt @@ -1106,44 +1106,52 @@ object ObjectSearchConstants { ) ) - fun filesFilters(space: Id) = listOf( - DVFilter( - relation = Relations.IS_DELETED, - condition = DVFilterCondition.NOT_EQUAL, - value = true - ), - DVFilter( - relation = Relations.IS_ARCHIVED, - condition = DVFilterCondition.NOT_EQUAL, - value = true - ), - DVFilter( - relation = Relations.IS_HIDDEN, - condition = DVFilterCondition.NOT_EQUAL, - value = true - ), - DVFilter( - relation = Relations.IS_HIDDEN_DISCOVERY, - condition = DVFilterCondition.NOT_EQUAL, - value = true - ), - DVFilter( - relation = Relations.LAYOUT, - condition = DVFilterCondition.IN, - value = listOf( - ObjectType.Layout.IMAGE.code.toDouble(), - ObjectType.Layout.FILE.code.toDouble(), - ObjectType.Layout.VIDEO.code.toDouble(), - ObjectType.Layout.AUDIO.code.toDouble(), - ObjectType.Layout.PDF.code.toDouble() + fun filesFilters(space: Id, hiddenDiscovery: Boolean = true) = buildList { + addAll( + listOf( + DVFilter( + relation = Relations.IS_DELETED, + condition = DVFilterCondition.NOT_EQUAL, + value = true + ), + DVFilter( + relation = Relations.IS_ARCHIVED, + condition = DVFilterCondition.NOT_EQUAL, + value = true + ), + DVFilter( + relation = Relations.IS_HIDDEN, + condition = DVFilterCondition.NOT_EQUAL, + value = true + ), + DVFilter( + relation = Relations.LAYOUT, + condition = DVFilterCondition.IN, + value = listOf( + ObjectType.Layout.IMAGE.code.toDouble(), + ObjectType.Layout.FILE.code.toDouble(), + ObjectType.Layout.VIDEO.code.toDouble(), + ObjectType.Layout.AUDIO.code.toDouble(), + ObjectType.Layout.PDF.code.toDouble() + ) + ), + DVFilter( + relation = Relations.SPACE_ID, + condition = DVFilterCondition.EQUAL, + value = space + ) ) - ), - DVFilter( - relation = Relations.SPACE_ID, - condition = DVFilterCondition.EQUAL, - value = space ) - ) + if (hiddenDiscovery) { + add( + DVFilter( + relation = Relations.IS_HIDDEN_DISCOVERY, + condition = DVFilterCondition.NOT_EQUAL, + value = true + ) + ) + } + } fun setsByObjectTypeFilters(types: List) = listOf( DVFilter( diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/collection/CollectionViewModel.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/collection/CollectionViewModel.kt index d2aadae1b6..42983a4e9b 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/collection/CollectionViewModel.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/collection/CollectionViewModel.kt @@ -230,6 +230,7 @@ class CollectionViewModel( } fun onStart(subscription: Subscription) { + Timber.i("CollectionViewModel, onStart, subscription:${subscription}") val isFirstLaunch = this.subscription == Subscription.None this.subscription = subscription if (permission.value?.isOwnerOrEditor() == true && isFirstLaunch && (subscription == Subscription.Bin || subscription == Subscription.Files)) { diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/collection/Subscription.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/collection/Subscription.kt index 081fab6daf..fb6eea53a9 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/collection/Subscription.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/collection/Subscription.kt @@ -75,7 +75,12 @@ sealed class Subscription( ) ), limit = 0, - space = { spaces -> ObjectSearchConstants.filesFilters(spaces) } + space = { spaces -> + ObjectSearchConstants.filesFilters( + space = spaces, + hiddenDiscovery = false + ) + } ) data object None : Subscription("", emptyList(), emptyList(), 0, space = { emptyList() })