mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-986 | Collections | Enhancement | Main tasks (#2978)
* DROID-986 Tech | Integrate MW New Infrastructure (#2941) * DROID-986 proto + version * DROID-986 proto * DROID-986 version * DROID-986 add collection * DROID-986 Collections | Enhancement | New object state integration (#2940) * DROID-962 P2P | Add mdns and update protobufs for new infra * DROID-869 protos from branch feature/collections * DROID-986 proto fix * DROID-986 proto + version * DROID-986 proto * DROID-986 version * DROID-986 add collection * DROID-986 migrate from set to collection * DROID-986 integrate collections * DROID-986 legacy * DROID-986 update extension * DROID-986 legacy * DROID-986 remove legacy relations from dv, update logic with storeOfRelations * DROID-986 new collections and sets reducer + state model * DROID-986 code style * DROID-986 removed relations param from dataView model * DROID-986 refactoring * DROID-986 legacy * DROID-986 add new reducer to viewModel * DROID-986 rename relationsIndex to relationLinks * DROID-986 rename param * DROID-986 collection di * DROID-986 data view subscription * DROID-986 object state model * DROID-986 convertToCollection useCase * DROID-986 integrate convertToCollection * DROID-986 subscription, collection id * DROID-986 viewmodel, refactoring with new reducer * DROID-986 legacy reducer * DROID-986 objectState model * DROID-986 extencions * DROID-986 view model update * DROID-986 fixes * DROID-986 tests fix * DROID-986 pr fix * DROID-986 Revert "DROID-962 P2P | Add mdns and update protobufs for new infra" This reverts commit c91d5ec30bee2564c440d1ee1978e29b9cd1e01e. * DROID-986 move reduce function to the next pr * DROID-986 Revert "DROID-986 migrate from set to collection" This reverts commit 015fac32763071a3ee1004b0b49e9453ad1a4dcb. * Revert "DROID-986 Revert "DROID-986 migrate from set to collection"" This reverts commit 4ed4ccb0721be6dfa8bae86f2486e629cd7e4992. * DROID-986 Revert "DROID-986 integrate collections" This reverts commit b5d6dad25f72f65a3b4981e8aac15f7458a05b73. # Conflicts: # app/src/main/java/com/anytypeio/anytype/ui/widgets/collection/CollectionViewModel.kt * DROID-986 pr fix * DROID-986 pr fix * DROID-986 pr fix --------- Co-authored-by: mcrakhman <rakhmanov.m@gmail.com> * DROID-986 Collections | Event reducer (#2945) * DROID-923 Collections | Enhancement | Empty states (#2954) * DROID-923 update design * DROID-923 legacy * DROID-923 set view + tests * DROID-923 set + collections view state, tests * DROID-923 reducer update * DROID-923 update collection/set design * DROID-923 design fix * DROID-923 addToCollection mw event * DROID-923 add object to collection * DROID-923 dataViewInfo * DROID-923 remove legacy param * DROID-923 collection integrate * DROID-923 move tests to another pr * DROID-923 pr fix * DROID-923 fixes * DROID-923 Collections | Empty states, tests (#2956) * DROID-208 Collections | Loading state (#2958) * DROID-208 loading state * DROID-208 fix binding * DROID-983 Collections | Integrate ObjectState model (#2966) * DROID-983 migrate to objectState * DROID-983 moving to object state model * DROID-983 di fix * DROID-983 legacy * DROID-983 don't merge * DROID-983 fixes * DROID-983 di + clean viewer * DROID-983 refactoring * DROID-962 P2P | Add mdns and update protobufs for new infra (#2918) * DROID-984 Collections | Enhancement | Ability to Change SET Type to COLLECTION Type (#2977) * DROID-984 set type menu * DROID-984 setQueryToSet useCase * DROID-984 fabric * DROID-984 don't start subscription, when context is empty * DROID-984 convertToCollection + fix navigation * DROID-984 set menu * DROID-984 object relations refactoring * DROID-984 refactoring * DROID-984 code style * DROID-923 Collections | COLLECTION and SET types in object type lists (#2983) * DROID-923 disable view and settings in case no objects * DROID-923 button design * DROID-923 wrong filter * DROID-923 collections and sets on types list * DROID-923 set back * DROID-1049 MW | New infrastructure latest (#2985) * DROID-1049 MW | New infrastructure latest (#2994) * DROID-1057 MW | Integrate 0.26.0-rc1 (#2996) * DROID-1057 proto * DROID-1057 mw version * DROID-1057 MW | Integrate 0.26.0-rc1 (#2997) * DROID-984 Collections | Enhancement | Ability to Change SET Type to COLLECTION Type + TESTS (#2999) * DROID-984 catch subscribtion errors * DROID-984 add possibility to open collections from widgets * DROID-984 legacy * DROID-984 fix tests * DROID-984 fix view title design * DROID-984 tests, rename * DROID-984 subscription refactoring * DROID-984 rename param in test * DROID-984 collection test * DROID-984 test fixes * DROID-984 fix dataViewKeys * DROID-984 update tests * DROID-984 collection state fixes * DROID-984 collections tests * DROID-984 set tests * DROID-984 tests * DROID-984 reduce fun * DROID-984 set reducer tests * DROID-984 tests * DROID-984 relation add, test * DROID-984 legacy filter * DROID-984 test fix * DROID-984 cell click test * DROID-984 update tests * DROID-984 set restrictions test * DROID-984 viewer delete test * DROID-984 zero data view test, legacy * DROID-984 set navigation test * DROID-984 mock data view filters * DROID-984 set by relation test * DROID-984 fix tests * DROID-984 set mock * DROID-984 add default advance time * DROID-984 stub header * DROID-984 tests setup * DROID-984 toasts as sharedFlow * DROID-984 legacy useCase * DROID-984 refactoring * ci start * ci off --------- Co-authored-by: mcrakhman <rakhmanov.m@gmail.com>
This commit is contained in:
parent
9ac64c79fa
commit
c5866bdf39
241 changed files with 6823 additions and 5858 deletions
|
@ -203,6 +203,7 @@ dependencies {
|
|||
implementation libs.zxing
|
||||
|
||||
implementation libs.androidxSecurityCrypto
|
||||
implementation libs.middleware
|
||||
|
||||
//Unit/Integration tests dependencies
|
||||
testImplementation libs.androidXTestCore
|
||||
|
|
|
@ -61,6 +61,7 @@ import com.anytypeio.anytype.domain.launch.GetDefaultPageType
|
|||
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
||||
import com.anytypeio.anytype.domain.`object`.ConvertObjectToSet
|
||||
import com.anytypeio.anytype.domain.`object`.UpdateDetail
|
||||
import com.anytypeio.anytype.domain.`object`.ConvertObjectToCollection
|
||||
import com.anytypeio.anytype.domain.objects.DefaultStoreOfObjectTypes
|
||||
import com.anytypeio.anytype.domain.objects.DefaultStoreOfRelations
|
||||
import com.anytypeio.anytype.domain.objects.StoreOfObjectTypes
|
||||
|
@ -261,6 +262,9 @@ open class EditorTestSetup {
|
|||
@Mock
|
||||
lateinit var tableDelegate: EditorTableDelegate
|
||||
|
||||
@Mock
|
||||
lateinit var objectToCollection: ConvertObjectToCollection
|
||||
|
||||
val root: String = "rootId123"
|
||||
val workspaceId = MockDataFactory.randomString()
|
||||
|
||||
|
@ -450,7 +454,8 @@ open class EditorTestSetup {
|
|||
featureToggles = featureToggles,
|
||||
tableDelegate = tableDelegate,
|
||||
workspaceManager = workspaceManager,
|
||||
getObjectTypes = getObjectTypes
|
||||
getObjectTypes = getObjectTypes,
|
||||
objectToCollection = objectToCollection
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@ import com.anytypeio.anytype.presentation.relations.add.AddOptionsRelationProvid
|
|||
import com.anytypeio.anytype.presentation.relations.providers.DataViewObjectRelationProvider
|
||||
import com.anytypeio.anytype.presentation.relations.providers.DataViewObjectValueProvider
|
||||
import com.anytypeio.anytype.presentation.relations.providers.ObjectDetailProvider
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.test_utils.MockDataFactory
|
||||
import com.anytypeio.anytype.test_utils.utils.checkHasText
|
||||
|
@ -93,7 +93,7 @@ class AddRelationStatusValueTest {
|
|||
val coroutineTestRule = CoroutinesTestRule()
|
||||
|
||||
private val ctx = MockDataFactory.randomUuid()
|
||||
private val state = MutableStateFlow(ObjectSet.init())
|
||||
private val state: MutableStateFlow<ObjectState> = MutableStateFlow(ObjectState.Init)
|
||||
private val store : ObjectStore = DefaultObjectStore()
|
||||
private val storeOfRelations: StoreOfRelations = DefaultStoreOfRelations()
|
||||
private val db = ObjectSetDatabase(store = store)
|
||||
|
@ -107,7 +107,7 @@ class AddRelationStatusValueTest {
|
|||
urlBuilder = UrlBuilder(gateway)
|
||||
TestRelationOptionValueDVAddFragment.testVmFactory = AddOptionsRelationDVViewModel.Factory(
|
||||
relations = DataViewObjectRelationProvider(
|
||||
objectSetState = state,
|
||||
objectState = state,
|
||||
storeOfRelations = storeOfRelations
|
||||
),
|
||||
values = DataViewObjectValueProvider(
|
||||
|
@ -161,12 +161,11 @@ class AddRelationStatusValueTest {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer)
|
||||
)
|
||||
)
|
||||
|
||||
state.value = ObjectSet(blocks = listOf(dv))
|
||||
state.value = ObjectState.DataView.Set(blocks = listOf(dv))
|
||||
|
||||
stubCreateRelationOption()
|
||||
|
||||
|
@ -239,20 +238,11 @@ class AddRelationStatusValueTest {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer)
|
||||
)
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
blocks = listOf(dv),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
state.value = ObjectState.DataView.Set(blocks = listOf(dv))
|
||||
|
||||
stubCreateRelationOption()
|
||||
|
||||
|
@ -331,20 +321,11 @@ class AddRelationStatusValueTest {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer)
|
||||
)
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
blocks = listOf(dv),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
state.value = ObjectState.DataView.Set(blocks = listOf(dv))
|
||||
|
||||
// TESTING
|
||||
|
||||
|
@ -422,20 +403,11 @@ class AddRelationStatusValueTest {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer)
|
||||
)
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
blocks = listOf(dv),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
state.value = ObjectState.DataView.Set(blocks = listOf(dv))
|
||||
|
||||
// TESTING
|
||||
|
||||
|
@ -522,20 +494,11 @@ class AddRelationStatusValueTest {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer)
|
||||
)
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
blocks = listOf(dv),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
state.value = ObjectState.DataView.Set(blocks = listOf(dv))
|
||||
|
||||
// TESTING
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ import com.anytypeio.anytype.presentation.relations.add.AddOptionsRelationProvid
|
|||
import com.anytypeio.anytype.presentation.relations.providers.DataViewObjectRelationProvider
|
||||
import com.anytypeio.anytype.presentation.relations.providers.DataViewObjectValueProvider
|
||||
import com.anytypeio.anytype.presentation.relations.providers.ObjectDetailProvider
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.test_utils.MockDataFactory
|
||||
import com.anytypeio.anytype.test_utils.utils.checkHasText
|
||||
|
@ -91,7 +91,7 @@ class AddRelationTagValueTest {
|
|||
val coroutineTestRule = CoroutinesTestRule()
|
||||
|
||||
private val ctx = MockDataFactory.randomUuid()
|
||||
private val state = MutableStateFlow(ObjectSet.init())
|
||||
private val state: MutableStateFlow<ObjectState> = MutableStateFlow(ObjectState.Init)
|
||||
private val store : ObjectStore = DefaultObjectStore()
|
||||
private val storeOfRelations: StoreOfRelations = DefaultStoreOfRelations()
|
||||
private val db = ObjectSetDatabase(store = store)
|
||||
|
@ -105,7 +105,7 @@ class AddRelationTagValueTest {
|
|||
urlBuilder = UrlBuilder(gateway)
|
||||
TestRelationOptionValueDVAddFragment.testVmFactory = AddOptionsRelationDVViewModel.Factory(
|
||||
relations = DataViewObjectRelationProvider(
|
||||
objectSetState = state,
|
||||
objectState = state,
|
||||
storeOfRelations = storeOfRelations
|
||||
),
|
||||
values = DataViewObjectValueProvider(db = db),
|
||||
|
@ -157,20 +157,11 @@ class AddRelationTagValueTest {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer)
|
||||
)
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
blocks = listOf(dv),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
state.value = ObjectState.DataView.Set(blocks = listOf(dv))
|
||||
|
||||
stubCreateRelationOption()
|
||||
|
||||
|
@ -267,20 +258,11 @@ class AddRelationTagValueTest {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer)
|
||||
)
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
blocks = listOf(dv),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
state.value = ObjectState.DataView.Set(blocks = listOf(dv))
|
||||
|
||||
// TESTING
|
||||
|
||||
|
@ -358,20 +340,11 @@ class AddRelationTagValueTest {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer)
|
||||
)
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
blocks = listOf(dv),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
state.value = ObjectState.DataView.Set(blocks = listOf(dv))
|
||||
|
||||
// TESTING
|
||||
|
||||
|
@ -458,20 +431,11 @@ class AddRelationTagValueTest {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer)
|
||||
)
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
blocks = listOf(dv),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
state.value = ObjectState.DataView.Set(blocks = listOf(dv))
|
||||
|
||||
// TESTING
|
||||
|
||||
|
|
|
@ -22,12 +22,11 @@ import com.anytypeio.anytype.domain.objects.DefaultObjectStore
|
|||
import com.anytypeio.anytype.domain.objects.DefaultStoreOfRelations
|
||||
import com.anytypeio.anytype.domain.objects.ObjectStore
|
||||
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
||||
import com.anytypeio.anytype.presentation.relations.ObjectSetConfig
|
||||
import com.anytypeio.anytype.presentation.relations.providers.DataViewObjectRelationProvider
|
||||
import com.anytypeio.anytype.presentation.relations.providers.DataViewObjectValueProvider
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
||||
import com.anytypeio.anytype.presentation.sets.RelationTextValueViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.test_utils.MockDataFactory
|
||||
import com.anytypeio.anytype.test_utils.utils.espresso.TextLineCountMatcher
|
||||
import com.anytypeio.anytype.ui.relations.RelationTextValueFragment
|
||||
|
@ -60,7 +59,7 @@ class DisplayObjectRelationTextValueTest {
|
|||
|
||||
val root = MockDataFactory.randomUuid()
|
||||
|
||||
private val state = MutableStateFlow(ObjectSet.init())
|
||||
private val state: MutableStateFlow<ObjectState> = MutableStateFlow(ObjectState.Init)
|
||||
private val store: ObjectStore = DefaultObjectStore()
|
||||
private val storeOfRelations: StoreOfRelations = DefaultStoreOfRelations()
|
||||
private val db = ObjectSetDatabase(store = store)
|
||||
|
@ -70,7 +69,7 @@ class DisplayObjectRelationTextValueTest {
|
|||
MockitoAnnotations.openMocks(this)
|
||||
TestRelationTextValueFragment.testVmFactory = RelationTextValueViewModel.Factory(
|
||||
relations = DataViewObjectRelationProvider(
|
||||
objectSetState = state,
|
||||
objectState = state,
|
||||
storeOfRelations = storeOfRelations
|
||||
),
|
||||
values = DataViewObjectValueProvider(db = db),
|
||||
|
@ -105,29 +104,17 @@ class DisplayObjectRelationTextValueTest {
|
|||
source = Relation.Source.values().random()
|
||||
)
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relation.key to valueText
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer)
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
launchFragment(
|
||||
|
@ -180,29 +167,17 @@ class DisplayObjectRelationTextValueTest {
|
|||
source = Relation.Source.values().random()
|
||||
)
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relation.key to valueText
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer)
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
// TESTING
|
||||
|
@ -257,29 +232,17 @@ class DisplayObjectRelationTextValueTest {
|
|||
source = Relation.Source.values().random()
|
||||
)
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relation.key to valueText
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer)
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
// TESTING
|
||||
|
@ -334,29 +297,17 @@ class DisplayObjectRelationTextValueTest {
|
|||
source = Relation.Source.values().random()
|
||||
)
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relation.key to valueText
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer)
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
launchFragment(
|
||||
|
@ -409,29 +360,17 @@ class DisplayObjectRelationTextValueTest {
|
|||
source = Relation.Source.values().random()
|
||||
)
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relation.key to valueText
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer)
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
launchFragment(
|
||||
|
@ -485,30 +424,18 @@ class DisplayObjectRelationTextValueTest {
|
|||
source = Relation.Source.values().random()
|
||||
)
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relation.key to valueText
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
launchFragment(
|
||||
|
|
|
@ -13,7 +13,6 @@ import com.anytypeio.anytype.R
|
|||
import com.anytypeio.anytype.analytics.base.Analytics
|
||||
import com.anytypeio.anytype.core_models.Block
|
||||
import com.anytypeio.anytype.core_models.Payload
|
||||
import com.anytypeio.anytype.core_models.Relation
|
||||
import com.anytypeio.anytype.domain.`object`.ReloadObject
|
||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||
import com.anytypeio.anytype.domain.config.Gateway
|
||||
|
@ -21,12 +20,11 @@ import com.anytypeio.anytype.domain.objects.DefaultObjectStore
|
|||
import com.anytypeio.anytype.domain.objects.DefaultStoreOfRelations
|
||||
import com.anytypeio.anytype.domain.objects.ObjectStore
|
||||
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
||||
import com.anytypeio.anytype.presentation.relations.ObjectSetConfig
|
||||
import com.anytypeio.anytype.presentation.relations.providers.DataViewObjectRelationProvider
|
||||
import com.anytypeio.anytype.presentation.relations.providers.DataViewObjectValueProvider
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
||||
import com.anytypeio.anytype.presentation.sets.RelationTextValueViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.test_utils.MockDataFactory
|
||||
import com.anytypeio.anytype.test_utils.utils.TestUtils
|
||||
|
@ -68,7 +66,7 @@ class DisplayRelationNumberValueTest {
|
|||
val coroutineTestRule = CoroutinesTestRule()
|
||||
|
||||
private val root = MockDataFactory.randomUuid()
|
||||
private val state = MutableStateFlow(ObjectSet.init())
|
||||
private val state: MutableStateFlow<ObjectState> = MutableStateFlow(ObjectState.Init)
|
||||
private val store: ObjectStore = DefaultObjectStore()
|
||||
private val storeOfRelations: StoreOfRelations = DefaultStoreOfRelations()
|
||||
private val db = ObjectSetDatabase(store = store)
|
||||
|
@ -78,7 +76,7 @@ class DisplayRelationNumberValueTest {
|
|||
MockitoAnnotations.openMocks(this)
|
||||
TestRelationTextValueFragment.testVmFactory = RelationTextValueViewModel.Factory(
|
||||
relations = DataViewObjectRelationProvider(
|
||||
objectSetState = state,
|
||||
objectState = state,
|
||||
storeOfRelations = storeOfRelations
|
||||
),
|
||||
values = DataViewObjectValueProvider(db = db),
|
||||
|
@ -94,13 +92,6 @@ class DisplayRelationNumberValueTest {
|
|||
|
||||
val relationKey = MockDataFactory.randomUuid()
|
||||
val target = MockDataFactory.randomUuid()
|
||||
val relationText = "Number"
|
||||
val valueText = 345.09
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relationKey to valueText
|
||||
)
|
||||
|
||||
val viewer = Block.Content.DataView.Viewer(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
|
@ -111,32 +102,18 @@ class DisplayRelationNumberValueTest {
|
|||
type = Block.Content.DataView.Viewer.Type.GRID
|
||||
)
|
||||
|
||||
val relation = Relation(
|
||||
key = relationKey,
|
||||
name = relationText,
|
||||
source = Relation.Source.values().random(),
|
||||
format = Relation.Format.NUMBER
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
// TESTING
|
||||
|
@ -165,13 +142,6 @@ class DisplayRelationNumberValueTest {
|
|||
|
||||
val relationKey = MockDataFactory.randomUuid()
|
||||
val target = MockDataFactory.randomUuid()
|
||||
val relationText = "Number"
|
||||
val valueText = 345.0
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relationKey to valueText
|
||||
)
|
||||
|
||||
val viewer = Block.Content.DataView.Viewer(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
|
@ -182,32 +152,18 @@ class DisplayRelationNumberValueTest {
|
|||
type = Block.Content.DataView.Viewer.Type.GRID
|
||||
)
|
||||
|
||||
val relation = Relation(
|
||||
key = relationKey,
|
||||
name = relationText,
|
||||
source = Relation.Source.values().random(),
|
||||
format = Relation.Format.NUMBER
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
// TESTING
|
||||
|
@ -236,13 +192,6 @@ class DisplayRelationNumberValueTest {
|
|||
|
||||
val relationKey = MockDataFactory.randomUuid()
|
||||
val target = MockDataFactory.randomUuid()
|
||||
val relationText = "Number"
|
||||
val valueText = null
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relationKey to valueText
|
||||
)
|
||||
|
||||
val viewer = Block.Content.DataView.Viewer(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
|
@ -253,32 +202,18 @@ class DisplayRelationNumberValueTest {
|
|||
type = Block.Content.DataView.Viewer.Type.GRID
|
||||
)
|
||||
|
||||
val relation = Relation(
|
||||
key = relationKey,
|
||||
name = relationText,
|
||||
source = Relation.Source.values().random(),
|
||||
format = Relation.Format.NUMBER
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
// TESTING
|
||||
|
|
|
@ -17,9 +17,6 @@ import com.anytypeio.anytype.core_models.Block
|
|||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.ObjectType
|
||||
import com.anytypeio.anytype.core_models.Payload
|
||||
import com.anytypeio.anytype.core_models.Relation
|
||||
import com.anytypeio.anytype.core_models.StubRelationOptionObject
|
||||
import com.anytypeio.anytype.core_models.ThemeColor
|
||||
import com.anytypeio.anytype.domain.`object`.UpdateDetail
|
||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||
import com.anytypeio.anytype.domain.config.Gateway
|
||||
|
@ -35,9 +32,10 @@ import com.anytypeio.anytype.presentation.relations.ObjectSetConfig
|
|||
import com.anytypeio.anytype.presentation.relations.providers.DataViewObjectRelationProvider
|
||||
import com.anytypeio.anytype.presentation.relations.providers.DataViewObjectValueProvider
|
||||
import com.anytypeio.anytype.presentation.relations.providers.ObjectDetailProvider
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
||||
import com.anytypeio.anytype.presentation.sets.RelationValueDVViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.dataViewState
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.CopyFileToCacheDirectory
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.test_utils.MockDataFactory
|
||||
|
@ -56,11 +54,6 @@ import org.junit.Test
|
|||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
import org.mockito.MockitoAnnotations
|
||||
import org.mockito.kotlin.any
|
||||
import org.mockito.kotlin.doReturn
|
||||
import org.mockito.kotlin.stub
|
||||
import org.mockito.kotlin.times
|
||||
import org.mockito.kotlin.verifyBlocking
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@LargeTest
|
||||
|
@ -92,7 +85,7 @@ class DisplayRelationObjectValueTest {
|
|||
val coroutineTestRule = CoroutinesTestRule()
|
||||
|
||||
private val root = MockDataFactory.randomUuid()
|
||||
private val state = MutableStateFlow(ObjectSet.init())
|
||||
private val state: MutableStateFlow<ObjectState> = MutableStateFlow(ObjectState.Init)
|
||||
private val store: ObjectStore = DefaultObjectStore()
|
||||
private val storeOfRelations: StoreOfRelations = DefaultStoreOfRelations()
|
||||
private val storeOfObjectTypes: StoreOfObjectTypes = DefaultStoreOfObjectTypes()
|
||||
|
@ -106,12 +99,13 @@ class DisplayRelationObjectValueTest {
|
|||
urlBuilder = UrlBuilder(gateway)
|
||||
TestRelationValueDVFragment.testVmFactory = RelationValueDVViewModel.Factory(
|
||||
relations = DataViewObjectRelationProvider(
|
||||
objectSetState = state,
|
||||
objectState = state,
|
||||
storeOfRelations = storeOfRelations
|
||||
),
|
||||
values = DataViewObjectValueProvider(db = db),
|
||||
details = object: ObjectDetailProvider {
|
||||
override fun provide(): Map<Id, Block.Fields> = state.value.details
|
||||
details = object : ObjectDetailProvider {
|
||||
override fun provide(): Map<Id, Block.Fields> =
|
||||
state.value.dataViewState()?.details.orEmpty()
|
||||
},
|
||||
urlBuilder = urlBuilder,
|
||||
copyFileToCache = copyFileToCacheDirectory,
|
||||
|
@ -144,33 +138,18 @@ class DisplayRelationObjectValueTest {
|
|||
type = Block.Content.DataView.Viewer.Type.GRID
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(
|
||||
Relation(
|
||||
key = relation,
|
||||
isMulti = true,
|
||||
name = MockDataFactory.randomString(),
|
||||
format = Relation.Format.OBJECT,
|
||||
source = Relation.Source.values().random()
|
||||
)
|
||||
),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
// TESTING
|
||||
|
@ -219,33 +198,18 @@ class DisplayRelationObjectValueTest {
|
|||
type = Block.Content.DataView.Viewer.Type.GRID
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(
|
||||
Relation(
|
||||
key = relation,
|
||||
isMulti = true,
|
||||
name = name,
|
||||
format = Relation.Format.OBJECT,
|
||||
source = Relation.Source.values().random()
|
||||
)
|
||||
),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
// TESTING
|
||||
|
@ -271,16 +235,9 @@ class DisplayRelationObjectValueTest {
|
|||
|
||||
// SETUP
|
||||
|
||||
val name = "Object"
|
||||
|
||||
val relationId = MockDataFactory.randomUuid()
|
||||
val targetId = MockDataFactory.randomUuid()
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to targetId,
|
||||
relationId to emptyList<Id>()
|
||||
)
|
||||
|
||||
val viewer = Block.Content.DataView.Viewer(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
name = MockDataFactory.randomString(),
|
||||
|
@ -290,32 +247,18 @@ class DisplayRelationObjectValueTest {
|
|||
type = Block.Content.DataView.Viewer.Type.GRID
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(
|
||||
Relation(
|
||||
key = relationId,
|
||||
name = name,
|
||||
format = Relation.Format.OBJECT,
|
||||
source = Relation.Source.values().random()
|
||||
)
|
||||
),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
// TESTING
|
||||
|
@ -376,11 +319,6 @@ class DisplayRelationObjectValueTest {
|
|||
val relationId = MockDataFactory.randomUuid()
|
||||
val recordId = MockDataFactory.randomUuid()
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to recordId,
|
||||
relationId to listOf(object1Id, object2Id)
|
||||
)
|
||||
|
||||
val viewer = Block.Content.DataView.Viewer(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
name = MockDataFactory.randomString(),
|
||||
|
@ -390,32 +328,18 @@ class DisplayRelationObjectValueTest {
|
|||
type = Block.Content.DataView.Viewer.Type.GRID
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(
|
||||
Relation(
|
||||
key = relationId,
|
||||
name = relationName,
|
||||
format = Relation.Format.OBJECT,
|
||||
source = Relation.Source.values().random()
|
||||
)
|
||||
),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// ),
|
||||
details = mapOf(
|
||||
object1Id to Block.Fields(
|
||||
mapOf(
|
||||
|
@ -495,7 +419,6 @@ class DisplayRelationObjectValueTest {
|
|||
isReadOnly = false
|
||||
)
|
||||
|
||||
val relationName = "Cast"
|
||||
val object1Name = "Charlie Chaplin"
|
||||
val object1Id = MockDataFactory.randomUuid()
|
||||
val object2Name = "Jean-Pierre Léaud"
|
||||
|
@ -504,11 +427,6 @@ class DisplayRelationObjectValueTest {
|
|||
val relationId = MockDataFactory.randomUuid()
|
||||
val recordId = MockDataFactory.randomUuid()
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to recordId,
|
||||
relationId to listOf(object1Id, object2Id)
|
||||
)
|
||||
|
||||
val viewer = Block.Content.DataView.Viewer(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
name = MockDataFactory.randomString(),
|
||||
|
@ -518,32 +436,18 @@ class DisplayRelationObjectValueTest {
|
|||
type = Block.Content.DataView.Viewer.Type.GRID
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(
|
||||
Relation(
|
||||
key = relationId,
|
||||
name = relationName,
|
||||
format = Relation.Format.OBJECT,
|
||||
source = Relation.Source.values().random()
|
||||
)
|
||||
),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// ),
|
||||
details = mapOf(
|
||||
object1Id to Block.Fields(
|
||||
mapOf(
|
||||
|
@ -587,7 +491,6 @@ class DisplayRelationObjectValueTest {
|
|||
|
||||
// SETUP
|
||||
|
||||
val relationName = "Writers"
|
||||
val object1Name = "Virginia Woolf"
|
||||
val object1Id = MockDataFactory.randomUuid()
|
||||
val object2Name = "Réné-Auguste Chateaubriand"
|
||||
|
@ -622,11 +525,6 @@ class DisplayRelationObjectValueTest {
|
|||
val relationId = MockDataFactory.randomUuid()
|
||||
val recordId = MockDataFactory.randomUuid()
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to recordId,
|
||||
relationId to listOf(object1Id, object2Id)
|
||||
)
|
||||
|
||||
val viewer = Block.Content.DataView.Viewer(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
name = MockDataFactory.randomString(),
|
||||
|
@ -636,32 +534,18 @@ class DisplayRelationObjectValueTest {
|
|||
type = Block.Content.DataView.Viewer.Type.GRID
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(
|
||||
Relation(
|
||||
key = relationId,
|
||||
name = relationName,
|
||||
format = Relation.Format.OBJECT,
|
||||
source = Relation.Source.values().random()
|
||||
)
|
||||
),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// ),
|
||||
details = mapOf(
|
||||
object1Id to Block.Fields(
|
||||
mapOf(
|
||||
|
@ -701,39 +585,9 @@ class DisplayRelationObjectValueTest {
|
|||
}
|
||||
|
||||
private fun launchFragment(args: Bundle): FragmentScenario<TestRelationValueDVFragment> {
|
||||
return launchFragmentInContainer<TestRelationValueDVFragment>(
|
||||
return launchFragmentInContainer(
|
||||
fragmentArgs = args,
|
||||
themeResId = R.style.AppTheme
|
||||
)
|
||||
}
|
||||
|
||||
private fun verifyCreateRelationOptionCalled() {
|
||||
verifyBlocking(repo, times(1)) {
|
||||
createRelationOption(
|
||||
relation = any(),
|
||||
color = any(),
|
||||
name = any()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun stubCreateRelationOption(
|
||||
name: String = MockDataFactory.randomString(),
|
||||
id: Id = MockDataFactory.randomUuid(),
|
||||
color: String = ThemeColor.values().random().code
|
||||
) {
|
||||
repo.stub {
|
||||
onBlocking {
|
||||
createRelationOption(
|
||||
relation = any(),
|
||||
color = any(),
|
||||
name = any()
|
||||
)
|
||||
} doReturn StubRelationOptionObject(
|
||||
id = id,
|
||||
color = color,
|
||||
text = name
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -30,13 +30,13 @@ import com.anytypeio.anytype.domain.objects.ObjectStore
|
|||
import com.anytypeio.anytype.domain.objects.StoreOfObjectTypes
|
||||
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
||||
import com.anytypeio.anytype.domain.relations.AddFileToObject
|
||||
import com.anytypeio.anytype.presentation.relations.ObjectSetConfig
|
||||
import com.anytypeio.anytype.presentation.relations.providers.DataViewObjectRelationProvider
|
||||
import com.anytypeio.anytype.presentation.relations.providers.DataViewObjectValueProvider
|
||||
import com.anytypeio.anytype.presentation.relations.providers.ObjectDetailProvider
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
||||
import com.anytypeio.anytype.presentation.sets.RelationValueDVViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.dataViewState
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.CopyFileToCacheDirectory
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.test_utils.MockDataFactory
|
||||
|
@ -86,7 +86,7 @@ class DisplayRelationStatusValueTest {
|
|||
val coroutineTestRule = CoroutinesTestRule()
|
||||
|
||||
private val root = MockDataFactory.randomUuid()
|
||||
private val state = MutableStateFlow(ObjectSet.init())
|
||||
private val state: MutableStateFlow<ObjectState> = MutableStateFlow(ObjectState.Init)
|
||||
private val store: ObjectStore = DefaultObjectStore()
|
||||
private val storeOfRelations: StoreOfRelations = DefaultStoreOfRelations()
|
||||
private val storeOfObjectTypes: StoreOfObjectTypes = DefaultStoreOfObjectTypes()
|
||||
|
@ -100,14 +100,15 @@ class DisplayRelationStatusValueTest {
|
|||
urlBuilder = UrlBuilder(gateway)
|
||||
TestRelationValueDVFragment.testVmFactory = RelationValueDVViewModel.Factory(
|
||||
relations = DataViewObjectRelationProvider(
|
||||
objectSetState = state,
|
||||
objectState = state,
|
||||
storeOfRelations = storeOfRelations
|
||||
),
|
||||
values = DataViewObjectValueProvider(
|
||||
db = db
|
||||
),
|
||||
details = object : ObjectDetailProvider {
|
||||
override fun provide(): Map<Id, Block.Fields> = state.value.details
|
||||
override fun provide(): Map<Id, Block.Fields> =
|
||||
state.value.dataViewState()?.details.orEmpty()
|
||||
},
|
||||
urlBuilder = urlBuilder,
|
||||
copyFileToCache = copyFileToCacheDirectory,
|
||||
|
@ -126,10 +127,6 @@ class DisplayRelationStatusValueTest {
|
|||
val relation = MockDataFactory.randomUuid()
|
||||
val target = MockDataFactory.randomUuid()
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target
|
||||
)
|
||||
|
||||
val viewer = Block.Content.DataView.Viewer(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
name = MockDataFactory.randomString(),
|
||||
|
@ -139,33 +136,18 @@ class DisplayRelationStatusValueTest {
|
|||
type = Block.Content.DataView.Viewer.Type.GRID
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(
|
||||
Relation(
|
||||
key = relation,
|
||||
isMulti = true,
|
||||
name = MockDataFactory.randomString(),
|
||||
format = Relation.Format.STATUS,
|
||||
source = Relation.Source.values().random()
|
||||
)
|
||||
),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
// TESTING
|
||||
|
@ -199,10 +181,6 @@ class DisplayRelationStatusValueTest {
|
|||
val relation = MockDataFactory.randomUuid()
|
||||
val target = MockDataFactory.randomUuid()
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target
|
||||
)
|
||||
|
||||
val viewer = Block.Content.DataView.Viewer(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
name = MockDataFactory.randomString(),
|
||||
|
@ -212,33 +190,18 @@ class DisplayRelationStatusValueTest {
|
|||
type = Block.Content.DataView.Viewer.Type.GRID
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(
|
||||
Relation(
|
||||
key = relation,
|
||||
isMulti = true,
|
||||
name = name,
|
||||
format = Relation.Format.STATUS,
|
||||
source = Relation.Source.values().random()
|
||||
)
|
||||
),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
// TESTING
|
||||
|
@ -263,35 +226,17 @@ class DisplayRelationStatusValueTest {
|
|||
|
||||
// SETUP
|
||||
|
||||
val option1Color = ThemeColor.values().random()
|
||||
val option2Color = ThemeColor.values().random()
|
||||
|
||||
val option1 = Relation.Option(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
text = "In progress",
|
||||
color = option1Color.code
|
||||
)
|
||||
|
||||
val option2 = Relation.Option(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
text = "Done",
|
||||
color = option2Color.code
|
||||
)
|
||||
|
||||
val option3 = Relation.Option(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
text = "Todo",
|
||||
color = ""
|
||||
)
|
||||
|
||||
val relationKey = MockDataFactory.randomUuid()
|
||||
val target = MockDataFactory.randomUuid()
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relationKey to listOf(option2.id)
|
||||
)
|
||||
|
||||
val viewer = Block.Content.DataView.Viewer(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
name = MockDataFactory.randomString(),
|
||||
|
@ -301,37 +246,18 @@ class DisplayRelationStatusValueTest {
|
|||
type = Block.Content.DataView.Viewer.Type.GRID
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(
|
||||
Relation(
|
||||
key = relationKey,
|
||||
defaultValue = null,
|
||||
isHidden = false,
|
||||
isReadOnly = false,
|
||||
isMulti = true,
|
||||
name = MockDataFactory.randomString(),
|
||||
source = Relation.Source.values().random(),
|
||||
format = Relation.Format.STATUS,
|
||||
selections = listOf(option1, option2, option3)
|
||||
)
|
||||
),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
// TESTING
|
||||
|
@ -357,20 +283,9 @@ class DisplayRelationStatusValueTest {
|
|||
|
||||
// SETUP
|
||||
|
||||
val option1 = Relation.Option(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
text = "In progress",
|
||||
color = ""
|
||||
)
|
||||
|
||||
val relationKey = MockDataFactory.randomUuid()
|
||||
val target = MockDataFactory.randomUuid()
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relationKey to listOf(option1.id)
|
||||
)
|
||||
|
||||
val viewer = Block.Content.DataView.Viewer(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
name = MockDataFactory.randomString(),
|
||||
|
@ -380,37 +295,18 @@ class DisplayRelationStatusValueTest {
|
|||
type = Block.Content.DataView.Viewer.Type.GRID
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(
|
||||
Relation(
|
||||
key = relationKey,
|
||||
defaultValue = null,
|
||||
isHidden = false,
|
||||
isReadOnly = false,
|
||||
isMulti = true,
|
||||
name = MockDataFactory.randomString(),
|
||||
source = Relation.Source.values().random(),
|
||||
format = Relation.Format.STATUS,
|
||||
selections = listOf(option1)
|
||||
)
|
||||
),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
// TESTING
|
||||
|
@ -435,31 +331,9 @@ class DisplayRelationStatusValueTest {
|
|||
|
||||
// SETUP
|
||||
|
||||
val option1 = Relation.Option(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
text = "In progress",
|
||||
color = MockDataFactory.randomString()
|
||||
)
|
||||
|
||||
val option2 = Relation.Option(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
text = "Done",
|
||||
color = MockDataFactory.randomString()
|
||||
)
|
||||
|
||||
val option3 = Relation.Option(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
text = "Todo",
|
||||
color = MockDataFactory.randomString()
|
||||
)
|
||||
|
||||
val relationKey = MockDataFactory.randomUuid()
|
||||
val target = MockDataFactory.randomUuid()
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target
|
||||
)
|
||||
|
||||
val viewer = Block.Content.DataView.Viewer(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
name = MockDataFactory.randomString(),
|
||||
|
@ -469,37 +343,18 @@ class DisplayRelationStatusValueTest {
|
|||
type = Block.Content.DataView.Viewer.Type.GRID
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(
|
||||
Relation(
|
||||
key = relationKey,
|
||||
defaultValue = null,
|
||||
isHidden = false,
|
||||
isReadOnly = false,
|
||||
isMulti = true,
|
||||
name = MockDataFactory.randomString(),
|
||||
source = Relation.Source.values().random(),
|
||||
format = Relation.Format.STATUS,
|
||||
selections = listOf(option1, option2, option3)
|
||||
)
|
||||
),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
// TESTING
|
||||
|
|
|
@ -30,13 +30,13 @@ import com.anytypeio.anytype.domain.objects.ObjectStore
|
|||
import com.anytypeio.anytype.domain.objects.StoreOfObjectTypes
|
||||
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
||||
import com.anytypeio.anytype.domain.relations.AddFileToObject
|
||||
import com.anytypeio.anytype.presentation.relations.ObjectSetConfig
|
||||
import com.anytypeio.anytype.presentation.relations.providers.DataViewObjectRelationProvider
|
||||
import com.anytypeio.anytype.presentation.relations.providers.DataViewObjectValueProvider
|
||||
import com.anytypeio.anytype.presentation.relations.providers.ObjectDetailProvider
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
||||
import com.anytypeio.anytype.presentation.sets.RelationValueDVViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.dataViewState
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.CopyFileToCacheDirectory
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.test_utils.MockDataFactory
|
||||
|
@ -86,7 +86,7 @@ class DisplayRelationTagValueTest {
|
|||
val coroutineTestRule = CoroutinesTestRule()
|
||||
|
||||
private val root = MockDataFactory.randomUuid()
|
||||
private val state = MutableStateFlow(ObjectSet.init())
|
||||
private val state: MutableStateFlow<ObjectState> = MutableStateFlow(ObjectState.Init)
|
||||
private val store: ObjectStore = DefaultObjectStore()
|
||||
private val storeOfRelations: StoreOfRelations = DefaultStoreOfRelations()
|
||||
private val db = ObjectSetDatabase(store)
|
||||
|
@ -100,12 +100,13 @@ class DisplayRelationTagValueTest {
|
|||
urlBuilder = UrlBuilder(gateway)
|
||||
TestRelationValueDVFragment.testVmFactory = RelationValueDVViewModel.Factory(
|
||||
relations = DataViewObjectRelationProvider(
|
||||
objectSetState = state,
|
||||
objectState = state,
|
||||
storeOfRelations = storeOfRelations
|
||||
),
|
||||
values = DataViewObjectValueProvider(db = db),
|
||||
details = object: ObjectDetailProvider {
|
||||
override fun provide(): Map<Id, Block.Fields> = state.value.details
|
||||
details = object : ObjectDetailProvider {
|
||||
override fun provide(): Map<Id, Block.Fields> =
|
||||
state.value.dataViewState()?.details.orEmpty()
|
||||
},
|
||||
urlBuilder = urlBuilder,
|
||||
copyFileToCache = copyFileToCacheDirectory,
|
||||
|
@ -124,10 +125,6 @@ class DisplayRelationTagValueTest {
|
|||
val relation = MockDataFactory.randomUuid()
|
||||
val target = MockDataFactory.randomUuid()
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target
|
||||
)
|
||||
|
||||
val viewer = Block.Content.DataView.Viewer(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
name = MockDataFactory.randomString(),
|
||||
|
@ -137,33 +134,18 @@ class DisplayRelationTagValueTest {
|
|||
type = Block.Content.DataView.Viewer.Type.GRID
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(
|
||||
Relation(
|
||||
key = relation,
|
||||
isMulti = true,
|
||||
name = MockDataFactory.randomString(),
|
||||
format = Relation.Format.TAG,
|
||||
source = Relation.Source.values().random()
|
||||
)
|
||||
),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
// TESTING
|
||||
|
@ -197,10 +179,6 @@ class DisplayRelationTagValueTest {
|
|||
val relation = MockDataFactory.randomUuid()
|
||||
val target = MockDataFactory.randomUuid()
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target
|
||||
)
|
||||
|
||||
val viewer = Block.Content.DataView.Viewer(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
name = MockDataFactory.randomString(),
|
||||
|
@ -210,33 +188,18 @@ class DisplayRelationTagValueTest {
|
|||
type = Block.Content.DataView.Viewer.Type.GRID
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(
|
||||
Relation(
|
||||
key = relation,
|
||||
isMulti = true,
|
||||
name = name,
|
||||
format = Relation.Format.TAG,
|
||||
source = Relation.Source.values().random()
|
||||
)
|
||||
),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
// TESTING
|
||||
|
@ -261,15 +224,8 @@ class DisplayRelationTagValueTest {
|
|||
|
||||
// SETUP
|
||||
|
||||
val option1Color = ThemeColor.values().random()
|
||||
val option2Color = ThemeColor.values().random()
|
||||
|
||||
val option1 = Relation.Option(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
text = "Architect",
|
||||
color = option1Color.code
|
||||
)
|
||||
|
||||
val option2 = Relation.Option(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
text = "Manager",
|
||||
|
@ -285,11 +241,6 @@ class DisplayRelationTagValueTest {
|
|||
val relationKey = MockDataFactory.randomUuid()
|
||||
val target = MockDataFactory.randomUuid()
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relationKey to listOf(option2.id, option3.id)
|
||||
)
|
||||
|
||||
val viewer = Block.Content.DataView.Viewer(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
name = MockDataFactory.randomString(),
|
||||
|
@ -299,37 +250,18 @@ class DisplayRelationTagValueTest {
|
|||
type = Block.Content.DataView.Viewer.Type.GRID
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(
|
||||
Relation(
|
||||
key = relationKey,
|
||||
defaultValue = null,
|
||||
isHidden = false,
|
||||
isReadOnly = false,
|
||||
isMulti = true,
|
||||
name = MockDataFactory.randomString(),
|
||||
source = Relation.Source.values().random(),
|
||||
format = Relation.Format.TAG,
|
||||
selections = listOf(option1, option2, option3)
|
||||
)
|
||||
),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
// TESTING
|
||||
|
@ -364,20 +296,9 @@ class DisplayRelationTagValueTest {
|
|||
|
||||
// SETUP
|
||||
|
||||
val option1 = Relation.Option(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
text = "Architect",
|
||||
color = ""
|
||||
)
|
||||
|
||||
val relationKey = MockDataFactory.randomUuid()
|
||||
val target = MockDataFactory.randomUuid()
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relationKey to listOf(option1.id)
|
||||
)
|
||||
|
||||
val viewer = Block.Content.DataView.Viewer(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
name = MockDataFactory.randomString(),
|
||||
|
@ -387,37 +308,18 @@ class DisplayRelationTagValueTest {
|
|||
type = Block.Content.DataView.Viewer.Type.GRID
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(
|
||||
Relation(
|
||||
key = relationKey,
|
||||
defaultValue = null,
|
||||
isHidden = false,
|
||||
isReadOnly = false,
|
||||
isMulti = true,
|
||||
name = MockDataFactory.randomString(),
|
||||
source = Relation.Source.values().random(),
|
||||
format = Relation.Format.TAG,
|
||||
selections = listOf(option1)
|
||||
)
|
||||
),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
// TESTING
|
||||
|
@ -442,31 +344,9 @@ class DisplayRelationTagValueTest {
|
|||
|
||||
// SETUP
|
||||
|
||||
val option1 = Relation.Option(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
text = "TAG1",
|
||||
color = MockDataFactory.randomString()
|
||||
)
|
||||
|
||||
val option2 = Relation.Option(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
text = "TAG 2",
|
||||
color = MockDataFactory.randomString()
|
||||
)
|
||||
|
||||
val option3 = Relation.Option(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
text = "TAG 3",
|
||||
color = MockDataFactory.randomString()
|
||||
)
|
||||
|
||||
val relationKey = MockDataFactory.randomUuid()
|
||||
val target = MockDataFactory.randomUuid()
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target
|
||||
)
|
||||
|
||||
val viewer = Block.Content.DataView.Viewer(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
name = MockDataFactory.randomString(),
|
||||
|
@ -476,37 +356,18 @@ class DisplayRelationTagValueTest {
|
|||
type = Block.Content.DataView.Viewer.Type.GRID
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(
|
||||
Relation(
|
||||
key = relationKey,
|
||||
defaultValue = null,
|
||||
isHidden = false,
|
||||
isReadOnly = false,
|
||||
isMulti = true,
|
||||
name = MockDataFactory.randomString(),
|
||||
source = Relation.Source.values().random(),
|
||||
format = Relation.Format.TAG,
|
||||
selections = listOf(option1, option2, option3)
|
||||
)
|
||||
),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
// TESTING
|
||||
|
|
|
@ -25,13 +25,13 @@ import com.anytypeio.anytype.domain.objects.ObjectStore
|
|||
import com.anytypeio.anytype.domain.objects.StoreOfObjectTypes
|
||||
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
||||
import com.anytypeio.anytype.domain.relations.AddFileToObject
|
||||
import com.anytypeio.anytype.presentation.relations.ObjectSetConfig
|
||||
import com.anytypeio.anytype.presentation.relations.providers.DataViewObjectRelationProvider
|
||||
import com.anytypeio.anytype.presentation.relations.providers.DataViewObjectValueProvider
|
||||
import com.anytypeio.anytype.presentation.relations.providers.ObjectDetailProvider
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
||||
import com.anytypeio.anytype.presentation.sets.RelationValueDVViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.dataViewState
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.CopyFileToCacheDirectory
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.test_utils.MockDataFactory
|
||||
|
@ -88,7 +88,7 @@ class EditRelationTagValueTest {
|
|||
val coroutineTestRule = CoroutinesTestRule()
|
||||
|
||||
private val ctx = MockDataFactory.randomUuid()
|
||||
private val state = MutableStateFlow(ObjectSet.init())
|
||||
private val state: MutableStateFlow<ObjectState> = MutableStateFlow(ObjectState.Init)
|
||||
private val store: ObjectStore = DefaultObjectStore()
|
||||
private val storeOfRelations: StoreOfRelations = DefaultStoreOfRelations()
|
||||
private val db = ObjectSetDatabase(store = store)
|
||||
|
@ -102,12 +102,13 @@ class EditRelationTagValueTest {
|
|||
addFileToObject = AddFileToObject(repo)
|
||||
TestRelationValueDVFragment.testVmFactory = RelationValueDVViewModel.Factory(
|
||||
relations = DataViewObjectRelationProvider(
|
||||
objectSetState = state,
|
||||
objectState = state,
|
||||
storeOfRelations = storeOfRelations
|
||||
),
|
||||
values = DataViewObjectValueProvider(db = db),
|
||||
details = object : ObjectDetailProvider {
|
||||
override fun provide(): Map<Id, Block.Fields> = state.value.details
|
||||
override fun provide(): Map<Id, Block.Fields> =
|
||||
state.value.dataViewState()?.details.orEmpty()
|
||||
},
|
||||
urlBuilder = urlBuilder,
|
||||
copyFileToCache = copyFileToCacheDirectory,
|
||||
|
@ -127,12 +128,6 @@ class EditRelationTagValueTest {
|
|||
val option1Color = ThemeColor.values().random()
|
||||
val option2Color = ThemeColor.values().random()
|
||||
|
||||
val option1 = Relation.Option(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
text = "Architect",
|
||||
color = option1Color.code
|
||||
)
|
||||
|
||||
val option2 = Relation.Option(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
text = "Manager",
|
||||
|
@ -148,11 +143,6 @@ class EditRelationTagValueTest {
|
|||
val relationKey = MockDataFactory.randomUuid()
|
||||
val target = MockDataFactory.randomUuid()
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relationKey to listOf(option2.id, option3.id)
|
||||
)
|
||||
|
||||
val viewer = Block.Content.DataView.Viewer(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
name = MockDataFactory.randomString(),
|
||||
|
@ -162,37 +152,18 @@ class EditRelationTagValueTest {
|
|||
type = Block.Content.DataView.Viewer.Type.GRID
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(
|
||||
Relation(
|
||||
key = relationKey,
|
||||
defaultValue = null,
|
||||
isHidden = false,
|
||||
isReadOnly = false,
|
||||
isMulti = true,
|
||||
name = "Roles",
|
||||
source = Relation.Source.values().random(),
|
||||
format = Relation.Format.TAG,
|
||||
selections = listOf(option1, option2, option3)
|
||||
)
|
||||
),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
// TESTING
|
||||
|
@ -245,32 +216,15 @@ class EditRelationTagValueTest {
|
|||
val option1Color = ThemeColor.values().random()
|
||||
val option2Color = ThemeColor.values().random()
|
||||
|
||||
val option1 = Relation.Option(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
text = "Architect",
|
||||
color = option1Color.code
|
||||
)
|
||||
|
||||
val option2 = Relation.Option(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
text = "Manager",
|
||||
color = option2Color.code
|
||||
)
|
||||
|
||||
val option3 = Relation.Option(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
text = "Developer",
|
||||
color = ""
|
||||
)
|
||||
|
||||
val relationKey = MockDataFactory.randomUuid()
|
||||
val target = MockDataFactory.randomUuid()
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relationKey to listOf(option2.id, option3.id)
|
||||
)
|
||||
|
||||
val viewer = Block.Content.DataView.Viewer(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
name = MockDataFactory.randomString(),
|
||||
|
@ -285,32 +239,13 @@ class EditRelationTagValueTest {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(
|
||||
Relation(
|
||||
key = relationKey,
|
||||
defaultValue = null,
|
||||
isHidden = false,
|
||||
isReadOnly = false,
|
||||
isMulti = true,
|
||||
name = "Roles",
|
||||
source = Relation.Source.values().random(),
|
||||
format = Relation.Format.TAG,
|
||||
selections = listOf(option1, option2, option3)
|
||||
)
|
||||
),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
blocks = listOf(dv),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(dv)
|
||||
)
|
||||
|
||||
// TESTING
|
||||
|
@ -334,7 +269,7 @@ class EditRelationTagValueTest {
|
|||
|
||||
verifyBlocking(repo, times(1)) {
|
||||
setObjectDetail(
|
||||
ctx= target,
|
||||
ctx = target,
|
||||
key = relationKey,
|
||||
value = listOf(option2.id)
|
||||
)
|
||||
|
|
|
@ -23,9 +23,9 @@ import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
|||
import com.anytypeio.anytype.presentation.relations.ObjectSetConfig
|
||||
import com.anytypeio.anytype.presentation.relations.providers.DataViewObjectRelationProvider
|
||||
import com.anytypeio.anytype.presentation.relations.providers.DataViewObjectValueProvider
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
||||
import com.anytypeio.anytype.presentation.sets.RelationDateValueViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.test_utils.MockDataFactory
|
||||
import com.anytypeio.anytype.ui.relations.RelationDateValueFragment
|
||||
import com.anytypeio.anytype.utils.CoroutinesTestRule
|
||||
|
@ -51,7 +51,7 @@ class ObjectRelationDateValueTest {
|
|||
|
||||
val root = MockDataFactory.randomUuid()
|
||||
|
||||
private val state = MutableStateFlow(ObjectSet.init())
|
||||
private val state: MutableStateFlow<ObjectState> = MutableStateFlow(ObjectState.Init)
|
||||
private val store: ObjectStore = DefaultObjectStore()
|
||||
private val db = ObjectSetDatabase(store)
|
||||
private val storeOfRelations: StoreOfRelations = DefaultStoreOfRelations()
|
||||
|
@ -61,7 +61,7 @@ class ObjectRelationDateValueTest {
|
|||
MockitoAnnotations.openMocks(this)
|
||||
TestRelationDateValueFragment.testVmFactory = RelationDateValueViewModel.Factory(
|
||||
relations = DataViewObjectRelationProvider(
|
||||
objectSetState = state,
|
||||
objectState = state,
|
||||
storeOfRelations = storeOfRelations
|
||||
),
|
||||
values = DataViewObjectValueProvider(db = db)
|
||||
|
@ -94,30 +94,18 @@ class ObjectRelationDateValueTest {
|
|||
source = Relation.Source.values().random()
|
||||
)
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relation.key to valueDate
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
launchFragment(
|
||||
|
@ -168,25 +156,18 @@ class ObjectRelationDateValueTest {
|
|||
relation.key to valueDate
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
launchFragment(
|
||||
|
@ -233,30 +214,18 @@ class ObjectRelationDateValueTest {
|
|||
source = Relation.Source.values().random()
|
||||
)
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relation.key to valueDate
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
launchFragment(
|
||||
|
@ -308,25 +277,18 @@ class ObjectRelationDateValueTest {
|
|||
relation.key to valueDate
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
launchFragment(
|
||||
|
@ -373,30 +335,18 @@ class ObjectRelationDateValueTest {
|
|||
source = Relation.Source.values().random()
|
||||
)
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relation.key to valueDate
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
launchFragment(
|
||||
|
@ -444,30 +394,18 @@ class ObjectRelationDateValueTest {
|
|||
source = Relation.Source.values().random()
|
||||
)
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relation.key to valueDate
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
val fragment = launchFragment(
|
||||
|
@ -528,30 +466,18 @@ class ObjectRelationDateValueTest {
|
|||
source = Relation.Source.values().random()
|
||||
)
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relation.key to valueDate
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
val fragment = launchFragment(
|
||||
|
|
|
@ -131,7 +131,6 @@ class ObjectSetGridColumnRenderingTest : TestObjectSetSetup() {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation1, relation2, relation3, relation4, relation5),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
|
|
|
@ -121,7 +121,6 @@ class ObjectSetGridFileCellRenderingTest : TestObjectSetSetup() {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
|
|
|
@ -106,7 +106,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
|
@ -203,7 +202,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
|
@ -300,7 +298,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
|
@ -397,7 +394,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
|
@ -494,7 +490,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
|
@ -591,7 +586,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
|
|
|
@ -120,7 +120,6 @@ class ObjectSetGridObjectCellRenderingTest : TestObjectSetSetup() {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
|
@ -237,7 +236,6 @@ class ObjectSetGridObjectCellRenderingTest : TestObjectSetSetup() {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
|
|
|
@ -171,7 +171,6 @@ class ObjectSetGridPrimitiveRelationTest : TestObjectSetSetup() {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation1, relation2, relation3, relation4, relation5),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
|
|
|
@ -132,7 +132,6 @@ class ObjectSetGridTagCellRenderingTest : TestObjectSetSetup() {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
|
|
|
@ -61,7 +61,6 @@ class ObjectSetHeaderTest : TestObjectSetSetup() {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = emptyList(),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
|
|
|
@ -19,6 +19,7 @@ import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
|||
import com.anytypeio.anytype.domain.base.Result
|
||||
import com.anytypeio.anytype.domain.block.interactor.UpdateText
|
||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||
import com.anytypeio.anytype.domain.collections.AddObjectToCollection
|
||||
import com.anytypeio.anytype.domain.config.Gateway
|
||||
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
||||
import com.anytypeio.anytype.domain.cover.SetDocCoverImage
|
||||
|
@ -28,6 +29,7 @@ import com.anytypeio.anytype.domain.dataview.interactor.UpdateDataViewViewer
|
|||
import com.anytypeio.anytype.domain.event.interactor.InterceptEvents
|
||||
import com.anytypeio.anytype.domain.launch.GetDefaultPageType
|
||||
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
||||
import com.anytypeio.anytype.domain.`object`.ConvertObjectToCollection
|
||||
import com.anytypeio.anytype.domain.objects.DefaultObjectStore
|
||||
import com.anytypeio.anytype.domain.objects.DefaultStoreOfRelations
|
||||
import com.anytypeio.anytype.domain.objects.ObjectStore
|
||||
|
@ -38,6 +40,7 @@ import com.anytypeio.anytype.domain.search.CancelSearchSubscription
|
|||
import com.anytypeio.anytype.domain.search.DataViewSubscriptionContainer
|
||||
import com.anytypeio.anytype.domain.search.SubscriptionEventChannel
|
||||
import com.anytypeio.anytype.domain.sets.OpenObjectSet
|
||||
import com.anytypeio.anytype.domain.sets.SetQueryToObjectSet
|
||||
import com.anytypeio.anytype.domain.status.InterceptThreadStatus
|
||||
import com.anytypeio.anytype.domain.status.ThreadStatusChannel
|
||||
import com.anytypeio.anytype.domain.templates.GetTemplates
|
||||
|
@ -50,9 +53,10 @@ import com.anytypeio.anytype.presentation.common.Delegator
|
|||
import com.anytypeio.anytype.presentation.editor.cover.CoverImageHashProvider
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetPaginator
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetReducer
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetSession
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetViewModelFactory
|
||||
import com.anytypeio.anytype.presentation.sets.state.DefaultObjectStateReducer
|
||||
import com.anytypeio.anytype.presentation.sets.subscription.DefaultDataViewSubscription
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.test_utils.MockDataFactory
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
@ -109,6 +113,13 @@ abstract class TestObjectSetSetup {
|
|||
lateinit var analytics: Analytics
|
||||
@Mock
|
||||
lateinit var cancelSearchSubscription: CancelSearchSubscription
|
||||
@Mock
|
||||
lateinit var convertObjectToCollection: ConvertObjectToCollection
|
||||
@Mock
|
||||
lateinit var setQueryToObjectSet: SetQueryToObjectSet
|
||||
|
||||
@Mock
|
||||
lateinit var addObjectToCollection: AddObjectToCollection
|
||||
|
||||
@Mock
|
||||
lateinit var createObject: CreateObject
|
||||
|
@ -117,7 +128,6 @@ abstract class TestObjectSetSetup {
|
|||
private lateinit var getDefaultPageType: GetDefaultPageType
|
||||
|
||||
private val session = ObjectSetSession()
|
||||
private val reducer = ObjectSetReducer()
|
||||
private val dispatcher: Dispatcher<Payload> = Dispatcher.Default()
|
||||
private val paginator = ObjectSetPaginator()
|
||||
private val store: ObjectStore = DefaultObjectStore()
|
||||
|
@ -150,6 +160,8 @@ abstract class TestObjectSetSetup {
|
|||
)
|
||||
)
|
||||
|
||||
private val objectStore: ObjectStore = DefaultObjectStore()
|
||||
|
||||
private val delegator = Delegator.Default<Action>()
|
||||
|
||||
open fun setup() {
|
||||
|
@ -209,18 +221,23 @@ abstract class TestObjectSetSetup {
|
|||
coverImageHashProvider = coverImageHashProvider,
|
||||
session = session,
|
||||
dispatcher = dispatcher,
|
||||
reducer = reducer,
|
||||
analytics = analytics,
|
||||
downloadUnsplashImage = downloadUnsplashImage,
|
||||
setDocCoverImage = setDocCoverImage,
|
||||
delegator = delegator,
|
||||
createObject = createObject,
|
||||
setDataViewQuery = setDataViewQuery,
|
||||
cancelSearchSubscription = cancelSearchSubscription,
|
||||
paginator = paginator,
|
||||
database = database,
|
||||
dataViewSubscriptionContainer = dataViewSubscriptionContainer,
|
||||
storeOfRelations = storeOfRelations
|
||||
storeOfRelations = storeOfRelations,
|
||||
objectStateReducer = DefaultObjectStateReducer(),
|
||||
dataViewSubscription = DefaultDataViewSubscription(dataViewSubscriptionContainer),
|
||||
workspaceManager = workspaceManager,
|
||||
objectToCollection = convertObjectToCollection,
|
||||
setQueryToObjectSet = setQueryToObjectSet,
|
||||
objectStore = objectStore,
|
||||
addObjectToCollection = addObjectToCollection
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -298,7 +315,8 @@ abstract class TestObjectSetSetup {
|
|||
limit = any(),
|
||||
offset = any(),
|
||||
ignoreWorkspace = any(),
|
||||
noDepSubscription = any()
|
||||
noDepSubscription = any(),
|
||||
collection = any()
|
||||
)
|
||||
} doReturn SearchResult(
|
||||
results = emptyList(),
|
||||
|
|
|
@ -13,7 +13,6 @@ import com.anytypeio.anytype.core_models.Block
|
|||
import com.anytypeio.anytype.core_models.DVFilter
|
||||
import com.anytypeio.anytype.core_models.DVFilterCondition
|
||||
import com.anytypeio.anytype.core_models.Payload
|
||||
import com.anytypeio.anytype.core_models.Relation
|
||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||
import com.anytypeio.anytype.domain.config.Gateway
|
||||
import com.anytypeio.anytype.domain.dataview.interactor.UpdateDataViewViewer
|
||||
|
@ -27,11 +26,10 @@ import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
|||
import com.anytypeio.anytype.domain.objects.options.GetOptions
|
||||
import com.anytypeio.anytype.domain.search.SearchObjects
|
||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
||||
import com.anytypeio.anytype.presentation.relations.ObjectSetConfig
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetSession
|
||||
import com.anytypeio.anytype.presentation.sets.filter.FilterViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.test_utils.MockDataFactory
|
||||
import com.anytypeio.anytype.test_utils.utils.TestUtils
|
||||
|
@ -77,7 +75,7 @@ class CreateSelectedFilterTest {
|
|||
|
||||
private val root = MockDataFactory.randomUuid()
|
||||
private val session = ObjectSetSession()
|
||||
private val state = MutableStateFlow(ObjectSet.init())
|
||||
private val state: MutableStateFlow<ObjectState> = MutableStateFlow(ObjectState.Init)
|
||||
private val dispatcher = Dispatcher.Default<Payload>()
|
||||
private val storeOfObjectTypes: StoreOfObjectTypes = DefaultStoreOfObjectTypes()
|
||||
private val storeOfRelations: StoreOfRelations = DefaultStoreOfRelations()
|
||||
|
@ -104,7 +102,7 @@ class CreateSelectedFilterTest {
|
|||
dispatcher = dispatcher,
|
||||
urlBuilder = urlBuilder,
|
||||
searchObjects = searchObjects,
|
||||
objectSetState = state,
|
||||
objectState = state,
|
||||
analytics = analytics,
|
||||
storeOfObjectTypes = storeOfObjectTypes,
|
||||
storeOfRelations = storeOfRelations,
|
||||
|
@ -118,13 +116,6 @@ class CreateSelectedFilterTest {
|
|||
fun shouldShowNonSelectedCheckedAndSelectedNotChecked() {
|
||||
val relationKey = MockDataFactory.randomUuid()
|
||||
|
||||
val target = MockDataFactory.randomUuid()
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relationKey to emptyList<String>()
|
||||
)
|
||||
|
||||
// Defining viewer containing one filter
|
||||
|
||||
val filter = DVFilter(
|
||||
|
@ -148,37 +139,18 @@ class CreateSelectedFilterTest {
|
|||
type = Block.Content.DataView.Viewer.Type.values().random()
|
||||
)
|
||||
|
||||
val relation = Relation(
|
||||
key = relationKey,
|
||||
defaultValue = null,
|
||||
isHidden = false,
|
||||
isReadOnly = false,
|
||||
isMulti = true,
|
||||
name = "Is read",
|
||||
source = Relation.Source.values().random(),
|
||||
format = Relation.Format.CHECKBOX,
|
||||
selections = emptyList()
|
||||
)
|
||||
|
||||
val dv = Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
blocks = listOf(dv),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(dv)
|
||||
)
|
||||
|
||||
// Launching fragment
|
||||
|
@ -213,11 +185,6 @@ class CreateSelectedFilterTest {
|
|||
|
||||
val target = MockDataFactory.randomUuid()
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relationKey to emptyList<String>()
|
||||
)
|
||||
|
||||
// Defining viewer containing one filter
|
||||
|
||||
val filter = DVFilter(
|
||||
|
@ -241,37 +208,18 @@ class CreateSelectedFilterTest {
|
|||
type = Block.Content.DataView.Viewer.Type.values().random()
|
||||
)
|
||||
|
||||
val relation = Relation(
|
||||
key = relationKey,
|
||||
defaultValue = null,
|
||||
isHidden = false,
|
||||
isReadOnly = false,
|
||||
isMulti = true,
|
||||
name = "Is read",
|
||||
source = Relation.Source.values().random(),
|
||||
format = Relation.Format.CHECKBOX,
|
||||
selections = emptyList()
|
||||
)
|
||||
|
||||
val dv = Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
blocks = listOf(dv),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(dv)
|
||||
)
|
||||
|
||||
// Launching fragment
|
||||
|
|
|
@ -22,11 +22,11 @@ import com.anytypeio.anytype.domain.objects.DefaultObjectStore
|
|||
import com.anytypeio.anytype.domain.objects.DefaultStoreOfRelations
|
||||
import com.anytypeio.anytype.domain.search.SearchObjects
|
||||
import com.anytypeio.anytype.presentation.relations.ObjectSetConfig
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetSession
|
||||
import com.anytypeio.anytype.presentation.sets.filter.ViewerFilterViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.model.Viewer
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.test_utils.MockDataFactory
|
||||
import com.anytypeio.anytype.test_utils.utils.TestUtils
|
||||
|
@ -67,7 +67,7 @@ class FilterListTest {
|
|||
|
||||
private val root = MockDataFactory.randomUuid()
|
||||
private val session = ObjectSetSession()
|
||||
private val state = MutableStateFlow(ObjectSet.init())
|
||||
private val state: MutableStateFlow<ObjectState> = MutableStateFlow(ObjectState.Init)
|
||||
private val dispatcher = Dispatcher.Default<Payload>()
|
||||
private val storeOfObjects = DefaultObjectStore()
|
||||
private val db = ObjectSetDatabase(storeOfObjects)
|
||||
|
@ -142,20 +142,13 @@ class FilterListTest {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
blocks = listOf(dv),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(dv)
|
||||
)
|
||||
|
||||
// Launching fragment
|
||||
|
@ -233,20 +226,13 @@ class FilterListTest {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
blocks = listOf(dv),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(dv)
|
||||
)
|
||||
|
||||
// Launching fragment
|
||||
|
@ -324,20 +310,13 @@ class FilterListTest {
|
|||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
blocks = listOf(dv),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(dv)
|
||||
)
|
||||
|
||||
// Launching fragment
|
||||
|
|
|
@ -21,7 +21,6 @@ import com.anytypeio.anytype.core_models.Block
|
|||
import com.anytypeio.anytype.core_models.DVFilter
|
||||
import com.anytypeio.anytype.core_models.DVFilterCondition
|
||||
import com.anytypeio.anytype.core_models.Payload
|
||||
import com.anytypeio.anytype.core_models.Relation
|
||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||
import com.anytypeio.anytype.domain.config.Gateway
|
||||
import com.anytypeio.anytype.domain.dataview.interactor.UpdateDataViewViewer
|
||||
|
@ -35,11 +34,10 @@ import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
|||
import com.anytypeio.anytype.domain.objects.options.GetOptions
|
||||
import com.anytypeio.anytype.domain.search.SearchObjects
|
||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
||||
import com.anytypeio.anytype.presentation.relations.ObjectSetConfig
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetSession
|
||||
import com.anytypeio.anytype.presentation.sets.filter.FilterViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.test_utils.MockDataFactory
|
||||
import com.anytypeio.anytype.ui.sets.modals.filter.ModifyFilterFromInputFieldValueFragment
|
||||
|
@ -82,7 +80,7 @@ class ModifyInputValueFilterTest {
|
|||
|
||||
private val root = MockDataFactory.randomUuid()
|
||||
private val session = ObjectSetSession()
|
||||
private val state = MutableStateFlow(ObjectSet.init())
|
||||
private val state: MutableStateFlow<ObjectState> = MutableStateFlow(ObjectState.Init)
|
||||
private val dispatcher = Dispatcher.Default<Payload>()
|
||||
private val storeOfObjectTypes: StoreOfObjectTypes = DefaultStoreOfObjectTypes()
|
||||
private val storeOfRelations: StoreOfRelations = DefaultStoreOfRelations()
|
||||
|
@ -103,7 +101,7 @@ class ModifyInputValueFilterTest {
|
|||
workspaceManager.setCurrentWorkspace(workspaceId)
|
||||
}
|
||||
TestModifyFilterFromInputFieldValueFragment.testVmFactory = FilterViewModel.Factory(
|
||||
objectSetState = state,
|
||||
objectState = state,
|
||||
session = session,
|
||||
updateDataViewViewer = updateDataViewViewer,
|
||||
dispatcher = dispatcher,
|
||||
|
@ -123,13 +121,6 @@ class ModifyInputValueFilterTest {
|
|||
|
||||
val relationKey = MockDataFactory.randomUuid()
|
||||
|
||||
val target = MockDataFactory.randomUuid()
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relationKey to emptyList<String>()
|
||||
)
|
||||
|
||||
// Defining viewer containing one filter
|
||||
|
||||
val initialFilterText = "Foo"
|
||||
|
@ -155,36 +146,17 @@ class ModifyInputValueFilterTest {
|
|||
type = Block.Content.DataView.Viewer.Type.values().random()
|
||||
)
|
||||
|
||||
val relation = Relation(
|
||||
key = relationKey,
|
||||
defaultValue = null,
|
||||
isHidden = false,
|
||||
isReadOnly = false,
|
||||
isMulti = true,
|
||||
name = MockDataFactory.randomString(),
|
||||
source = Relation.Source.values().random(),
|
||||
format = Relation.Format.LONG_TEXT,
|
||||
selections = emptyList()
|
||||
)
|
||||
|
||||
val dv = Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
)
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
blocks = listOf(dv),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(dv)
|
||||
)
|
||||
|
||||
// Launching fragment
|
||||
|
@ -244,13 +216,6 @@ class ModifyInputValueFilterTest {
|
|||
|
||||
val relationKey = MockDataFactory.randomUuid()
|
||||
|
||||
val target = MockDataFactory.randomUuid()
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relationKey to emptyList<String>()
|
||||
)
|
||||
|
||||
// Defining viewer containing one filter
|
||||
|
||||
val initialFilterText = "1"
|
||||
|
@ -276,36 +241,17 @@ class ModifyInputValueFilterTest {
|
|||
type = Block.Content.DataView.Viewer.Type.values().random()
|
||||
)
|
||||
|
||||
val relation = Relation(
|
||||
key = relationKey,
|
||||
defaultValue = null,
|
||||
isHidden = false,
|
||||
isReadOnly = false,
|
||||
isMulti = true,
|
||||
name = MockDataFactory.randomString(),
|
||||
source = Relation.Source.values().random(),
|
||||
format = Relation.Format.NUMBER,
|
||||
selections = emptyList()
|
||||
)
|
||||
|
||||
val dv = Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
)
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
blocks = listOf(dv),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(dv)
|
||||
)
|
||||
|
||||
// Launching fragment
|
||||
|
@ -326,8 +272,14 @@ class ModifyInputValueFilterTest {
|
|||
|
||||
// Checking input type
|
||||
|
||||
inputFieldInteraction.check(matches(withInputType(InputType.TYPE_CLASS_NUMBER
|
||||
or InputType.TYPE_NUMBER_FLAG_DECIMAL or InputType.TYPE_NUMBER_FLAG_SIGNED)))
|
||||
inputFieldInteraction.check(
|
||||
matches(
|
||||
withInputType(
|
||||
InputType.TYPE_CLASS_NUMBER
|
||||
or InputType.TYPE_NUMBER_FLAG_DECIMAL or InputType.TYPE_NUMBER_FLAG_SIGNED
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
// Typing additional text before pressing action button
|
||||
|
||||
|
@ -362,7 +314,7 @@ class ModifyInputValueFilterTest {
|
|||
}
|
||||
|
||||
private fun launchFragment(args: Bundle): FragmentScenario<TestModifyFilterFromInputFieldValueFragment> {
|
||||
return launchFragmentInContainer<TestModifyFilterFromInputFieldValueFragment>(
|
||||
return launchFragmentInContainer(
|
||||
fragmentArgs = args,
|
||||
themeResId = R.style.AppTheme
|
||||
)
|
||||
|
|
|
@ -32,11 +32,10 @@ import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
|||
import com.anytypeio.anytype.domain.objects.options.GetOptions
|
||||
import com.anytypeio.anytype.domain.search.SearchObjects
|
||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
||||
import com.anytypeio.anytype.presentation.relations.ObjectSetConfig
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetSession
|
||||
import com.anytypeio.anytype.presentation.sets.filter.FilterViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.test_utils.MockDataFactory
|
||||
import com.anytypeio.anytype.test_utils.utils.TestUtils
|
||||
|
@ -80,7 +79,7 @@ class ModifyStatusFilterTest {
|
|||
|
||||
private val root = MockDataFactory.randomUuid()
|
||||
private val session = ObjectSetSession()
|
||||
private val state = MutableStateFlow(ObjectSet.init())
|
||||
private val state: MutableStateFlow<ObjectState> = MutableStateFlow(ObjectState.Init)
|
||||
private val dispatcher = Dispatcher.Default<Payload>()
|
||||
private val storeOfObjectTypes: StoreOfObjectTypes = DefaultStoreOfObjectTypes()
|
||||
private val storeOfRelations: StoreOfRelations = DefaultStoreOfRelations()
|
||||
|
@ -102,7 +101,7 @@ class ModifyStatusFilterTest {
|
|||
workspaceManager.setCurrentWorkspace(workspaceId)
|
||||
}
|
||||
TestModifyFilterFromSelectedValueFragment.testVmFactory = FilterViewModel.Factory(
|
||||
objectSetState = state,
|
||||
objectState = state,
|
||||
session = session,
|
||||
updateDataViewViewer = updateDataViewViewer,
|
||||
dispatcher = dispatcher,
|
||||
|
@ -121,7 +120,6 @@ class ModifyStatusFilterTest {
|
|||
fun shouldSelectSecondStatusAndApplyChangesOnClick() {
|
||||
|
||||
val relationKey = MockDataFactory.randomUuid()
|
||||
val target = MockDataFactory.randomUuid()
|
||||
|
||||
// Defining three different statuses:
|
||||
|
||||
|
@ -143,11 +141,6 @@ class ModifyStatusFilterTest {
|
|||
color = MockDataFactory.randomString()
|
||||
)
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relationKey to emptyList<String>()
|
||||
)
|
||||
|
||||
// Defining viewer containing one filter
|
||||
|
||||
val filter = DVFilter(
|
||||
|
@ -170,36 +163,17 @@ class ModifyStatusFilterTest {
|
|||
type = Block.Content.DataView.Viewer.Type.values().random()
|
||||
)
|
||||
|
||||
val relation = Relation(
|
||||
key = relationKey,
|
||||
defaultValue = null,
|
||||
isHidden = false,
|
||||
isReadOnly = false,
|
||||
isMulti = true,
|
||||
name = MockDataFactory.randomString(),
|
||||
source = Relation.Source.values().random(),
|
||||
format = Relation.Format.STATUS,
|
||||
selections = listOf(option1, option2, option3)
|
||||
)
|
||||
|
||||
val dv = Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer)
|
||||
)
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
blocks = listOf(dv),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(dv)
|
||||
)
|
||||
|
||||
// Launching fragment
|
||||
|
|
|
@ -19,7 +19,6 @@ import com.anytypeio.anytype.core_models.DVFilter
|
|||
import com.anytypeio.anytype.core_models.DVFilterCondition
|
||||
import com.anytypeio.anytype.core_models.Payload
|
||||
import com.anytypeio.anytype.core_models.Relation
|
||||
import com.anytypeio.anytype.domain.`object`.ObjectTypesProvider
|
||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||
import com.anytypeio.anytype.domain.config.Gateway
|
||||
import com.anytypeio.anytype.domain.dataview.interactor.UpdateDataViewViewer
|
||||
|
@ -33,11 +32,10 @@ import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
|||
import com.anytypeio.anytype.domain.objects.options.GetOptions
|
||||
import com.anytypeio.anytype.domain.search.SearchObjects
|
||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
||||
import com.anytypeio.anytype.presentation.relations.ObjectSetConfig
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetSession
|
||||
import com.anytypeio.anytype.presentation.sets.filter.FilterViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.test_utils.MockDataFactory
|
||||
import com.anytypeio.anytype.test_utils.utils.TestUtils
|
||||
|
@ -66,10 +64,9 @@ class ModifyTagFilterTest {
|
|||
|
||||
@Mock
|
||||
lateinit var repo: BlockRepository
|
||||
|
||||
@Mock
|
||||
lateinit var gateway: Gateway
|
||||
@Mock
|
||||
lateinit var objectTypesProvider: ObjectTypesProvider
|
||||
|
||||
@Mock
|
||||
lateinit var analytics: Analytics
|
||||
|
@ -81,7 +78,7 @@ class ModifyTagFilterTest {
|
|||
|
||||
private val root = MockDataFactory.randomUuid()
|
||||
private val session = ObjectSetSession()
|
||||
private val state = MutableStateFlow(ObjectSet.init())
|
||||
private val state: MutableStateFlow<ObjectState> = MutableStateFlow(ObjectState.Init)
|
||||
private val dispatcher = Dispatcher.Default<Payload>()
|
||||
private val storeOfObjectTypes: StoreOfObjectTypes = DefaultStoreOfObjectTypes()
|
||||
private val storeOfRelations: StoreOfRelations = DefaultStoreOfRelations()
|
||||
|
@ -103,7 +100,7 @@ class ModifyTagFilterTest {
|
|||
workspaceManager.setCurrentWorkspace(workspaceId)
|
||||
}
|
||||
TestModifyFilterFromSelectedValueFragment.testVmFactory = FilterViewModel.Factory(
|
||||
objectSetState = state,
|
||||
objectState = state,
|
||||
session = session,
|
||||
updateDataViewViewer = updateDataViewViewer,
|
||||
dispatcher = dispatcher,
|
||||
|
@ -144,11 +141,6 @@ class ModifyTagFilterTest {
|
|||
color = MockDataFactory.randomString()
|
||||
)
|
||||
|
||||
val record: Map<String, Any?> = mapOf(
|
||||
ObjectSetConfig.ID_KEY to target,
|
||||
relationKey to emptyList<String>()
|
||||
)
|
||||
|
||||
// Defining viewer containing one filter
|
||||
|
||||
val viewer = Block.Content.DataView.Viewer(
|
||||
|
@ -171,37 +163,18 @@ class ModifyTagFilterTest {
|
|||
type = Block.Content.DataView.Viewer.Type.values().random()
|
||||
)
|
||||
|
||||
val relation = Relation(
|
||||
key = relationKey,
|
||||
defaultValue = null,
|
||||
isHidden = false,
|
||||
isReadOnly = false,
|
||||
isMulti = true,
|
||||
name = MockDataFactory.randomString(),
|
||||
source = Relation.Source.values().random(),
|
||||
format = Relation.Format.TAG,
|
||||
selections = listOf(option1, option2, option3)
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
// viewerDb = mapOf(
|
||||
// viewer.id to ObjectSet.ViewerData(
|
||||
// records = listOf(record),
|
||||
// total = 1
|
||||
// )
|
||||
// )
|
||||
)
|
||||
)
|
||||
|
||||
// Launching fragment
|
||||
|
|
|
@ -18,9 +18,9 @@ import com.anytypeio.anytype.core_models.Relation
|
|||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||
import com.anytypeio.anytype.domain.dataview.interactor.UpdateDataViewViewer
|
||||
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetSession
|
||||
import com.anytypeio.anytype.presentation.sets.sort.ViewerSortViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.test_utils.MockDataFactory
|
||||
import com.anytypeio.anytype.test_utils.utils.TestUtils.withRecyclerView
|
||||
|
@ -58,7 +58,7 @@ class ViewerObjectSortTest {
|
|||
|
||||
private val root = MockDataFactory.randomUuid()
|
||||
private val session = ObjectSetSession()
|
||||
private val state = MutableStateFlow(ObjectSet.init())
|
||||
private val state: MutableStateFlow<ObjectState> = MutableStateFlow(ObjectState.Init)
|
||||
private val dispatcher = Dispatcher.Default<Payload>()
|
||||
|
||||
@Before
|
||||
|
@ -117,17 +117,16 @@ class ViewerObjectSortTest {
|
|||
selections = emptyList()
|
||||
)
|
||||
|
||||
state.value = ObjectSet(
|
||||
state.value = ObjectState.DataView.Set(
|
||||
blocks = listOf(
|
||||
Block(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
children = emptyList(),
|
||||
fields = Block.Fields.empty(),
|
||||
content = Block.Content.DataView(
|
||||
relations = listOf(relation),
|
||||
viewers = listOf(viewer),
|
||||
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -5,6 +5,11 @@
|
|||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<!-- todo check if needed for Android 13 (see https://developer.android.com/guide/topics/connectivity/wifi-permissions) -->
|
||||
<uses-permission android:name="android.permission.NEARBY_WIFI_DEVICES"
|
||||
android:usesPermissionFlags="neverForLocation" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission
|
||||
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
|
|
|
@ -15,9 +15,10 @@ import com.anytypeio.anytype.di.common.HasComponentDependencies
|
|||
import com.anytypeio.anytype.di.main.ContextModule
|
||||
import com.anytypeio.anytype.di.main.DaggerMainComponent
|
||||
import com.anytypeio.anytype.di.main.MainComponent
|
||||
import com.anytypeio.anytype.middleware.interactor.LocalNetworkAddressHandler
|
||||
import timber.log.Timber
|
||||
import com.anytypeio.anytype.middleware.discovery.MDNSProvider
|
||||
import com.anytypeio.anytype.middleware.discovery.adresshandler.LocalNetworkAddressProvider
|
||||
import javax.inject.Inject
|
||||
import timber.log.Timber
|
||||
|
||||
class AndroidApplication : Application(), HasComponentDependencies {
|
||||
|
||||
|
@ -25,7 +26,10 @@ class AndroidApplication : Application(), HasComponentDependencies {
|
|||
lateinit var amplitudeTracker: AmplitudeTracker
|
||||
|
||||
@Inject
|
||||
lateinit var localNetworkAddressHandler: LocalNetworkAddressHandler
|
||||
lateinit var localNetworkAddressHandler: LocalNetworkAddressProvider
|
||||
|
||||
@Inject
|
||||
lateinit var discoveryManager: MDNSProvider
|
||||
|
||||
@Inject
|
||||
override lateinit var dependencies: ComponentDependenciesProvider
|
||||
|
@ -75,5 +79,6 @@ class AndroidApplication : Application(), HasComponentDependencies {
|
|||
|
||||
private fun setupLocalNetworkAddressHandler() {
|
||||
localNetworkAddressHandler.start()
|
||||
discoveryManager.setup()
|
||||
}
|
||||
}
|
|
@ -6,14 +6,15 @@ import com.anytypeio.anytype.core_utils.di.scope.PerModal
|
|||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||
import com.anytypeio.anytype.domain.dataview.interactor.*
|
||||
import com.anytypeio.anytype.presentation.sets.EditDataViewViewerViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetPaginator
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetSession
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.ui.sets.modals.EditDataViewViewerFragment
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.Subcomponent
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
@Subcomponent(modules = [EditDataViewViewerModule::class])
|
||||
|
@ -40,7 +41,7 @@ object EditDataViewViewerModule {
|
|||
duplicateDataViewViewer: DuplicateDataViewViewer,
|
||||
updateDataViewViewer: UpdateDataViewViewer,
|
||||
dispatcher: Dispatcher<Payload>,
|
||||
objectSetState: StateFlow<ObjectSet>,
|
||||
state: MutableStateFlow<ObjectState>,
|
||||
objectSetSession: ObjectSetSession,
|
||||
paginator: ObjectSetPaginator,
|
||||
analytics: Analytics
|
||||
|
@ -50,7 +51,7 @@ object EditDataViewViewerModule {
|
|||
duplicateDataViewViewer = duplicateDataViewViewer,
|
||||
updateDataViewViewer = updateDataViewViewer,
|
||||
dispatcher = dispatcher,
|
||||
objectSetState = objectSetState,
|
||||
objectState = state,
|
||||
objectSetSession = objectSetSession,
|
||||
paginator = paginator,
|
||||
analytics = analytics
|
||||
|
|
|
@ -54,6 +54,7 @@ import com.anytypeio.anytype.domain.icon.SetDocumentImageIcon
|
|||
import com.anytypeio.anytype.domain.launch.GetDefaultPageType
|
||||
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
||||
import com.anytypeio.anytype.domain.`object`.ConvertObjectToSet
|
||||
import com.anytypeio.anytype.domain.`object`.ConvertObjectToCollection
|
||||
import com.anytypeio.anytype.domain.`object`.DuplicateObject
|
||||
import com.anytypeio.anytype.domain.`object`.UpdateDetail
|
||||
import com.anytypeio.anytype.domain.objects.SetObjectIsArchived
|
||||
|
@ -259,7 +260,8 @@ object EditorSessionModule {
|
|||
featureToggles: FeatureToggles,
|
||||
tableDelegate: EditorTableDelegate,
|
||||
workspaceManager: WorkspaceManager,
|
||||
getObjectTypes: GetObjectTypes
|
||||
getObjectTypes: GetObjectTypes,
|
||||
objectToCollection: ConvertObjectToCollection
|
||||
): EditorViewModelFactory = EditorViewModelFactory(
|
||||
openPage = openPage,
|
||||
closeObject = closePage,
|
||||
|
@ -294,9 +296,12 @@ object EditorSessionModule {
|
|||
featureToggles = featureToggles,
|
||||
tableDelegate = tableDelegate,
|
||||
workspaceManager = workspaceManager,
|
||||
getObjectTypes = getObjectTypes
|
||||
getObjectTypes = getObjectTypes,
|
||||
objectToCollection = objectToCollection
|
||||
)
|
||||
|
||||
|
||||
|
||||
@JvmStatic
|
||||
@Provides
|
||||
@PerScreen
|
||||
|
@ -857,6 +862,17 @@ object EditorUseCaseModule {
|
|||
repo = repo
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
@Provides
|
||||
@PerScreen
|
||||
fun provideConvertObjectToCollection(
|
||||
repo: BlockRepository,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
): ConvertObjectToCollection = ConvertObjectToCollection(
|
||||
repo = repo,
|
||||
dispatchers = dispatchers
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
@Provides
|
||||
@PerScreen
|
||||
|
|
|
@ -4,14 +4,14 @@ import com.anytypeio.anytype.analytics.base.Analytics
|
|||
import com.anytypeio.anytype.core_models.Payload
|
||||
import com.anytypeio.anytype.core_utils.di.scope.PerModal
|
||||
import com.anytypeio.anytype.presentation.sets.ManageViewerViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetSession
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.ui.sets.modals.ManageViewerFragment
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.Subcomponent
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
@Subcomponent(modules = [ManageViewerModule::class])
|
||||
@PerModal
|
||||
|
@ -31,12 +31,12 @@ object ManageViewerModule {
|
|||
@Provides
|
||||
@PerModal
|
||||
fun provideManageViewerViewModelFactory(
|
||||
state: StateFlow<ObjectSet>,
|
||||
state: MutableStateFlow<ObjectState>,
|
||||
session: ObjectSetSession,
|
||||
dispatcher: Dispatcher<Payload>,
|
||||
analytics: Analytics
|
||||
): ManageViewerViewModel.Factory = ManageViewerViewModel.Factory(
|
||||
state = state,
|
||||
objectState = state,
|
||||
session = session,
|
||||
dispatcher = dispatcher,
|
||||
analytics = analytics
|
||||
|
|
|
@ -5,15 +5,15 @@ import com.anytypeio.anytype.core_models.Payload
|
|||
import com.anytypeio.anytype.core_utils.di.scope.PerModal
|
||||
import com.anytypeio.anytype.domain.dataview.interactor.UpdateDataViewViewer
|
||||
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetSession
|
||||
import com.anytypeio.anytype.presentation.sets.sort.ModifyViewerSortViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.ui.sets.modals.sort.ModifyViewerSortFragment
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.Subcomponent
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
@Subcomponent(modules = [ModifyViewerSortModule::class])
|
||||
@PerModal
|
||||
|
@ -33,7 +33,7 @@ object ModifyViewerSortModule {
|
|||
@Provides
|
||||
@PerModal
|
||||
fun provideViewModelFactory(
|
||||
state: StateFlow<ObjectSet>,
|
||||
state: MutableStateFlow<ObjectState>,
|
||||
session: ObjectSetSession,
|
||||
dispatcher: Dispatcher<Payload>,
|
||||
updateDataViewViewer: UpdateDataViewViewer,
|
||||
|
|
|
@ -20,10 +20,11 @@ import com.anytypeio.anytype.domain.page.OpenPage
|
|||
import com.anytypeio.anytype.presentation.common.Action
|
||||
import com.anytypeio.anytype.presentation.common.Delegator
|
||||
import com.anytypeio.anytype.presentation.editor.Editor
|
||||
import com.anytypeio.anytype.presentation.objects.menu.ObjectMenuOptionsProvider
|
||||
import com.anytypeio.anytype.presentation.objects.menu.ObjectMenuOptionsProviderImpl
|
||||
import com.anytypeio.anytype.presentation.objects.menu.ObjectMenuViewModel
|
||||
import com.anytypeio.anytype.presentation.objects.menu.ObjectSetMenuViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.presentation.util.downloader.DebugTreeShareDownloader
|
||||
import com.anytypeio.anytype.ui.editor.sheets.ObjectMenuFragment
|
||||
|
@ -31,7 +32,10 @@ import com.anytypeio.anytype.ui.sets.ObjectSetMenuFragment
|
|||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.Subcomponent
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
import kotlinx.coroutines.flow.emptyFlow
|
||||
import kotlinx.coroutines.flow.map
|
||||
|
||||
|
||||
|
@ -147,7 +151,7 @@ object ObjectSetMenuModule {
|
|||
delegator: Delegator<Action>,
|
||||
urlBuilder: UrlBuilder,
|
||||
analytics: Analytics,
|
||||
state: StateFlow<ObjectSet>,
|
||||
state: MutableStateFlow<ObjectState>,
|
||||
featureToggles: FeatureToggles,
|
||||
dispatcher: Dispatcher<Payload>
|
||||
): ObjectSetMenuViewModel.Factory = ObjectSetMenuViewModel.Factory(
|
||||
|
@ -159,7 +163,7 @@ object ObjectSetMenuModule {
|
|||
urlBuilder = urlBuilder,
|
||||
delegator = delegator,
|
||||
analytics = analytics,
|
||||
state = state,
|
||||
objectState = state,
|
||||
dispatcher = dispatcher,
|
||||
menuOptionsProvider = createMenuOptionsProvider(state, featureToggles)
|
||||
)
|
||||
|
@ -186,12 +190,20 @@ object ObjectSetMenuModule {
|
|||
|
||||
@JvmStatic
|
||||
private fun createMenuOptionsProvider(
|
||||
state: StateFlow<ObjectSet>,
|
||||
state: StateFlow<ObjectState>,
|
||||
featureToggles: FeatureToggles
|
||||
) =
|
||||
ObjectMenuOptionsProviderImpl(
|
||||
details = state.map { it.details },
|
||||
restrictions = state.map { it.objectRestrictions },
|
||||
featureToggles = featureToggles
|
||||
)
|
||||
): ObjectMenuOptionsProvider {
|
||||
return when (val currentState = state.value) {
|
||||
is ObjectState.DataView -> ObjectMenuOptionsProviderImpl(
|
||||
details = state.map { currentState.details }.distinctUntilChanged(),
|
||||
restrictions = state.map { currentState.objectRestrictions }.distinctUntilChanged(),
|
||||
featureToggles = featureToggles
|
||||
)
|
||||
else -> ObjectMenuOptionsProviderImpl(
|
||||
details = emptyFlow(),
|
||||
restrictions = emptyFlow(),
|
||||
featureToggles = featureToggles
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,9 +19,9 @@ import com.anytypeio.anytype.domain.auth.repo.AuthRepository
|
|||
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
||||
import com.anytypeio.anytype.domain.block.interactor.UpdateText
|
||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||
import com.anytypeio.anytype.domain.collections.AddObjectToCollection
|
||||
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
||||
import com.anytypeio.anytype.domain.cover.SetDocCoverImage
|
||||
import com.anytypeio.anytype.domain.dataview.SetDataViewQuery
|
||||
import com.anytypeio.anytype.domain.dataview.interactor.CreateDataViewObject
|
||||
import com.anytypeio.anytype.domain.dataview.interactor.UpdateDataViewViewer
|
||||
import com.anytypeio.anytype.domain.event.interactor.EventChannel
|
||||
|
@ -29,6 +29,7 @@ import com.anytypeio.anytype.domain.event.interactor.InterceptEvents
|
|||
import com.anytypeio.anytype.domain.icon.SetDocumentImageIcon
|
||||
import com.anytypeio.anytype.domain.launch.GetDefaultPageType
|
||||
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
||||
import com.anytypeio.anytype.domain.`object`.ConvertObjectToCollection
|
||||
import com.anytypeio.anytype.domain.objects.DefaultObjectStore
|
||||
import com.anytypeio.anytype.domain.objects.ObjectStore
|
||||
import com.anytypeio.anytype.domain.objects.SetObjectIsArchived
|
||||
|
@ -43,6 +44,7 @@ import com.anytypeio.anytype.domain.search.DataViewSubscriptionContainer
|
|||
import com.anytypeio.anytype.domain.search.SearchObjects
|
||||
import com.anytypeio.anytype.domain.search.SubscriptionEventChannel
|
||||
import com.anytypeio.anytype.domain.sets.OpenObjectSet
|
||||
import com.anytypeio.anytype.domain.sets.SetQueryToObjectSet
|
||||
import com.anytypeio.anytype.domain.status.InterceptThreadStatus
|
||||
import com.anytypeio.anytype.domain.status.ThreadStatusChannel
|
||||
import com.anytypeio.anytype.domain.templates.GetTemplates
|
||||
|
@ -57,12 +59,15 @@ import com.anytypeio.anytype.presentation.relations.providers.DataViewObjectValu
|
|||
import com.anytypeio.anytype.presentation.relations.providers.ObjectDetailProvider
|
||||
import com.anytypeio.anytype.presentation.relations.providers.ObjectRelationProvider
|
||||
import com.anytypeio.anytype.presentation.relations.providers.ObjectValueProvider
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetPaginator
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetReducer
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetSession
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetViewModelFactory
|
||||
import com.anytypeio.anytype.presentation.sets.state.DefaultObjectStateReducer
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectStateReducer
|
||||
import com.anytypeio.anytype.presentation.sets.subscription.DataViewSubscription
|
||||
import com.anytypeio.anytype.presentation.sets.subscription.DefaultDataViewSubscription
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.providers.DefaultCoverImageHashProvider
|
||||
import com.anytypeio.anytype.ui.sets.ObjectSetFragment
|
||||
|
@ -71,8 +76,8 @@ import dagger.Module
|
|||
import dagger.Provides
|
||||
import dagger.Subcomponent
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import javax.inject.Named
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
@Subcomponent(modules = [ObjectSetModule::class])
|
||||
@PerScreen
|
||||
|
@ -125,6 +130,15 @@ object ObjectSetModule {
|
|||
repo: BlockRepository
|
||||
): SetDocumentImageIcon = SetDocumentImageIcon(repo)
|
||||
|
||||
@JvmStatic
|
||||
@Provides
|
||||
@PerScreen
|
||||
fun provideDataViewSubscription(
|
||||
dataViewSubscriptionContainer: DataViewSubscriptionContainer
|
||||
): DataViewSubscription = DefaultDataViewSubscription(
|
||||
dataViewSubscriptionContainer
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
@Provides
|
||||
@PerScreen
|
||||
|
@ -137,7 +151,6 @@ object ObjectSetModule {
|
|||
interceptThreadStatus: InterceptThreadStatus,
|
||||
createDataViewObject: CreateDataViewObject,
|
||||
createObject: CreateObject,
|
||||
reducer: ObjectSetReducer,
|
||||
dispatcher: Dispatcher<Payload>,
|
||||
delegator: Delegator<Action>,
|
||||
urlBuilder: UrlBuilder,
|
||||
|
@ -148,10 +161,16 @@ object ObjectSetModule {
|
|||
setDocCoverImage: SetDocCoverImage,
|
||||
dataViewSubscriptionContainer: DataViewSubscriptionContainer,
|
||||
cancelSearchSubscription: CancelSearchSubscription,
|
||||
setDataViewQuery: SetDataViewQuery,
|
||||
setQueryToObjectSet: SetQueryToObjectSet,
|
||||
database: ObjectSetDatabase,
|
||||
paginator: ObjectSetPaginator,
|
||||
storeOfRelations: StoreOfRelations
|
||||
storeOfRelations: StoreOfRelations,
|
||||
objectStateReducer: ObjectStateReducer,
|
||||
dataViewSubscription: DataViewSubscription,
|
||||
workspaceManager: WorkspaceManager,
|
||||
@Named("object-set-store") objectStore: ObjectStore,
|
||||
addObjectToCollection: AddObjectToCollection,
|
||||
convertObjectToCollection: ConvertObjectToCollection
|
||||
): ObjectSetViewModelFactory = ObjectSetViewModelFactory(
|
||||
openObjectSet = openObjectSet,
|
||||
closeBlock = closeBlock,
|
||||
|
@ -160,7 +179,6 @@ object ObjectSetModule {
|
|||
updateText = updateText,
|
||||
interceptEvents = interceptEvents,
|
||||
interceptThreadStatus = interceptThreadStatus,
|
||||
reducer = reducer,
|
||||
dispatcher = dispatcher,
|
||||
delegator = delegator,
|
||||
coverImageHashProvider = coverImageHashProvider,
|
||||
|
@ -172,10 +190,27 @@ object ObjectSetModule {
|
|||
createObject = createObject,
|
||||
dataViewSubscriptionContainer = dataViewSubscriptionContainer,
|
||||
cancelSearchSubscription = cancelSearchSubscription,
|
||||
setDataViewQuery = setDataViewQuery,
|
||||
setQueryToObjectSet = setQueryToObjectSet,
|
||||
database = database,
|
||||
paginator = paginator,
|
||||
storeOfRelations = storeOfRelations
|
||||
storeOfRelations = storeOfRelations,
|
||||
objectStateReducer = objectStateReducer,
|
||||
dataViewSubscription = dataViewSubscription,
|
||||
workspaceManager = workspaceManager,
|
||||
objectStore = objectStore,
|
||||
addObjectToCollection = addObjectToCollection,
|
||||
objectToCollection = convertObjectToCollection
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
@Provides
|
||||
@PerScreen
|
||||
fun provideConvertObjectToCollection(
|
||||
repo: BlockRepository,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
): ConvertObjectToCollection = ConvertObjectToCollection(
|
||||
repo = repo,
|
||||
dispatchers = dispatchers
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
@ -196,9 +231,10 @@ object ObjectSetModule {
|
|||
@JvmStatic
|
||||
@Provides
|
||||
@PerScreen
|
||||
fun provideSetDataViewSource(
|
||||
repo: BlockRepository
|
||||
): SetDataViewQuery = SetDataViewQuery(repo)
|
||||
fun provideSetQueryToSet(
|
||||
repo: BlockRepository,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
): SetQueryToObjectSet = SetQueryToObjectSet(repo, dispatchers)
|
||||
|
||||
@JvmStatic
|
||||
@PerScreen
|
||||
|
@ -282,14 +318,12 @@ object ObjectSetModule {
|
|||
@JvmStatic
|
||||
@Provides
|
||||
@PerScreen
|
||||
fun provideObjectSetReducer(): ObjectSetReducer = ObjectSetReducer()
|
||||
fun provideState(reducer: ObjectStateReducer): MutableStateFlow<ObjectState> = reducer.state
|
||||
|
||||
@JvmStatic
|
||||
@Provides
|
||||
@PerScreen
|
||||
fun provideState(
|
||||
reducer: ObjectSetReducer
|
||||
): StateFlow<ObjectSet> = reducer.state
|
||||
fun provideObjectStateReducer(): ObjectStateReducer = DefaultObjectStateReducer()
|
||||
|
||||
@JvmStatic
|
||||
@Provides
|
||||
|
@ -310,10 +344,10 @@ object ObjectSetModule {
|
|||
@Provides
|
||||
@PerScreen
|
||||
fun provideDataViewObjectRelationProvider(
|
||||
state: StateFlow<ObjectSet>,
|
||||
state: MutableStateFlow<ObjectState>,
|
||||
storeOfRelations: StoreOfRelations
|
||||
): ObjectRelationProvider = DataViewObjectRelationProvider(
|
||||
objectSetState = state,
|
||||
objectState = state,
|
||||
storeOfRelations = storeOfRelations
|
||||
)
|
||||
|
||||
|
@ -330,9 +364,14 @@ object ObjectSetModule {
|
|||
@Provides
|
||||
@PerScreen
|
||||
fun provideObjectDetailProvider(
|
||||
state: StateFlow<ObjectSet>,
|
||||
objectState: MutableStateFlow<ObjectState>,
|
||||
): ObjectDetailProvider = object : ObjectDetailProvider {
|
||||
override fun provide(): Map<Id, Block.Fields> = state.value.details
|
||||
override fun provide(): Map<Id, Block.Fields> {
|
||||
return when (val state = objectState.value) {
|
||||
is ObjectState.DataView -> state.details
|
||||
else -> emptyMap()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
|
@ -457,6 +496,17 @@ object ObjectSetModule {
|
|||
repo = repo
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
@Provides
|
||||
@PerScreen
|
||||
fun provideAddObjectToCollection(
|
||||
repo: BlockRepository,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
): AddObjectToCollection = AddObjectToCollection(
|
||||
repo = repo,
|
||||
dispatchers = dispatchers
|
||||
)
|
||||
|
||||
@Module
|
||||
interface Bindings {
|
||||
|
||||
|
|
|
@ -7,14 +7,14 @@ import com.anytypeio.anytype.domain.dataview.interactor.UpdateDataViewViewer
|
|||
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
||||
import com.anytypeio.anytype.domain.relations.DeleteRelationFromDataView
|
||||
import com.anytypeio.anytype.presentation.relations.ObjectSetSettingsViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetSession
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.ui.sets.modals.ObjectSetSettingsFragment
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.Subcomponent
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
@Subcomponent(modules = [ObjectSetSettingsModule::class])
|
||||
@PerModal
|
||||
|
@ -35,7 +35,7 @@ object ObjectSetSettingsModule {
|
|||
@Provides
|
||||
@PerModal
|
||||
fun provideViewModelFactory(
|
||||
state: StateFlow<ObjectSet>,
|
||||
state: MutableStateFlow<ObjectState>,
|
||||
session: ObjectSetSession,
|
||||
dispatcher: Dispatcher<Payload>,
|
||||
updateDataViewViewer: UpdateDataViewViewer,
|
||||
|
@ -43,7 +43,7 @@ object ObjectSetSettingsModule {
|
|||
analytics: Analytics,
|
||||
deleteRelationFromDataView: DeleteRelationFromDataView,
|
||||
): ObjectSetSettingsViewModel.Factory = ObjectSetSettingsViewModel.Factory(
|
||||
state = state,
|
||||
objectState = state,
|
||||
session = session,
|
||||
dispatcher = dispatcher,
|
||||
updateDataViewViewer = updateDataViewViewer,
|
||||
|
|
|
@ -5,15 +5,15 @@ import com.anytypeio.anytype.core_models.Payload
|
|||
import com.anytypeio.anytype.core_utils.di.scope.PerModal
|
||||
import com.anytypeio.anytype.domain.dataview.interactor.UpdateDataViewViewer
|
||||
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetSession
|
||||
import com.anytypeio.anytype.presentation.sets.SelectSortRelationViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.ui.sets.modals.sort.SelectSortRelationFragment
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.Subcomponent
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
@Subcomponent(modules = [SelectSortRelationModule::class])
|
||||
@PerModal
|
||||
|
@ -33,14 +33,14 @@ object SelectSortRelationModule {
|
|||
@Provides
|
||||
@PerModal
|
||||
fun provideSelectSortRelationViewModelFactory(
|
||||
state: StateFlow<ObjectSet>,
|
||||
state: MutableStateFlow<ObjectState>,
|
||||
session: ObjectSetSession,
|
||||
dispatcher: Dispatcher<Payload>,
|
||||
updateDataViewViewer: UpdateDataViewViewer,
|
||||
storeOfRelations: StoreOfRelations,
|
||||
analytics: Analytics
|
||||
): SelectSortRelationViewModel.Factory = SelectSortRelationViewModel.Factory(
|
||||
state = state,
|
||||
objectState = state,
|
||||
session = session,
|
||||
dispatcher = dispatcher,
|
||||
updateDataViewViewer = updateDataViewViewer,
|
||||
|
|
|
@ -5,17 +5,17 @@ import com.anytypeio.anytype.core_models.Payload
|
|||
import com.anytypeio.anytype.domain.dataview.interactor.UpdateDataViewViewer
|
||||
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
||||
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetSession
|
||||
import com.anytypeio.anytype.presentation.sets.filter.ViewerFilterViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.ui.sets.ViewerFilterFragment
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.Subcomponent
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import javax.inject.Scope
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
@Subcomponent(modules = [ViewerFilterModule::class])
|
||||
@ViewerFilterByScope
|
||||
|
@ -36,7 +36,7 @@ object ViewerFilterModule {
|
|||
@Provides
|
||||
@ViewerFilterByScope
|
||||
fun provideViewerFilterViewModelFactory(
|
||||
state: StateFlow<ObjectSet>,
|
||||
state: MutableStateFlow<ObjectState>,
|
||||
session: ObjectSetSession,
|
||||
dispatcher: Dispatcher<Payload>,
|
||||
updateDataViewViewer: UpdateDataViewViewer,
|
||||
|
|
|
@ -5,15 +5,15 @@ import com.anytypeio.anytype.core_models.Payload
|
|||
import com.anytypeio.anytype.core_utils.di.scope.PerModal
|
||||
import com.anytypeio.anytype.domain.dataview.interactor.UpdateDataViewViewer
|
||||
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetSession
|
||||
import com.anytypeio.anytype.presentation.sets.sort.ViewerSortViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.ui.sets.modals.sort.ViewerSortFragment
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.Subcomponent
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
@Subcomponent(modules = [ViewerSortModule::class])
|
||||
@PerModal
|
||||
|
@ -33,7 +33,7 @@ object ViewerSortModule {
|
|||
@Provides
|
||||
@PerModal
|
||||
fun provideViewModelFactory(
|
||||
state: StateFlow<ObjectSet>,
|
||||
state: MutableStateFlow<ObjectState>,
|
||||
session: ObjectSetSession,
|
||||
updateDataViewViewer: UpdateDataViewViewer,
|
||||
dispatcher: Dispatcher<Payload>,
|
||||
|
|
|
@ -15,8 +15,8 @@ import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
|||
import com.anytypeio.anytype.presentation.relations.RelationAddToDataViewViewModel
|
||||
import com.anytypeio.anytype.presentation.relations.RelationAddToObjectViewModel
|
||||
import com.anytypeio.anytype.presentation.relations.providers.ObjectRelationProvider
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetSession
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.ui.relations.RelationAddToDataViewFragment
|
||||
import com.anytypeio.anytype.ui.relations.RelationAddToObjectBlockFragment
|
||||
|
@ -24,8 +24,7 @@ import com.anytypeio.anytype.ui.relations.RelationAddToObjectFragment
|
|||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.Subcomponent
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
@Subcomponent(modules = [RelationAddToObjectModule::class])
|
||||
@PerDialog
|
||||
|
@ -107,7 +106,7 @@ object RelationAddToDataViewModule {
|
|||
fun provideViewModelFactory(
|
||||
addRelationToDataView: AddRelationToDataView,
|
||||
dispatcher: Dispatcher<Payload>,
|
||||
state: StateFlow<ObjectSet>,
|
||||
state: MutableStateFlow<ObjectState>,
|
||||
session: ObjectSetSession,
|
||||
updateDataViewViewer: UpdateDataViewViewer,
|
||||
analytics: Analytics,
|
||||
|
|
|
@ -16,8 +16,8 @@ import com.anytypeio.anytype.presentation.relations.RelationCreateFromScratchFor
|
|||
import com.anytypeio.anytype.presentation.relations.RelationCreateFromScratchForObjectViewModel
|
||||
import com.anytypeio.anytype.presentation.relations.model.CreateFromScratchState
|
||||
import com.anytypeio.anytype.presentation.relations.model.StateHolder
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetSession
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.ui.relations.RelationCreateFromScratchForDataViewFragment
|
||||
import com.anytypeio.anytype.ui.relations.RelationCreateFromScratchForObjectBlockFragment
|
||||
|
@ -26,7 +26,7 @@ import com.anytypeio.anytype.ui.relations.RelationCreateFromScratchFormatPickerF
|
|||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.Subcomponent
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
@Subcomponent(modules = [RelationCreateFromScratchForObjectModule::class])
|
||||
@CreateFromScratch
|
||||
|
@ -107,7 +107,7 @@ object RelationCreateFromScratchForDataViewModule {
|
|||
@Provides
|
||||
@CreateFromScratch
|
||||
fun provideViewModelFactory(
|
||||
state: StateFlow<ObjectSet>,
|
||||
state: MutableStateFlow<ObjectState>,
|
||||
session: ObjectSetSession,
|
||||
updateDataViewViewer: UpdateDataViewViewer,
|
||||
dispatcher: Dispatcher<Payload>,
|
||||
|
@ -118,7 +118,7 @@ object RelationCreateFromScratchForDataViewModule {
|
|||
) = RelationCreateFromScratchForDataViewViewModel.Factory(
|
||||
addRelationToDataView = addRelationToDataView,
|
||||
dispatcher = dispatcher,
|
||||
state = state,
|
||||
objectState = state,
|
||||
session = session,
|
||||
updateDataViewViewer = updateDataViewViewer,
|
||||
analytics = analytics,
|
||||
|
|
|
@ -10,17 +10,17 @@ import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
|||
import com.anytypeio.anytype.domain.objects.options.GetOptions
|
||||
import com.anytypeio.anytype.domain.search.SearchObjects
|
||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetSession
|
||||
import com.anytypeio.anytype.presentation.sets.filter.FilterViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.ui.sets.modals.filter.CreateFilterFromInputFieldValueFragment
|
||||
import com.anytypeio.anytype.ui.sets.modals.filter.CreateFilterFromSelectedValueFragment
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.Subcomponent
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
@Subcomponent(modules = [CreateFilterModule::class])
|
||||
@PerModal
|
||||
|
@ -43,7 +43,7 @@ object CreateFilterModule {
|
|||
@Provides
|
||||
@PerModal
|
||||
fun provideViewModelFactory(
|
||||
state: StateFlow<ObjectSet>,
|
||||
state: MutableStateFlow<ObjectState>,
|
||||
session: ObjectSetSession,
|
||||
dispatcher: Dispatcher<Payload>,
|
||||
updateDataViewViewer: UpdateDataViewViewer,
|
||||
|
@ -56,7 +56,7 @@ object CreateFilterModule {
|
|||
getOptions: GetOptions,
|
||||
workspaceManager: WorkspaceManager
|
||||
): FilterViewModel.Factory = FilterViewModel.Factory(
|
||||
objectSetState = state,
|
||||
objectState = state,
|
||||
session = session,
|
||||
dispatcher = dispatcher,
|
||||
updateDataViewViewer = updateDataViewViewer,
|
||||
|
|
|
@ -10,17 +10,17 @@ import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
|||
import com.anytypeio.anytype.domain.objects.options.GetOptions
|
||||
import com.anytypeio.anytype.domain.search.SearchObjects
|
||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetSession
|
||||
import com.anytypeio.anytype.presentation.sets.filter.FilterViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.ui.sets.modals.filter.ModifyFilterFromInputFieldValueFragment
|
||||
import com.anytypeio.anytype.ui.sets.modals.filter.ModifyFilterFromSelectedValueFragment
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.Subcomponent
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
@Subcomponent(modules = [ModifyFilterModule::class])
|
||||
@PerModal
|
||||
|
@ -43,7 +43,7 @@ object ModifyFilterModule {
|
|||
@Provides
|
||||
@PerModal
|
||||
fun provideViewModelFactory(
|
||||
state: StateFlow<ObjectSet>,
|
||||
state: MutableStateFlow<ObjectState>,
|
||||
session: ObjectSetSession,
|
||||
dispatcher: Dispatcher<Payload>,
|
||||
updateDataViewViewer: UpdateDataViewViewer,
|
||||
|
@ -56,7 +56,7 @@ object ModifyFilterModule {
|
|||
storeOfRelations: StoreOfRelations,
|
||||
workspaceManager: WorkspaceManager
|
||||
): FilterViewModel.Factory = FilterViewModel.Factory(
|
||||
objectSetState = state,
|
||||
objectState = state,
|
||||
session = session,
|
||||
dispatcher = dispatcher,
|
||||
updateDataViewViewer = updateDataViewViewer,
|
||||
|
|
|
@ -2,14 +2,14 @@ package com.anytypeio.anytype.di.feature.sets
|
|||
|
||||
import com.anytypeio.anytype.core_utils.di.scope.PerModal
|
||||
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetSession
|
||||
import com.anytypeio.anytype.presentation.sets.SelectFilterRelationViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.ui.sets.modals.filter.SelectFilterRelationFragment
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.Subcomponent
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
@Subcomponent(modules = [SelectFilterRelationModule::class])
|
||||
@PerModal
|
||||
|
@ -29,11 +29,11 @@ object SelectFilterRelationModule {
|
|||
@Provides
|
||||
@PerModal
|
||||
fun provideSelectSortRelationViewModelFactory(
|
||||
state: StateFlow<ObjectSet>,
|
||||
state: MutableStateFlow<ObjectState>,
|
||||
session: ObjectSetSession,
|
||||
storeOfRelations: StoreOfRelations
|
||||
): SelectFilterRelationViewModel.Factory = SelectFilterRelationViewModel.Factory(
|
||||
state = state,
|
||||
objectState = state,
|
||||
session = session,
|
||||
storeOfRelations = storeOfRelations
|
||||
)
|
||||
|
|
|
@ -3,15 +3,15 @@ package com.anytypeio.anytype.di.feature.sets.viewer
|
|||
import com.anytypeio.anytype.core_models.Payload
|
||||
import com.anytypeio.anytype.core_utils.di.scope.PerModal
|
||||
import com.anytypeio.anytype.domain.dataview.interactor.UpdateDataViewViewer
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetSession
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.sets.viewer.ViewerCardSizeSelectViewModel
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.ui.sets.modals.viewer.ViewerCardSizeSelectFragment
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.Subcomponent
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
@Subcomponent(modules = [ViewerCardSizeSelectModule::class])
|
||||
@PerModal
|
||||
|
@ -32,12 +32,12 @@ object ViewerCardSizeSelectModule {
|
|||
@Provides
|
||||
@PerModal
|
||||
fun provideViewModelFactory(
|
||||
state: StateFlow<ObjectSet>,
|
||||
state: MutableStateFlow<ObjectState>,
|
||||
session: ObjectSetSession,
|
||||
dispatcher: Dispatcher<Payload>,
|
||||
updateDataViewViewer: UpdateDataViewViewer
|
||||
): ViewerCardSizeSelectViewModel.Factory = ViewerCardSizeSelectViewModel.Factory(
|
||||
objectSetState = state,
|
||||
objectState = state,
|
||||
session = session,
|
||||
dispatcher = dispatcher,
|
||||
updateDataViewViewer = updateDataViewViewer
|
||||
|
|
|
@ -3,14 +3,16 @@ package com.anytypeio.anytype.di.feature.sets.viewer
|
|||
import com.anytypeio.anytype.core_models.Payload
|
||||
import com.anytypeio.anytype.core_utils.di.scope.PerModal
|
||||
import com.anytypeio.anytype.domain.dataview.interactor.UpdateDataViewViewer
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSet
|
||||
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetSession
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.sets.viewer.ViewerImagePreviewSelectViewModel
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
import com.anytypeio.anytype.ui.sets.modals.viewer.ViewerImagePreviewSelectFragment
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.Subcomponent
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
@Subcomponent(modules = [ViewerImagePreviewSelectModule::class])
|
||||
|
@ -32,14 +34,16 @@ object ViewerImagePreviewSelectModule {
|
|||
@Provides
|
||||
@PerModal
|
||||
fun provideViewModelFactory(
|
||||
state: StateFlow<ObjectSet>,
|
||||
state: MutableStateFlow<ObjectState>,
|
||||
session: ObjectSetSession,
|
||||
dispatcher: Dispatcher<Payload>,
|
||||
updateDataViewViewer: UpdateDataViewViewer
|
||||
updateDataViewViewer: UpdateDataViewViewer,
|
||||
storeOfRelations: StoreOfRelations
|
||||
): ViewerImagePreviewSelectViewModel.Factory = ViewerImagePreviewSelectViewModel.Factory(
|
||||
objectSetState = state,
|
||||
objectState = state,
|
||||
session = session,
|
||||
dispatcher = dispatcher,
|
||||
updateDataViewViewer = updateDataViewViewer
|
||||
updateDataViewViewer = updateDataViewViewer,
|
||||
storeOfRelations = storeOfRelations
|
||||
)
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package com.anytypeio.anytype.di.main
|
||||
|
||||
import com.anytypeio.anytype.middleware.interactor.LocalNetworkAddressHandler
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module
|
||||
class LocalNetworkAddressModule {
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
fun provideHandler(): LocalNetworkAddressHandler = LocalNetworkAddressHandler()
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
package com.anytypeio.anytype.di.main
|
||||
|
||||
import android.content.Context
|
||||
import android.net.nsd.NsdManager
|
||||
import android.net.wifi.WifiManager
|
||||
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
||||
import com.anytypeio.anytype.middleware.discovery.MDNSDelegate
|
||||
import com.anytypeio.anytype.middleware.discovery.MDNSResolver
|
||||
import com.anytypeio.anytype.middleware.discovery.NsdDiscoveryListener
|
||||
import com.anytypeio.anytype.middleware.discovery.NsdRegistrationListener
|
||||
import com.anytypeio.anytype.middleware.discovery.adresshandler.DefaultInterfaceProvider
|
||||
import com.anytypeio.anytype.middleware.discovery.adresshandler.LocalNetworkAddressProvider
|
||||
import dagger.Binds
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import javax.inject.Singleton
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import service.InterfaceGetter
|
||||
|
||||
@Module(includes = [LocalNetworkProviderModule.Bindings::class])
|
||||
class LocalNetworkProviderModule {
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
fun provideHandler(
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
interfaceGetter: InterfaceGetter,
|
||||
): LocalNetworkAddressProvider =
|
||||
LocalNetworkAddressProvider(GlobalScope, dispatchers.io, interfaceGetter)
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
fun provideMDNSDelegate(
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
resolver: MDNSResolver
|
||||
): MDNSDelegate = MDNSDelegate(GlobalScope, dispatchers.io, resolver)
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
fun provideNsdDiscoveryListener(
|
||||
nsdManager: NsdManager,
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
): NsdDiscoveryListener = NsdDiscoveryListener(GlobalScope, dispatchers.io, nsdManager)
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
fun provideNsdManager(
|
||||
context: Context
|
||||
): NsdManager = (context.getSystemService(Context.NSD_SERVICE) as NsdManager)
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
fun provideWifiManager(
|
||||
context: Context
|
||||
): WifiManager = (context.getSystemService(Context.WIFI_SERVICE) as WifiManager)
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
fun provideMDNSResolver(
|
||||
nsdManager: NsdManager,
|
||||
wifiManager: WifiManager,
|
||||
discoveryListener: NsdDiscoveryListener,
|
||||
registrationListener: NsdRegistrationListener
|
||||
): MDNSResolver = MDNSResolver(
|
||||
nsdManager,
|
||||
wifiManager,
|
||||
discoveryListener,
|
||||
registrationListener
|
||||
)
|
||||
|
||||
@Module
|
||||
interface Bindings {
|
||||
|
||||
@Singleton
|
||||
@Binds
|
||||
fun bindInterfaceGetter(
|
||||
provider: DefaultInterfaceProvider
|
||||
): InterfaceGetter
|
||||
}
|
||||
}
|
|
@ -57,7 +57,7 @@ import javax.inject.Singleton
|
|||
EmojiModule::class,
|
||||
ClipboardModule::class,
|
||||
AnalyticsModule::class,
|
||||
LocalNetworkAddressModule::class,
|
||||
LocalNetworkProviderModule::class,
|
||||
SubscriptionsModule::class
|
||||
]
|
||||
)
|
||||
|
|
|
@ -225,7 +225,7 @@ class Navigator : AppNavigation {
|
|||
R.id.dataViewNavigation,
|
||||
bundleOf(ObjectSetFragment.CONTEXT_ID_KEY to target),
|
||||
navOptions {
|
||||
popUpTo(R.id.objectNavigation) { inclusive = true }
|
||||
popUpTo(R.id.main_navigation) { inclusive = true }
|
||||
}
|
||||
)
|
||||
} else {
|
||||
|
|
|
@ -2086,11 +2086,11 @@ open class EditorFragment : NavigationFragment<FragmentEditorBinding>(R.layout.f
|
|||
}
|
||||
|
||||
override fun onProceedWithUpdateType(id: Id) {
|
||||
vm.onObjectTypeChanged(type = id, isObjectDraft = false)
|
||||
vm.onObjectTypeChanged(type = id, applyTemplate = false)
|
||||
}
|
||||
|
||||
override fun onProceedWithDraftUpdateType(id: Id) {
|
||||
vm.onObjectTypeChanged(type = id, isObjectDraft = true)
|
||||
vm.onObjectTypeChanged(type = id, applyTemplate = true)
|
||||
}
|
||||
|
||||
private fun observeNavBackStack() {
|
||||
|
|
|
@ -22,6 +22,7 @@ import com.anytypeio.anytype.core_utils.ext.toast
|
|||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.domain.base.BaseUseCase
|
||||
import com.anytypeio.anytype.domain.theme.GetTheme
|
||||
import com.anytypeio.anytype.middleware.discovery.MDNSProvider
|
||||
import com.anytypeio.anytype.navigation.Navigator
|
||||
import com.anytypeio.anytype.presentation.editor.cover.CoverGradient
|
||||
import com.anytypeio.anytype.presentation.main.MainViewModel
|
||||
|
@ -31,10 +32,10 @@ import com.anytypeio.anytype.presentation.navigation.AppNavigation
|
|||
import com.anytypeio.anytype.presentation.wallpaper.WallpaperColor
|
||||
import com.anytypeio.anytype.ui.editor.CreateObjectFragment
|
||||
import com.anytypeio.anytype.ui_settings.appearance.ThemeApplicator
|
||||
import javax.inject.Inject
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
class MainActivity : AppCompatActivity(R.layout.activity_main), AppNavigation.Provider {
|
||||
|
||||
|
@ -54,6 +55,9 @@ class MainActivity : AppCompatActivity(R.layout.activity_main), AppNavigation.Pr
|
|||
@Inject
|
||||
lateinit var themeApplicator: ThemeApplicator
|
||||
|
||||
@Inject
|
||||
lateinit var mdnsProvider: MDNSProvider
|
||||
|
||||
val container: FragmentContainerView get() = findViewById(R.id.fragment)
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
@ -159,16 +163,19 @@ class MainActivity : AppCompatActivity(R.layout.activity_main), AppNavigation.Pr
|
|||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
mdnsProvider.start()
|
||||
navigator.bind(findNavController(R.id.fragment))
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
mdnsProvider.stop()
|
||||
navigator.unbind()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
mdnsProvider.stop()
|
||||
release()
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import com.google.android.material.tabs.TabLayoutMediator
|
|||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
@Deprecated("Legacy screen, is not used")
|
||||
class PageNavigationFragment
|
||||
: ViewStateFragment<ViewState<PageNavigationView>, FragmentPageNavigationBinding>(R.layout.fragment_page_navigation) {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ class AppDefaultObjectTypeFragment : BaseObjectTypeChangeFragment() {
|
|||
|
||||
override fun startWithParams() {
|
||||
vm.onStart(
|
||||
isWithSet = false,
|
||||
isWithCollection = false,
|
||||
isWithBookmark = false,
|
||||
isSetSource = false
|
||||
)
|
||||
|
|
|
@ -15,7 +15,7 @@ class DataViewSelectSourceFragment : BaseObjectTypeChangeFragment() {
|
|||
|
||||
override fun startWithParams() {
|
||||
vm.onStart(
|
||||
isWithSet = true,
|
||||
isWithCollection = true,
|
||||
isWithBookmark = true,
|
||||
excludeTypes = emptyList(),
|
||||
selectedTypes = selectedTypes,
|
||||
|
|
|
@ -15,7 +15,7 @@ class DraftObjectSelectTypeFragment : BaseObjectTypeChangeFragment() {
|
|||
|
||||
override fun startWithParams() {
|
||||
vm.onStart(
|
||||
isWithSet = true,
|
||||
isWithCollection = true,
|
||||
isWithBookmark = false,
|
||||
excludeTypes = excludeTypes,
|
||||
selectedTypes = emptyList(),
|
||||
|
|
|
@ -14,7 +14,7 @@ class EmptyDataViewSelectSourceFragment : BaseObjectTypeChangeFragment() {
|
|||
|
||||
override fun startWithParams() {
|
||||
vm.onStart(
|
||||
isWithSet = false,
|
||||
isWithCollection = false,
|
||||
isWithBookmark = true,
|
||||
excludeTypes = emptyList(),
|
||||
selectedTypes = emptyList(),
|
||||
|
|
|
@ -15,7 +15,7 @@ class ObjectSelectTypeFragment : BaseObjectTypeChangeFragment() {
|
|||
|
||||
override fun startWithParams() {
|
||||
vm.onStart(
|
||||
isWithSet = false,
|
||||
isWithCollection = false,
|
||||
isWithBookmark = false,
|
||||
excludeTypes = excludeTypes,
|
||||
selectedTypes = emptyList(),
|
||||
|
|
|
@ -13,11 +13,14 @@ import android.view.ViewGroup
|
|||
import android.view.animation.AccelerateDecelerateInterpolator
|
||||
import android.view.inputmethod.EditorInfo.IME_ACTION_DONE
|
||||
import android.view.inputmethod.EditorInfo.IME_ACTION_GO
|
||||
import android.widget.Button
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.activity.addCallback
|
||||
import androidx.constraintlayout.motion.widget.MotionLayout
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.core.view.WindowInsetsAnimationCompat.Callback.DISPATCH_MODE_STOP
|
||||
import androidx.core.view.children
|
||||
|
@ -44,6 +47,7 @@ import com.anytypeio.anytype.core_ui.tools.DefaultTextWatcher
|
|||
import com.anytypeio.anytype.core_ui.widgets.FeaturedRelationGroupWidget
|
||||
import com.anytypeio.anytype.core_ui.widgets.StatusBadgeWidget
|
||||
import com.anytypeio.anytype.core_ui.widgets.text.TextInputWidget
|
||||
import com.anytypeio.anytype.core_ui.widgets.toolbar.DataViewInfo
|
||||
import com.anytypeio.anytype.core_utils.OnSwipeListener
|
||||
import com.anytypeio.anytype.core_utils.ext.argString
|
||||
import com.anytypeio.anytype.core_utils.ext.dimen
|
||||
|
@ -64,6 +68,7 @@ import com.anytypeio.anytype.di.common.componentManager
|
|||
import com.anytypeio.anytype.presentation.editor.cover.CoverColor
|
||||
import com.anytypeio.anytype.presentation.editor.cover.CoverGradient
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.sets.DataViewViewState
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetCommand
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetViewModelFactory
|
||||
|
@ -104,6 +109,9 @@ open class ObjectSetFragment :
|
|||
private val title: TextInputWidget
|
||||
get() = binding.objectHeader.root.findViewById(R.id.tvSetTitle)
|
||||
|
||||
private val header: LinearLayout
|
||||
get() = binding.objectHeader.root
|
||||
|
||||
private val topToolbarTitle: TextView
|
||||
get() = binding.topToolbar.root.findViewById(R.id.tvTopToolbarTitle)
|
||||
|
||||
|
@ -120,13 +128,13 @@ open class ObjectSetFragment :
|
|||
get() = binding.topToolbar.root.findViewById(R.id.tvStatus)
|
||||
|
||||
private val addNewButton: TextView
|
||||
get() = binding.dataViewHeader.root.findViewById(R.id.addNewButton)
|
||||
get() = binding.dataViewHeader.addNewButton
|
||||
|
||||
private val customizeViewButton: ImageView
|
||||
get() = binding.dataViewHeader.root.findViewById(R.id.customizeViewButton)
|
||||
get() = binding.dataViewHeader.customizeViewButton
|
||||
|
||||
private val tvCurrentViewerName: TextView
|
||||
get() = binding.dataViewHeader.root.findViewById(R.id.tvCurrentViewerName)
|
||||
get() = binding.dataViewHeader.tvCurrentViewerName
|
||||
|
||||
private val menuButton: FrameLayout
|
||||
get() = binding.topToolbar.root.findViewById(R.id.threeDotsButton)
|
||||
|
@ -134,6 +142,14 @@ open class ObjectSetFragment :
|
|||
private val featuredRelations: FeaturedRelationGroupWidget
|
||||
get() = binding.objectHeader.root.findViewById(R.id.featuredRelationsWidget)
|
||||
|
||||
private val dataViewHeader: ConstraintLayout
|
||||
get() = binding.dataViewHeader.root
|
||||
|
||||
private val viewerTitle: TextView
|
||||
get() = binding.dataViewHeader.root.findViewById(R.id.tvCurrentViewerName)
|
||||
|
||||
private val initView: View get() = binding.initState.root
|
||||
private val dataViewInfo: DataViewInfo get() = binding.dataViewInfo
|
||||
private val rvHeaders: RecyclerView get() = binding.root.findViewById(R.id.rvHeader)
|
||||
private val rvRows: RecyclerView get() = binding.root.findViewById(R.id.rvRows)
|
||||
|
||||
|
@ -189,6 +205,14 @@ open class ObjectSetFragment :
|
|||
|
||||
with(lifecycleScope) {
|
||||
subscribe(addNewButton.clicks().throttleFirst()) { vm.onCreateNewDataViewObject() }
|
||||
subscribe(dataViewInfo.clicks().throttleFirst()) { type ->
|
||||
when (type) {
|
||||
DataViewInfo.TYPE.COLLECTION_NO_ITEMS -> vm.onCreateObjectInCollectionClicked()
|
||||
DataViewInfo.TYPE.SET_NO_QUERY -> vm.onSelectQueryButtonClicked()
|
||||
DataViewInfo.TYPE.SET_NO_ITEMS -> vm.onCreateNewDataViewObject()
|
||||
DataViewInfo.TYPE.INIT -> {}
|
||||
}
|
||||
}
|
||||
subscribe(title.editorActionEvents(actionHandler)) {
|
||||
title.apply {
|
||||
hideKeyboard()
|
||||
|
@ -264,11 +288,11 @@ open class ObjectSetFragment :
|
|||
)
|
||||
|
||||
setFragmentResultListener(BaseObjectTypeChangeFragment.OBJECT_TYPE_REQUEST_KEY) { _, bundle ->
|
||||
val source = bundle.getString(BaseObjectTypeChangeFragment.OBJECT_TYPE_URL_KEY)
|
||||
if (source != null) {
|
||||
vm.onDataViewQueryPicked(source = source)
|
||||
val query = bundle.getString(BaseObjectTypeChangeFragment.OBJECT_TYPE_URL_KEY)
|
||||
if (query != null) {
|
||||
vm.onObjectSetQueryPicked(query = query)
|
||||
} else {
|
||||
toast("Error while setting Set source. Source is empty")
|
||||
toast("Error while setting the Set query. The query is empty")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -340,7 +364,7 @@ open class ObjectSetFragment :
|
|||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
vm.navigation.observe(viewLifecycleOwner, navObserver)
|
||||
lifecycleScope.subscribe(vm.toasts.stream()) { toast(it) }
|
||||
lifecycleScope.subscribe(vm.toasts) { toast(it) }
|
||||
lifecycleScope.subscribe(vm.status) { setStatus(it) }
|
||||
lifecycleScope.subscribe(vm.isCustomizeViewPanelVisible) { isCustomizeViewPanelVisible ->
|
||||
if (isCustomizeViewPanelVisible) showBottomPanel() else hideBottomPanel()
|
||||
|
@ -359,13 +383,106 @@ open class ObjectSetFragment :
|
|||
}
|
||||
}
|
||||
|
||||
private fun setupViewer(viewer: Viewer?) {
|
||||
binding.dataViewHeader.root.findViewById<TextView>(R.id.tvCurrentViewerName).text =
|
||||
viewer?.title
|
||||
private fun setupDataViewViewState(state: DataViewViewState) {
|
||||
when (state) {
|
||||
DataViewViewState.Collection.NoView, DataViewViewState.Set.NoView -> {
|
||||
topToolbarThreeDotsButton.visible()
|
||||
topToolbarStatusContainer.visible()
|
||||
initView.gone()
|
||||
dataViewHeader.gone()
|
||||
dataViewInfo.hide()
|
||||
toast(getString(R.string.set_collection_view_not_present))
|
||||
setViewer(viewer = null)
|
||||
}
|
||||
is DataViewViewState.Collection.NoItems -> {
|
||||
topToolbarThreeDotsButton.visible()
|
||||
topToolbarStatusContainer.visible()
|
||||
initView.gone()
|
||||
header.visible()
|
||||
dataViewHeader.visible()
|
||||
viewerTitle.isEnabled = true
|
||||
addNewButton.isEnabled = true
|
||||
customizeViewButton.isEnabled = true
|
||||
viewerTitle.text = state.title
|
||||
dataViewInfo.show(DataViewInfo.TYPE.COLLECTION_NO_ITEMS)
|
||||
setViewer(viewer = null)
|
||||
}
|
||||
is DataViewViewState.Collection.Default -> {
|
||||
topToolbarThreeDotsButton.visible()
|
||||
topToolbarStatusContainer.visible()
|
||||
initView.gone()
|
||||
dataViewHeader.visible()
|
||||
viewerTitle.isEnabled = true
|
||||
addNewButton.isEnabled = true
|
||||
customizeViewButton.isEnabled = true
|
||||
viewerTitle.text = state.viewer?.title ?: getString(R.string.viewer_default_title)
|
||||
dataViewInfo.hide()
|
||||
setViewer(viewer = state.viewer)
|
||||
}
|
||||
DataViewViewState.Set.NoQuery -> {
|
||||
topToolbarThreeDotsButton.visible()
|
||||
topToolbarStatusContainer.visible()
|
||||
initView.gone()
|
||||
header.visible()
|
||||
dataViewHeader.visible()
|
||||
viewerTitle.isEnabled = false
|
||||
addNewButton.isEnabled = false
|
||||
customizeViewButton.isEnabled = false
|
||||
viewerTitle.text = getString(R.string.viewer_default_title)
|
||||
dataViewInfo.show(type = DataViewInfo.TYPE.SET_NO_QUERY)
|
||||
setViewer(viewer = null)
|
||||
}
|
||||
is DataViewViewState.Set.NoItems -> {
|
||||
topToolbarThreeDotsButton.visible()
|
||||
topToolbarStatusContainer.visible()
|
||||
initView.gone()
|
||||
header.visible()
|
||||
dataViewHeader.visible()
|
||||
viewerTitle.isEnabled = true
|
||||
addNewButton.isEnabled = true
|
||||
customizeViewButton.isEnabled = true
|
||||
viewerTitle.text = state.title
|
||||
dataViewInfo.show(type = DataViewInfo.TYPE.SET_NO_ITEMS, extra = state.type)
|
||||
setViewer(viewer = null)
|
||||
|
||||
}
|
||||
is DataViewViewState.Set.Default -> {
|
||||
topToolbarThreeDotsButton.visible()
|
||||
topToolbarStatusContainer.visible()
|
||||
initView.gone()
|
||||
header.visible()
|
||||
viewerTitle.isEnabled = true
|
||||
addNewButton.isEnabled = true
|
||||
customizeViewButton.isEnabled = true
|
||||
viewerTitle.text = state.viewer?.title ?: getString(R.string.viewer_default_title)
|
||||
setViewer(viewer = state.viewer)
|
||||
dataViewInfo.hide()
|
||||
}
|
||||
DataViewViewState.Init -> {
|
||||
topToolbarThreeDotsButton.invisible()
|
||||
topToolbarStatusContainer.invisible()
|
||||
header.gone()
|
||||
dataViewHeader.invisible()
|
||||
initView.visible()
|
||||
dataViewInfo.hide()
|
||||
setViewer(viewer = null)
|
||||
}
|
||||
is DataViewViewState.Error -> {
|
||||
topToolbarThreeDotsButton.visible()
|
||||
topToolbarStatusContainer.visible()
|
||||
initView.gone()
|
||||
dataViewHeader.gone()
|
||||
toast(state.msg)
|
||||
dataViewInfo.hide()
|
||||
setViewer(viewer = null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setViewer(viewer: Viewer?) {
|
||||
when (viewer) {
|
||||
is Viewer.GridView -> {
|
||||
with(binding) {
|
||||
dataViewHeader.root.visible()
|
||||
unsupportedViewError.gone()
|
||||
unsupportedViewError.text = null
|
||||
galleryView.clear()
|
||||
|
@ -380,7 +497,6 @@ open class ObjectSetFragment :
|
|||
viewerGridHeaderAdapter.submitList(emptyList())
|
||||
viewerGridAdapter.submitList(emptyList())
|
||||
with(binding) {
|
||||
dataViewHeader.root.visible()
|
||||
unsupportedViewError.gone()
|
||||
unsupportedViewError.text = null
|
||||
listView.gone()
|
||||
|
@ -396,7 +512,6 @@ open class ObjectSetFragment :
|
|||
viewerGridHeaderAdapter.submitList(emptyList())
|
||||
viewerGridAdapter.submitList(emptyList())
|
||||
with(binding) {
|
||||
dataViewHeader.root.visible()
|
||||
unsupportedViewError.gone()
|
||||
unsupportedViewError.text = null
|
||||
galleryView.gone()
|
||||
|
@ -409,7 +524,6 @@ open class ObjectSetFragment :
|
|||
viewerGridHeaderAdapter.submitList(emptyList())
|
||||
viewerGridAdapter.submitList(emptyList())
|
||||
with(binding) {
|
||||
dataViewHeader.root.visible()
|
||||
galleryView.gone()
|
||||
galleryView.clear()
|
||||
listView.gone()
|
||||
|
@ -422,7 +536,6 @@ open class ObjectSetFragment :
|
|||
viewerGridHeaderAdapter.submitList(emptyList())
|
||||
viewerGridAdapter.submitList(emptyList())
|
||||
with(binding) {
|
||||
dataViewHeader.root.invisible()
|
||||
galleryView.gone()
|
||||
galleryView.clear()
|
||||
listView.gone()
|
||||
|
@ -784,7 +897,7 @@ open class ObjectSetFragment :
|
|||
super.onStart()
|
||||
jobs += lifecycleScope.subscribe(vm.commands) { observeCommands(it) }
|
||||
jobs += lifecycleScope.subscribe(vm.header.filterNotNull()) { bindHeader(it) }
|
||||
jobs += lifecycleScope.subscribe(vm.currentViewer) { setupViewer(it) }
|
||||
jobs += lifecycleScope.subscribe(vm.currentViewer) { setupDataViewViewState(it) }
|
||||
jobs += lifecycleScope.subscribe(vm.error) { err ->
|
||||
if (err.isNullOrEmpty())
|
||||
binding.tvError.gone()
|
||||
|
@ -801,20 +914,12 @@ open class ObjectSetFragment :
|
|||
binding.paginatorToolbar.gone()
|
||||
}
|
||||
}
|
||||
jobs += lifecycleScope.subscribe(vm.isLoading) { isLoading ->
|
||||
if (isLoading) {
|
||||
binding.dvProgressBar.show()
|
||||
} else {
|
||||
binding.dvProgressBar.hide()
|
||||
}
|
||||
}
|
||||
jobs += lifecycleScope.subscribe(vm.featured) { featured ->
|
||||
if (featured != null) {
|
||||
featuredRelations.visible()
|
||||
featuredRelations.set(
|
||||
item = featured,
|
||||
click = vm::onClickListener,
|
||||
isObjectSet = true
|
||||
click = vm::onClickListener
|
||||
)
|
||||
} else {
|
||||
featuredRelations.clear()
|
||||
|
@ -880,7 +985,7 @@ open class ObjectSetFragment :
|
|||
}
|
||||
|
||||
override fun onProceedWithSelectSource(id: Id) {
|
||||
vm.onDataViewQueryPicked(source = id)
|
||||
vm.onObjectSetQueryPicked(query = id)
|
||||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
|
|
|
@ -30,7 +30,7 @@ class ViewerCardSizeSelectFragment : BaseBottomSheetFragment<FragmentViewerCardS
|
|||
vm.onLargeCardClicked(ctx)
|
||||
}
|
||||
with(lifecycleScope) {
|
||||
subscribe(vm.state) { state ->
|
||||
subscribe(vm.viewState) { state ->
|
||||
when (state) {
|
||||
ViewerCardSizeSelectViewModel.STATE_DISMISSED -> dismiss()
|
||||
ViewerCardSizeSelectViewModel.STATE_LARGE_CARD_SELECTED -> {
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="16dp"
|
||||
android:height="16dp"
|
||||
android:viewportWidth="16"
|
||||
android:viewportHeight="16">
|
||||
<path
|
||||
android:fillColor="@color/text_primary"
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M2.4697,5.4697C2.7626,5.1768 3.2374,5.1768 3.5303,5.4697L8,9.9393L12.4697,5.4697C12.7626,5.1768 13.2374,5.1768 13.5303,5.4697C13.8232,5.7626 13.8232,6.2374 13.5303,6.5303L8,12.0607L2.4697,6.5303C2.1768,6.2374 2.1768,5.7626 2.4697,5.4697Z" />
|
||||
</vector>
|
|
@ -8,17 +8,8 @@
|
|||
android:background="@color/background_primary"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
app:layoutDescription="@xml/fragment_object_set_scene">
|
||||
|
||||
<com.google.android.material.progressindicator.LinearProgressIndicator
|
||||
android:id="@+id/dvProgressBar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true"
|
||||
app:indicatorColor="@color/gray"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/gridContainer"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
app:layoutDescription="@xml/fragment_object_set_scene"
|
||||
tools:context="com.anytypeio.anytype.ui.sets.ObjectSetFragment">
|
||||
|
||||
<include
|
||||
android:id="@+id/objectHeader"
|
||||
|
@ -33,7 +24,7 @@
|
|||
android:id="@+id/dataViewHeader"
|
||||
layout="@layout/layout_object_set_dv_header"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/default_toolbar_height"
|
||||
android:layout_height="@dimen/default_collection_dv_header_height"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/objectHeader" />
|
||||
|
@ -138,4 +129,22 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.anytypeio.anytype.core_ui.widgets.toolbar.DataViewInfo
|
||||
android:id="@+id/dataViewInfo"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="190dp"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/dataViewHeader"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<include
|
||||
android:id="@+id/initState"
|
||||
layout="@layout/collection_loading_state"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</androidx.constraintlayout.motion.widget.MotionLayout>
|
|
@ -1,64 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/dataViewToolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/switchViewContainer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCurrentViewerName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_weight="01"
|
||||
android:drawablePadding="2dp"
|
||||
android:fontFamily="@font/inter_semibold"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="17sp"
|
||||
app:drawableEndCompat="@drawable/ic_arrow_expand_dv_viewer"
|
||||
tools:text="All Pages" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/customizeViewButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/content_description_customize_view_button"
|
||||
android:src="@drawable/ic_dv_customize_view" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/addNewButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:background="@drawable/bg_set_new_button"
|
||||
android:drawableStart="@drawable/ic_plus_white_12"
|
||||
android:drawablePadding="4dp"
|
||||
android:fontFamily="@font/inter_medium"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:text="New"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
|
@ -86,7 +86,7 @@
|
|||
|
||||
<com.anytypeio.anytype.core_ui.widgets.FeaturedRelationGroupWidget
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:id="@+id/featuredRelationsWidget"
|
||||
|
|
|
@ -153,7 +153,6 @@ Do the computation of an expensive paragraph of text on a background thread:
|
|||
<string name="hint_type_name_for_new_relation">Name for new relation</string>
|
||||
<string name="dv_create_new_object">New</string>
|
||||
<string name="content_description_plus_button">Plus button</string>
|
||||
<string name="content_description_customize_view_button">Customize-view button</string>
|
||||
<string name="content_description_image_icon">Image icon</string>
|
||||
<string name="content_description_emoji_icon">Emoji icon</string>
|
||||
<string name="sort_by">Sort by</string>
|
||||
|
@ -219,6 +218,7 @@ Do the computation of an expensive paragraph of text on a background thread:
|
|||
<string name="inbox">Inbox</string>
|
||||
<string name="unknown_type">Unknown type</string>
|
||||
<string name="set">Set</string>
|
||||
<string name="collection">Collection</string>
|
||||
<string name="layout">Layout</string>
|
||||
<string name="restore_from_archive">Restore from archive</string>
|
||||
<string name="icon">Icon</string>
|
||||
|
|
|
@ -14,19 +14,18 @@
|
|||
<ConstraintSet android:id="@+id/start">
|
||||
<Constraint
|
||||
android:id="@+id/objectHeader"
|
||||
layout="@layout/layout_object_set_header"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
motion:layout_constraintEnd_toEndOf="parent"
|
||||
motion:layout_constraintStart_toStartOf="parent"
|
||||
motion:layout_constraintTop_toTopOf="parent">
|
||||
motion:layout_constraintTop_toTopOf="parent"
|
||||
motion:visibilityMode="ignore">
|
||||
<PropertySet android:alpha="1" />
|
||||
</Constraint>
|
||||
<Constraint
|
||||
android:id="@+id/dataViewHeader"
|
||||
layout="@layout/layout_object_set_dv_header"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/default_toolbar_height"
|
||||
android:layout_height="@dimen/default_collection_dv_header_height"
|
||||
motion:layout_constraintEnd_toEndOf="parent"
|
||||
motion:layout_constraintStart_toStartOf="parent"
|
||||
motion:layout_constraintTop_toBottomOf="@+id/objectHeader"
|
||||
|
@ -74,28 +73,44 @@
|
|||
motion:layout_constraintStart_toStartOf="parent"
|
||||
motion:layout_constraintTop_toBottomOf="@+id/controlDivider2"
|
||||
motion:visibilityMode="ignore" />
|
||||
<Constraint
|
||||
android:id="@+id/dataViewInfo"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="190dp"
|
||||
motion:layout_constraintEnd_toEndOf="parent"
|
||||
motion:layout_constraintStart_toStartOf="parent"
|
||||
motion:layout_constraintTop_toBottomOf="@id/dataViewHeader"
|
||||
motion:visibilityMode="ignore" />
|
||||
<Constraint
|
||||
android:id="@id/initState"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
motion:layout_constraintBottom_toBottomOf="parent"
|
||||
motion:layout_constraintEnd_toEndOf="parent"
|
||||
motion:layout_constraintStart_toStartOf="parent"
|
||||
motion:layout_constraintTop_toTopOf="parent"
|
||||
motion:visibilityMode="ignore" />
|
||||
</ConstraintSet>
|
||||
|
||||
<ConstraintSet android:id="@+id/end">
|
||||
<Constraint
|
||||
android:id="@+id/objectHeader"
|
||||
layout="@layout/layout_object_set_header"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
motion:layout_constraintBottom_toTopOf="parent"
|
||||
motion:layout_constraintEnd_toEndOf="parent"
|
||||
motion:layout_constraintStart_toStartOf="parent">
|
||||
motion:layout_constraintStart_toStartOf="parent"
|
||||
motion:visibilityMode="ignore">
|
||||
<PropertySet android:alpha="0" />
|
||||
</Constraint>
|
||||
<Constraint
|
||||
android:id="@+id/dataViewHeader"
|
||||
layout="@layout/layout_object_set_dv_header"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/default_toolbar_height"
|
||||
android:layout_height="@dimen/default_collection_dv_header_height"
|
||||
motion:layout_constraintEnd_toEndOf="parent"
|
||||
motion:layout_constraintStart_toStartOf="parent"
|
||||
motion:layout_constraintTop_toBottomOf="@+id/topToolbar"
|
||||
motion:visibilityMode="ignore"/>
|
||||
motion:visibilityMode="ignore" />
|
||||
<Constraint
|
||||
android:id="@+id/controlDivider2"
|
||||
android:layout_width="0dp"
|
||||
|
@ -103,7 +118,7 @@
|
|||
motion:layout_constraintEnd_toEndOf="parent"
|
||||
motion:layout_constraintStart_toStartOf="parent"
|
||||
motion:layout_constraintTop_toBottomOf="@+id/dataViewHeader"
|
||||
motion:visibilityMode="ignore"/>
|
||||
motion:visibilityMode="ignore" />
|
||||
<Constraint
|
||||
android:id="@+id/paginatorToolbar"
|
||||
android:layout_width="0dp"
|
||||
|
@ -139,6 +154,23 @@
|
|||
motion:layout_constraintStart_toStartOf="parent"
|
||||
motion:layout_constraintTop_toBottomOf="@+id/controlDivider2"
|
||||
motion:visibilityMode="ignore" />
|
||||
<Constraint
|
||||
android:id="@+id/dataViewInfo"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="190dp"
|
||||
motion:layout_constraintEnd_toEndOf="parent"
|
||||
motion:layout_constraintStart_toStartOf="parent"
|
||||
motion:layout_constraintTop_toBottomOf="@id/dataViewHeader"
|
||||
motion:visibilityMode="ignore" />
|
||||
<Constraint
|
||||
android:id="@id/initState"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
motion:layout_constraintBottom_toBottomOf="parent"
|
||||
motion:layout_constraintEnd_toEndOf="parent"
|
||||
motion:layout_constraintStart_toStartOf="parent"
|
||||
motion:layout_constraintTop_toTopOf="parent"
|
||||
motion:visibilityMode="ignore" />
|
||||
</ConstraintSet>
|
||||
|
||||
</MotionScene>
|
|
@ -285,10 +285,8 @@ data class Block(
|
|||
|
||||
data class DataView(
|
||||
val viewers: List<Viewer>,
|
||||
@Deprecated("To be deleted")
|
||||
val relations: List<Relation>,
|
||||
val relationsIndex: List<RelationLink> = emptyList(),
|
||||
val targetObjectId: Id = "",
|
||||
val relationLinks: List<RelationLink> = emptyList(),
|
||||
val targetObjectId: Id = ""
|
||||
) : Content() {
|
||||
|
||||
data class Viewer(
|
||||
|
|
|
@ -418,4 +418,7 @@ sealed class Command {
|
|||
data class UpdateRelation(val ctx: Id, val dv: Id, val view: Id, val relation: DVViewerRelation)
|
||||
data class DeleteRelation(val ctx: Id, val dv: Id, val view: Id, val keys: List<Key>)
|
||||
data class SortRelations(val ctx: Id, val dv: Id, val view: Id, val keys: List<Key>)
|
||||
|
||||
data class AddObjectToCollection(val ctx: Id, val afterId: Id, val ids: List<Id>)
|
||||
data class SetQueryToSet(val ctx: Id, val query: String)
|
||||
}
|
|
@ -45,6 +45,7 @@ data class ObjectType(
|
|||
SPACE(10),
|
||||
BOOKMARK(11),
|
||||
DATABASE(20),
|
||||
COLLECTION(14)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,6 +13,7 @@ object ObjectTypeIds {
|
|||
const val VIDEO = "ot-video"
|
||||
const val AUDIO = "ot-audio"
|
||||
const val SET = "ot-set"
|
||||
const val COLLECTION = "ot-collection"
|
||||
const val TASK = "ot-task"
|
||||
const val DATE = "ot-date"
|
||||
const val PROFILE = "ot-profile" //contains User Profile page and Anytype Person page
|
||||
|
|
|
@ -9,6 +9,7 @@ enum class SmartBlockType(val code: Int) {
|
|||
ARCHIVE(code = 48),
|
||||
DATABASE(code = 64),
|
||||
SET(code = 65),
|
||||
COLLECTION(code = 66),
|
||||
CUSTOM_OBJECT_TYPE(code = 96),
|
||||
FILE(code = 256),
|
||||
TEMPLATE(code = 288),
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.anytypeio.anytype.presentation.editor.editor.Markup
|
|||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView.Indentable
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Focusable
|
||||
import com.anytypeio.anytype.presentation.relations.DocumentRelationView
|
||||
import com.anytypeio.anytype.presentation.relations.ObjectRelationView
|
||||
import timber.log.Timber
|
||||
|
||||
class BlockViewDiffUtil(
|
||||
|
@ -198,33 +198,33 @@ class BlockViewDiffUtil(
|
|||
}
|
||||
|
||||
when {
|
||||
newRelationView is DocumentRelationView.Default && oldRelationView is DocumentRelationView.Default -> {
|
||||
newRelationView is ObjectRelationView.Default && oldRelationView is ObjectRelationView.Default -> {
|
||||
if (newBlock.view.value != oldBlock.view.value) {
|
||||
changes.add(RELATION_VALUE_CHANGED)
|
||||
}
|
||||
}
|
||||
newRelationView is DocumentRelationView.Checkbox && oldRelationView is DocumentRelationView.Checkbox -> {
|
||||
newRelationView is ObjectRelationView.Checkbox && oldRelationView is ObjectRelationView.Checkbox -> {
|
||||
if (newRelationView.isChecked != oldRelationView.isChecked) {
|
||||
changes.add(RELATION_VALUE_CHANGED)
|
||||
}
|
||||
}
|
||||
newRelationView is DocumentRelationView.Status && oldRelationView is DocumentRelationView.Status -> {
|
||||
newRelationView is ObjectRelationView.Status && oldRelationView is ObjectRelationView.Status -> {
|
||||
if (newRelationView.status != oldRelationView.status) {
|
||||
changes.add(RELATION_VALUE_CHANGED)
|
||||
}
|
||||
}
|
||||
newRelationView is DocumentRelationView.Tags && oldRelationView is DocumentRelationView.Tags -> {
|
||||
newRelationView is ObjectRelationView.Tags && oldRelationView is ObjectRelationView.Tags -> {
|
||||
if (newRelationView.tags != oldRelationView.tags) {
|
||||
changes.add(RELATION_VALUE_CHANGED)
|
||||
}
|
||||
}
|
||||
newRelationView is DocumentRelationView.Object && oldRelationView is DocumentRelationView.Object -> {
|
||||
newRelationView is ObjectRelationView.Object && oldRelationView is ObjectRelationView.Object -> {
|
||||
if (newRelationView.objects != oldRelationView.objects) {
|
||||
changes.add(RELATION_VALUE_CHANGED)
|
||||
}
|
||||
}
|
||||
|
||||
newRelationView is DocumentRelationView.File && oldRelationView is DocumentRelationView.File -> {
|
||||
newRelationView is ObjectRelationView.File && oldRelationView is ObjectRelationView.File -> {
|
||||
if (newRelationView.files != oldRelationView.files) {
|
||||
changes.add(RELATION_VALUE_CHANGED)
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import com.anytypeio.anytype.core_ui.widgets.text.TagWidget
|
|||
import com.anytypeio.anytype.core_utils.ext.gone
|
||||
import com.anytypeio.anytype.core_utils.ext.visible
|
||||
import com.anytypeio.anytype.core_models.ThemeColor
|
||||
import com.anytypeio.anytype.presentation.relations.DocumentRelationView
|
||||
import com.anytypeio.anytype.presentation.relations.ObjectRelationView
|
||||
import com.anytypeio.anytype.presentation.sets.model.ObjectView
|
||||
|
||||
sealed class ListRelationViewHolder(
|
||||
|
@ -32,11 +32,11 @@ sealed class ListRelationViewHolder(
|
|||
private val tvValue = binding.content.tvRelationValue
|
||||
private val systemIcon = binding.icSystem
|
||||
|
||||
fun bind(item: DocumentRelationView) {
|
||||
fun bind(item: ObjectRelationView) {
|
||||
tvTitle.text = item.name
|
||||
tvValue.apply {
|
||||
text = item.value
|
||||
if (item is DocumentRelationView.Default) {
|
||||
if (item is ObjectRelationView.Default) {
|
||||
when (item.format) {
|
||||
Relation.Format.SHORT_TEXT -> setHint(R.string.enter_text)
|
||||
Relation.Format.LONG_TEXT -> setHint(R.string.enter_text)
|
||||
|
@ -49,7 +49,7 @@ sealed class ListRelationViewHolder(
|
|||
}
|
||||
}
|
||||
}
|
||||
setSystemIcon(systemIcon, item.isSystem)
|
||||
setSystemIcon(systemIcon, item.system)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,10 +60,10 @@ sealed class ListRelationViewHolder(
|
|||
private val ivCheckbox = binding.content.ivRelationCheckbox
|
||||
private val systemIcon = binding.icSystem
|
||||
|
||||
fun bind(item: DocumentRelationView.Checkbox) = with(itemView) {
|
||||
fun bind(item: ObjectRelationView.Checkbox) = with(itemView) {
|
||||
tvTitle.text = item.name
|
||||
ivCheckbox.isSelected = item.isChecked
|
||||
setSystemIcon(systemIcon, item.isSystem)
|
||||
setSystemIcon(systemIcon, item.system)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ sealed class ListRelationViewHolder(
|
|||
private val tvValue = binding.content.tvRelationValue
|
||||
private val systemIcon = binding.icSystem
|
||||
|
||||
fun bind(item: DocumentRelationView.Status) {
|
||||
fun bind(item: ObjectRelationView.Status) {
|
||||
tvTitle.text = item.name
|
||||
tvValue.apply {
|
||||
if (item.status.isNotEmpty()) {
|
||||
|
@ -91,7 +91,7 @@ sealed class ListRelationViewHolder(
|
|||
text = null
|
||||
}
|
||||
}
|
||||
setSystemIcon(systemIcon, item.isSystem)
|
||||
setSystemIcon(systemIcon, item.system)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,14 +102,14 @@ sealed class ListRelationViewHolder(
|
|||
private val tvTitle = binding.content.tvRelationTitle
|
||||
private val systemIcon = binding.icSystem
|
||||
|
||||
fun bind(item: DocumentRelationView.Tags) = with(itemView) {
|
||||
fun bind(item: ObjectRelationView.Tags) = with(itemView) {
|
||||
tvTitle.text = item.name
|
||||
if (item.tags.isEmpty()) {
|
||||
placeholder.visible()
|
||||
} else {
|
||||
placeholder.gone()
|
||||
}
|
||||
setSystemIcon(systemIcon, item.isSystem)
|
||||
setSystemIcon(systemIcon, item.system)
|
||||
for (i in 0..MAX_VISIBLE_TAGS_INDEX) getViewByIndex(i)?.gone()
|
||||
item.tags.forEachIndexed { index, tagView ->
|
||||
when (index) {
|
||||
|
@ -144,14 +144,14 @@ sealed class ListRelationViewHolder(
|
|||
private val content = binding.content
|
||||
private val systemIcon = binding.icSystem
|
||||
|
||||
fun bind(item: DocumentRelationView.Object) {
|
||||
fun bind(item: ObjectRelationView.Object) {
|
||||
content.tvRelationTitle.text = item.name
|
||||
if (item.objects.isEmpty()) {
|
||||
placeholder.visible()
|
||||
} else {
|
||||
placeholder.gone()
|
||||
}
|
||||
setSystemIcon(systemIcon, item.isSystem)
|
||||
setSystemIcon(systemIcon, item.system)
|
||||
for (i in 0..MAX_VISIBLE_OBJECTS_INDEX) getViewByIndex(i)?.gone()
|
||||
item.objects.forEachIndexed { index, objectView ->
|
||||
when (index) {
|
||||
|
@ -191,14 +191,14 @@ sealed class ListRelationViewHolder(
|
|||
private val tvTitle = binding.content.tvRelationTitle
|
||||
private val systemIcon = binding.icSystem
|
||||
|
||||
fun bind(item: DocumentRelationView.File) = with(itemView) {
|
||||
fun bind(item: ObjectRelationView.File) = with(itemView) {
|
||||
tvTitle.text = item.name
|
||||
if (item.files.isEmpty()) {
|
||||
placeholder.visible()
|
||||
} else {
|
||||
placeholder.gone()
|
||||
}
|
||||
setSystemIcon(systemIcon, item.isSystem)
|
||||
setSystemIcon(systemIcon, item.system)
|
||||
item.files.forEachIndexed { index, fileView ->
|
||||
when (index) {
|
||||
in 0..MAX_VISIBLE_FILES_INDEX -> {
|
||||
|
|
|
@ -34,7 +34,7 @@ import com.anytypeio.anytype.core_ui.extensions.clearDrawable
|
|||
import com.anytypeio.anytype.core_ui.extensions.setDrawable
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewDiffUtil
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.relations.DocumentRelationView
|
||||
import com.anytypeio.anytype.presentation.relations.ObjectRelationView
|
||||
import com.anytypeio.anytype.presentation.sets.model.ObjectView
|
||||
|
||||
sealed class RelationBlockViewHolder(
|
||||
|
@ -121,7 +121,7 @@ sealed class RelationBlockViewHolder(
|
|||
applyRelationValue(block.view)
|
||||
}
|
||||
if (payload.relationNameChanged()) {
|
||||
applyRelationName(block.view.name, block.view.isReadOnly)
|
||||
applyRelationName(block.view.name, block.view.readOnly)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ sealed class RelationBlockViewHolder(
|
|||
relationName.setReadOnly(isReadOnly)
|
||||
}
|
||||
|
||||
abstract fun applyRelationValue(item: DocumentRelationView)
|
||||
abstract fun applyRelationValue(item: ObjectRelationView)
|
||||
|
||||
init {
|
||||
applyDefaultOffsets(itemView)
|
||||
|
@ -161,7 +161,7 @@ sealed class RelationBlockViewHolder(
|
|||
super.applyContentDecorations(itemView, decorations)
|
||||
}
|
||||
|
||||
override fun applyRelationValue(item: DocumentRelationView) {}
|
||||
override fun applyRelationValue(item: ObjectRelationView) {}
|
||||
}
|
||||
|
||||
class Default(binding: ItemBlockRelationDefaultBinding) :
|
||||
|
@ -174,8 +174,8 @@ sealed class RelationBlockViewHolder(
|
|||
override val relationName: TextView = tvTitle
|
||||
override val decoratableContainer: EditorDecorationContainer = binding.decorationContainer
|
||||
|
||||
fun bind(item: DocumentRelationView) {
|
||||
applyRelationName(item.name, item.isReadOnly)
|
||||
fun bind(item: ObjectRelationView) {
|
||||
applyRelationName(item.name, item.readOnly)
|
||||
applyRelationValue(item)
|
||||
}
|
||||
|
||||
|
@ -187,10 +187,10 @@ sealed class RelationBlockViewHolder(
|
|||
super.applyContentDecorations(itemView, decorations)
|
||||
}
|
||||
|
||||
override fun applyRelationValue(item: DocumentRelationView) {
|
||||
override fun applyRelationValue(item: ObjectRelationView) {
|
||||
tvValue.apply {
|
||||
text = item.value
|
||||
if (item is DocumentRelationView.Default) {
|
||||
if (item is ObjectRelationView.Default) {
|
||||
when (item.format) {
|
||||
Relation.Format.SHORT_TEXT -> setHint(R.string.enter_text)
|
||||
Relation.Format.LONG_TEXT -> setHint(R.string.enter_text)
|
||||
|
@ -215,8 +215,8 @@ sealed class RelationBlockViewHolder(
|
|||
override val selected = binding.selected
|
||||
override val relationName: TextView = tvTitle
|
||||
|
||||
fun bind(item: DocumentRelationView) {
|
||||
applyRelationName(item.name, item.isReadOnly)
|
||||
fun bind(item: ObjectRelationView) {
|
||||
applyRelationName(item.name, item.readOnly)
|
||||
applyRelationValue(item)
|
||||
}
|
||||
|
||||
|
@ -230,8 +230,8 @@ sealed class RelationBlockViewHolder(
|
|||
super.applyContentDecorations(itemView, decorations)
|
||||
}
|
||||
|
||||
override fun applyRelationValue(item: DocumentRelationView) {
|
||||
if (item is DocumentRelationView.Checkbox) {
|
||||
override fun applyRelationValue(item: ObjectRelationView) {
|
||||
if (item is ObjectRelationView.Checkbox) {
|
||||
tvCheckbox.isSelected = item.isChecked
|
||||
}
|
||||
}
|
||||
|
@ -247,8 +247,8 @@ sealed class RelationBlockViewHolder(
|
|||
|
||||
val c = binding.content
|
||||
|
||||
fun bind(item: DocumentRelationView) {
|
||||
applyRelationName(item.name, item.isReadOnly)
|
||||
fun bind(item: ObjectRelationView) {
|
||||
applyRelationName(item.name, item.readOnly)
|
||||
applyRelationValue(item)
|
||||
}
|
||||
|
||||
|
@ -262,8 +262,8 @@ sealed class RelationBlockViewHolder(
|
|||
super.applyContentDecorations(itemView, decorations)
|
||||
}
|
||||
|
||||
override fun applyRelationValue(item: DocumentRelationView) {
|
||||
if (item is DocumentRelationView.Status) {
|
||||
override fun applyRelationValue(item: ObjectRelationView) {
|
||||
if (item is ObjectRelationView.Status) {
|
||||
tvValue.apply {
|
||||
if (item.status.isNotEmpty()) {
|
||||
val status = item.status.first()
|
||||
|
@ -292,13 +292,13 @@ sealed class RelationBlockViewHolder(
|
|||
override val selected = binding.selected
|
||||
override val relationName: TextView = tvTitle
|
||||
|
||||
fun bind(item: DocumentRelationView) {
|
||||
applyRelationName(item.name, item.isReadOnly)
|
||||
fun bind(item: ObjectRelationView) {
|
||||
applyRelationName(item.name, item.readOnly)
|
||||
applyRelationValue(item)
|
||||
}
|
||||
|
||||
override fun applyRelationValue(item: DocumentRelationView) {
|
||||
if (item is DocumentRelationView.Tags) {
|
||||
override fun applyRelationValue(item: ObjectRelationView) {
|
||||
if (item is ObjectRelationView.Tags) {
|
||||
if (item.tags.isEmpty()) {
|
||||
placeholder.visible()
|
||||
} else {
|
||||
|
@ -349,13 +349,13 @@ sealed class RelationBlockViewHolder(
|
|||
override val selected = binding.selected
|
||||
override val relationName: TextView = tvTitle
|
||||
|
||||
fun bind(item: DocumentRelationView) {
|
||||
applyRelationName(item.name, item.isReadOnly)
|
||||
fun bind(item: ObjectRelationView) {
|
||||
applyRelationName(item.name, item.readOnly)
|
||||
applyRelationValue(item)
|
||||
}
|
||||
|
||||
override fun applyRelationValue(item: DocumentRelationView) {
|
||||
if (item is DocumentRelationView.Object) {
|
||||
override fun applyRelationValue(item: ObjectRelationView) {
|
||||
if (item is ObjectRelationView.Object) {
|
||||
if (item.objects.isEmpty()) {
|
||||
placeholder.visible()
|
||||
} else {
|
||||
|
@ -412,13 +412,13 @@ sealed class RelationBlockViewHolder(
|
|||
override val selected = binding.selected
|
||||
override val relationName: TextView = tvTitle
|
||||
|
||||
fun bind(item: DocumentRelationView) {
|
||||
applyRelationName(item.name, item.isReadOnly)
|
||||
fun bind(item: ObjectRelationView) {
|
||||
applyRelationName(item.name, item.readOnly)
|
||||
applyRelationValue(item)
|
||||
}
|
||||
|
||||
override fun applyRelationValue(item: DocumentRelationView) {
|
||||
if (item is DocumentRelationView.File) {
|
||||
override fun applyRelationValue(item: ObjectRelationView) {
|
||||
if (item is ObjectRelationView.File) {
|
||||
if (item.files.isEmpty()) {
|
||||
placeholder.visible()
|
||||
} else {
|
||||
|
@ -467,7 +467,7 @@ sealed class RelationBlockViewHolder(
|
|||
override val relationName: TextView = binding.tvTitle
|
||||
|
||||
|
||||
override fun applyRelationValue(item: DocumentRelationView) {}
|
||||
override fun applyRelationValue(item: ObjectRelationView) {}
|
||||
|
||||
fun bind(item: BlockView.Relation.Deleted) {
|
||||
indentize(item)
|
||||
|
|
|
@ -22,7 +22,7 @@ import com.anytypeio.anytype.core_utils.diff.DefaultDiffUtil
|
|||
import com.anytypeio.anytype.core_utils.ext.visible
|
||||
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashItem
|
||||
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashRelationView
|
||||
import com.anytypeio.anytype.presentation.relations.DocumentRelationView
|
||||
import com.anytypeio.anytype.presentation.relations.ObjectRelationView
|
||||
import timber.log.Timber
|
||||
|
||||
class SlashRelationsAdapter(
|
||||
|
@ -147,37 +147,37 @@ class SlashRelationsAdapter(
|
|||
is ListRelationViewHolder.Status -> {
|
||||
check(item is SlashRelationView.Item)
|
||||
val view = item.view
|
||||
check(view is DocumentRelationView.Status)
|
||||
check(view is ObjectRelationView.Status)
|
||||
holder.bind(view)
|
||||
}
|
||||
is ListRelationViewHolder.Checkbox -> {
|
||||
check(item is SlashRelationView.Item)
|
||||
val view = item.view
|
||||
check(view is DocumentRelationView.Checkbox)
|
||||
check(view is ObjectRelationView.Checkbox)
|
||||
holder.bind(view)
|
||||
}
|
||||
is ListRelationViewHolder.Tags -> {
|
||||
check(item is SlashRelationView.Item)
|
||||
val view = item.view
|
||||
check(view is DocumentRelationView.Tags)
|
||||
check(view is ObjectRelationView.Tags)
|
||||
holder.bind(view)
|
||||
}
|
||||
is ListRelationViewHolder.Object -> {
|
||||
check(item is SlashRelationView.Item)
|
||||
val view = item.view
|
||||
check(view is DocumentRelationView.Object)
|
||||
check(view is ObjectRelationView.Object)
|
||||
holder.bind(view)
|
||||
}
|
||||
is ListRelationViewHolder.File -> {
|
||||
check(item is SlashRelationView.Item)
|
||||
val view = item.view
|
||||
check(view is DocumentRelationView.File)
|
||||
check(view is ObjectRelationView.File)
|
||||
holder.bind(view)
|
||||
}
|
||||
is ListRelationViewHolder.Default -> {
|
||||
check(item is SlashRelationView.Item)
|
||||
val view = item.view
|
||||
check(view is DocumentRelationView.Default)
|
||||
check(view is ObjectRelationView.Default)
|
||||
holder.bind(view)
|
||||
}
|
||||
is RelationsSubheaderMenuHolder -> {
|
||||
|
@ -195,11 +195,11 @@ class SlashRelationsAdapter(
|
|||
override fun getItemViewType(position: Int): Int = when (val item = items[position]) {
|
||||
is SlashRelationView.Item -> {
|
||||
when (item.view) {
|
||||
is DocumentRelationView.Checkbox -> R.layout.item_relation_list_relation_checkbox
|
||||
is DocumentRelationView.Object -> R.layout.item_relation_list_relation_object
|
||||
is DocumentRelationView.Status -> R.layout.item_relation_list_relation_status
|
||||
is DocumentRelationView.Tags -> R.layout.item_relation_list_relation_tag
|
||||
is DocumentRelationView.File -> R.layout.item_relation_list_relation_file
|
||||
is ObjectRelationView.Checkbox -> R.layout.item_relation_list_relation_checkbox
|
||||
is ObjectRelationView.Object -> R.layout.item_relation_list_relation_object
|
||||
is ObjectRelationView.Status -> R.layout.item_relation_list_relation_status
|
||||
is ObjectRelationView.Tags -> R.layout.item_relation_list_relation_tag
|
||||
is ObjectRelationView.File -> R.layout.item_relation_list_relation_file
|
||||
else -> R.layout.item_relation_list_relation_default
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import com.anytypeio.anytype.core_ui.databinding.ItemRelationListRelationTagBind
|
|||
import com.anytypeio.anytype.core_ui.features.editor.holders.relations.ListRelationViewHolder
|
||||
import com.anytypeio.anytype.core_utils.diff.DefaultDiffUtil
|
||||
import com.anytypeio.anytype.core_utils.ext.visible
|
||||
import com.anytypeio.anytype.presentation.relations.DocumentRelationView
|
||||
import com.anytypeio.anytype.presentation.relations.ObjectRelationView
|
||||
import com.anytypeio.anytype.presentation.relations.RelationListViewModel
|
||||
import timber.log.Timber
|
||||
|
||||
|
@ -191,37 +191,37 @@ class DocumentRelationAdapter(
|
|||
is ListRelationViewHolder.Status -> {
|
||||
check(item is RelationListViewModel.Model.Item)
|
||||
val view = item.view
|
||||
check(view is DocumentRelationView.Status)
|
||||
check(view is ObjectRelationView.Status)
|
||||
holder.bind(view)
|
||||
}
|
||||
is ListRelationViewHolder.Checkbox -> {
|
||||
check(item is RelationListViewModel.Model.Item)
|
||||
val view = item.view
|
||||
check(view is DocumentRelationView.Checkbox)
|
||||
check(view is ObjectRelationView.Checkbox)
|
||||
holder.bind(view)
|
||||
}
|
||||
is ListRelationViewHolder.Tags -> {
|
||||
check(item is RelationListViewModel.Model.Item)
|
||||
val view = item.view
|
||||
check(view is DocumentRelationView.Tags)
|
||||
check(view is ObjectRelationView.Tags)
|
||||
holder.bind(view)
|
||||
}
|
||||
is ListRelationViewHolder.Object -> {
|
||||
check(item is RelationListViewModel.Model.Item)
|
||||
val view = item.view
|
||||
check(view is DocumentRelationView.Object)
|
||||
check(view is ObjectRelationView.Object)
|
||||
holder.bind(view)
|
||||
}
|
||||
is ListRelationViewHolder.File -> {
|
||||
check(item is RelationListViewModel.Model.Item)
|
||||
val view = item.view
|
||||
check(view is DocumentRelationView.File)
|
||||
check(view is ObjectRelationView.File)
|
||||
holder.bind(view)
|
||||
}
|
||||
is ListRelationViewHolder.Default -> {
|
||||
check(item is RelationListViewModel.Model.Item)
|
||||
val view = item.view
|
||||
check(view is DocumentRelationView.Default)
|
||||
check(view is ObjectRelationView.Default)
|
||||
holder.bind(view)
|
||||
}
|
||||
is SectionViewHolder -> {
|
||||
|
@ -234,7 +234,7 @@ class DocumentRelationAdapter(
|
|||
}
|
||||
if (holder is ListRelationViewHolder) {
|
||||
check(item is RelationListViewModel.Model.Item)
|
||||
holder.setIsFeatured(item.view.isFeatured)
|
||||
holder.setIsFeatured(item.view.featured)
|
||||
holder.setIsRemovable(item.isRemoveable)
|
||||
}
|
||||
}
|
||||
|
@ -244,11 +244,11 @@ class DocumentRelationAdapter(
|
|||
override fun getItemViewType(position: Int): Int = when (val item = items[position]) {
|
||||
is RelationListViewModel.Model.Item -> {
|
||||
when (item.view) {
|
||||
is DocumentRelationView.Checkbox -> R.layout.item_relation_list_relation_checkbox
|
||||
is DocumentRelationView.Object -> R.layout.item_relation_list_relation_object
|
||||
is DocumentRelationView.Status -> R.layout.item_relation_list_relation_status
|
||||
is DocumentRelationView.Tags -> R.layout.item_relation_list_relation_tag
|
||||
is DocumentRelationView.File -> R.layout.item_relation_list_relation_file
|
||||
is ObjectRelationView.Checkbox -> R.layout.item_relation_list_relation_checkbox
|
||||
is ObjectRelationView.Object -> R.layout.item_relation_list_relation_object
|
||||
is ObjectRelationView.Status -> R.layout.item_relation_list_relation_status
|
||||
is ObjectRelationView.Tags -> R.layout.item_relation_list_relation_tag
|
||||
is ObjectRelationView.File -> R.layout.item_relation_list_relation_file
|
||||
else -> R.layout.item_relation_list_relation_default
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package com.anytypeio.anytype.core_ui.menu
|
||||
|
||||
import android.content.Context
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.widget.PopupMenu
|
||||
import com.anytypeio.anytype.core_ui.R
|
||||
|
||||
class ObjectSetTypePopupMenu(
|
||||
context: Context,
|
||||
view: View,
|
||||
onChangeTypeClicked: () -> Unit,
|
||||
onConvertToCollection: () -> Unit
|
||||
) : PopupMenu(context, view, Gravity.BOTTOM, 0, R.style.DefaultPopupMenuStyle) {
|
||||
init {
|
||||
menuInflater.inflate(R.menu.menu_set_type, menu)
|
||||
setOnMenuItemClickListener { item ->
|
||||
when (item.itemId) {
|
||||
R.id.turn_into -> onConvertToCollection()
|
||||
R.id.change_query -> onChangeTypeClicked()
|
||||
else -> throw IllegalStateException("Unexpected menu item: $item")
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.anytypeio.anytype.core_ui.menu
|
||||
|
||||
import android.content.Context
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.widget.PopupMenu
|
||||
import com.anytypeio.anytype.core_ui.R
|
||||
|
@ -12,7 +13,7 @@ class ObjectTypePopupMenu(
|
|||
onOpenSetClicked: () -> Unit,
|
||||
allowChangingObjectType: Boolean = false,
|
||||
allowOnlyChangingType: Boolean = false
|
||||
) : PopupMenu(context, view) {
|
||||
) : PopupMenu(context, view, Gravity.BOTTOM, 0, R.style.DefaultPopupMenuStyle) {
|
||||
init {
|
||||
if (allowOnlyChangingType) {
|
||||
menuInflater.inflate(R.menu.menu_object_type_only, menu)
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
package com.anytypeio.anytype.core_ui.widgets
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.ViewOutlineProvider
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import com.anytypeio.anytype.core_ui.R
|
||||
import com.anytypeio.anytype.emojifier.Emojifier
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
import timber.log.Timber
|
||||
import kotlin.math.min
|
||||
|
||||
class DocIconWidget @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : AppCompatImageView(context, attrs, defStyleAttr) {
|
||||
|
||||
init {
|
||||
outlineProvider = ViewOutlineProvider.BACKGROUND
|
||||
clipToOutline = true
|
||||
setBackgroundResource(R.drawable.rectangle_default_page_logo_background)
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure width and height of image are same
|
||||
*/
|
||||
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
||||
val width = MeasureSpec.getSize(widthMeasureSpec)
|
||||
val height = MeasureSpec.getSize(heightMeasureSpec)
|
||||
val minDimension = min(width, height)
|
||||
setMeasuredDimension(minDimension, minDimension)
|
||||
}
|
||||
|
||||
fun setEmoji(unicode: String?) {
|
||||
try {
|
||||
if (unicode != null) {
|
||||
Glide
|
||||
.with(this)
|
||||
.load(Emojifier.uri(unicode))
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.centerInside()
|
||||
.into(this)
|
||||
} else {
|
||||
setImageDrawable(null)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "Error while setting emoji with unicode: $unicode")
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,14 +13,17 @@ import com.anytypeio.anytype.core_models.ThemeColor
|
|||
import com.anytypeio.anytype.core_ui.R
|
||||
import com.anytypeio.anytype.core_ui.extensions.color
|
||||
import com.anytypeio.anytype.core_ui.extensions.dark
|
||||
import com.anytypeio.anytype.core_ui.extensions.drawable
|
||||
import com.anytypeio.anytype.core_ui.extensions.light
|
||||
import com.anytypeio.anytype.core_ui.menu.ObjectSetTypePopupMenu
|
||||
import com.anytypeio.anytype.core_ui.menu.ObjectTypePopupMenu
|
||||
import com.anytypeio.anytype.core_utils.ext.dimen
|
||||
import com.anytypeio.anytype.core_utils.ext.px
|
||||
import com.anytypeio.anytype.core_utils.ext.setDrawableColor
|
||||
import com.anytypeio.anytype.presentation.editor.editor.listener.ListenerType
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.objects.ObjectIcon
|
||||
import com.anytypeio.anytype.presentation.relations.DocumentRelationView
|
||||
import com.anytypeio.anytype.presentation.relations.ObjectRelationView
|
||||
import com.anytypeio.anytype.presentation.sets.model.ObjectView
|
||||
|
||||
class FeaturedRelationGroupWidget : ConstraintLayout {
|
||||
|
@ -33,14 +36,13 @@ class FeaturedRelationGroupWidget : ConstraintLayout {
|
|||
defStyleAttr: Int
|
||||
) : super(context, attrs, defStyleAttr)
|
||||
|
||||
private val defaultTextSize: Float = context.dimen(R.dimen.sp_13)
|
||||
private val defaultTextSize: Float = context.dimen(R.dimen.sp_15)
|
||||
private val dividerSize: Int = context.dimen(R.dimen.dp_4).toInt()
|
||||
private val defaultTextColor = resources.getColor(R.color.text_secondary, null)
|
||||
|
||||
fun set(
|
||||
item: BlockView.FeaturedRelation,
|
||||
click: (ListenerType.Relation) -> Unit,
|
||||
isObjectSet: Boolean = false
|
||||
click: (ListenerType.Relation) -> Unit
|
||||
) {
|
||||
clear()
|
||||
|
||||
|
@ -60,7 +62,7 @@ class FeaturedRelationGroupWidget : ConstraintLayout {
|
|||
|
||||
item.relations.forEachIndexed { index, relation ->
|
||||
when (relation) {
|
||||
is DocumentRelationView.Default -> {
|
||||
is ObjectRelationView.Default -> {
|
||||
val view = TextView(context).apply {
|
||||
id = generateViewId()
|
||||
text = relation.value ?: getPlaceholderHint(relation)
|
||||
|
@ -77,7 +79,7 @@ class FeaturedRelationGroupWidget : ConstraintLayout {
|
|||
addView(view)
|
||||
ids.add(view.id)
|
||||
}
|
||||
is DocumentRelationView.Checkbox -> {
|
||||
is ObjectRelationView.Checkbox -> {
|
||||
val view = View(context).apply {
|
||||
id = generateViewId()
|
||||
val size = context.dimen(R.dimen.dp_16).toInt()
|
||||
|
@ -89,7 +91,7 @@ class FeaturedRelationGroupWidget : ConstraintLayout {
|
|||
addView(view)
|
||||
ids.add(view.id)
|
||||
}
|
||||
is DocumentRelationView.File -> {
|
||||
is ObjectRelationView.File -> {
|
||||
relation.files.forEach { file ->
|
||||
val view = TextView(context).apply {
|
||||
id = generateViewId()
|
||||
|
@ -113,7 +115,7 @@ class FeaturedRelationGroupWidget : ConstraintLayout {
|
|||
ids.add(placeholder.id)
|
||||
}
|
||||
}
|
||||
is DocumentRelationView.Object -> {
|
||||
is ObjectRelationView.Object -> {
|
||||
relation.objects.forEach { obj ->
|
||||
if (obj is ObjectView.Default) {
|
||||
val view = TextView(context).apply {
|
||||
|
@ -152,7 +154,7 @@ class FeaturedRelationGroupWidget : ConstraintLayout {
|
|||
ids.add(placeholder.id)
|
||||
}
|
||||
}
|
||||
is DocumentRelationView.Status -> {
|
||||
is ObjectRelationView.Status -> {
|
||||
relation.status.forEach { status ->
|
||||
val color = ThemeColor.values().find { v -> v.code == status.color }
|
||||
val view = TextView(context).apply {
|
||||
|
@ -181,7 +183,7 @@ class FeaturedRelationGroupWidget : ConstraintLayout {
|
|||
ids.add(placeholder.id)
|
||||
}
|
||||
}
|
||||
is DocumentRelationView.Tags -> {
|
||||
is ObjectRelationView.Tags -> {
|
||||
relation.tags.forEach { tag ->
|
||||
val color = ThemeColor.values().find { v -> v.code == tag.color }
|
||||
val defaultBackground = resources.getColor(R.color.shape_primary, null)
|
||||
|
@ -219,39 +221,26 @@ class FeaturedRelationGroupWidget : ConstraintLayout {
|
|||
ids.add(placeholder.id)
|
||||
}
|
||||
}
|
||||
is DocumentRelationView.ObjectType.Base -> {
|
||||
val view = TextView(context).apply {
|
||||
id = generateViewId()
|
||||
if (relation.name.isEmpty()) {
|
||||
hint = context.resources.getString(R.string.untitled)
|
||||
}
|
||||
text = relation.name
|
||||
isSingleLine = true
|
||||
maxLines = 1
|
||||
ellipsize = TextUtils.TruncateAt.END
|
||||
setTextColor(defaultTextColor)
|
||||
setTextSize(TypedValue.COMPLEX_UNIT_PX, defaultTextSize)
|
||||
}
|
||||
is ObjectRelationView.ObjectType.Base -> {
|
||||
val view = inflateObjectTypeTextView(name = relation.name)
|
||||
view.setOnClickListener {
|
||||
if (!isObjectSet) {
|
||||
val popup = ObjectTypePopupMenu(
|
||||
context = context,
|
||||
view = it,
|
||||
onChangeTypeClicked = {
|
||||
click(ListenerType.Relation.ChangeObjectType(type = relation.relationId))
|
||||
},
|
||||
onOpenSetClicked = {
|
||||
click(ListenerType.Relation.ObjectTypeOpenSet(type = relation.type))
|
||||
},
|
||||
allowChangingObjectType = item.allowChangingObjectType
|
||||
)
|
||||
popup.show()
|
||||
}
|
||||
val popup = ObjectTypePopupMenu(
|
||||
context = context,
|
||||
view = it,
|
||||
onChangeTypeClicked = {
|
||||
click(ListenerType.Relation.ChangeObjectType(type = relation.id))
|
||||
},
|
||||
onOpenSetClicked = {
|
||||
click(ListenerType.Relation.ObjectTypeOpenSet(type = relation.type))
|
||||
},
|
||||
allowChangingObjectType = item.allowChangingObjectType
|
||||
)
|
||||
popup.show()
|
||||
}
|
||||
addView(view)
|
||||
ids.add(view.id)
|
||||
}
|
||||
is DocumentRelationView.Source.Base -> {
|
||||
is ObjectRelationView.Source.Base -> {
|
||||
if (relation.sources.isEmpty()) {
|
||||
inflateEmptySourcePlaceholderTextView(
|
||||
click = click,
|
||||
|
@ -273,13 +262,13 @@ class FeaturedRelationGroupWidget : ConstraintLayout {
|
|||
}
|
||||
}
|
||||
}
|
||||
is DocumentRelationView.Source.Deleted -> {
|
||||
is ObjectRelationView.Source.Deleted -> {
|
||||
inflateDeletedSourceTextView(
|
||||
click = click,
|
||||
ids = ids
|
||||
)
|
||||
}
|
||||
is DocumentRelationView.ObjectType.Deleted -> {
|
||||
is ObjectRelationView.ObjectType.Deleted -> {
|
||||
val view = TextView(context).apply {
|
||||
id = generateViewId()
|
||||
text = context.resources.getString(R.string.deleted_type)
|
||||
|
@ -294,7 +283,7 @@ class FeaturedRelationGroupWidget : ConstraintLayout {
|
|||
context = context,
|
||||
view = it,
|
||||
onChangeTypeClicked = {
|
||||
click(ListenerType.Relation.ChangeObjectType(type = relation.relationId))
|
||||
click(ListenerType.Relation.ChangeObjectType(type = relation.id))
|
||||
},
|
||||
onOpenSetClicked = {},
|
||||
allowOnlyChangingType = true
|
||||
|
@ -304,6 +293,31 @@ class FeaturedRelationGroupWidget : ConstraintLayout {
|
|||
addView(view)
|
||||
ids.add(view.id)
|
||||
}
|
||||
is ObjectRelationView.ObjectType.Collection -> {
|
||||
val view = inflateObjectTypeTextView(name = relation.name)
|
||||
addView(view)
|
||||
ids.add(view.id)
|
||||
}
|
||||
is ObjectRelationView.ObjectType.Set -> {
|
||||
val view = inflateObjectTypeTextView(name = relation.name)
|
||||
view.setOnClickListener {
|
||||
val popup = ObjectSetTypePopupMenu(
|
||||
context = context,
|
||||
view = it,
|
||||
onChangeTypeClicked = {
|
||||
click(ListenerType.Relation.SetQuery(queries = emptyList()))
|
||||
},
|
||||
onConvertToCollection = {
|
||||
click(ListenerType.Relation.TurnIntoCollection)
|
||||
}
|
||||
)
|
||||
popup.setOnDismissListener { view.background = null }
|
||||
view.background = context.drawable(R.drawable.bg_featured_relation)
|
||||
popup.show()
|
||||
}
|
||||
addView(view)
|
||||
ids.add(view.id)
|
||||
}
|
||||
}
|
||||
|
||||
if (index != item.relations.lastIndex) {
|
||||
|
@ -320,6 +334,24 @@ class FeaturedRelationGroupWidget : ConstraintLayout {
|
|||
flow.referencedIds = ids.toIntArray()
|
||||
}
|
||||
|
||||
private fun inflateObjectTypeTextView(name: String): TextView {
|
||||
val textView = TextView(context).apply {
|
||||
id = View.generateViewId()
|
||||
isSingleLine = true
|
||||
maxLines = 1
|
||||
ellipsize = TextUtils.TruncateAt.END
|
||||
setPadding(4.px, 2.px, 4.px, 2.px)
|
||||
setTextColor(defaultTextColor)
|
||||
setTextSize(TypedValue.COMPLEX_UNIT_PX, defaultTextSize)
|
||||
}
|
||||
if (name.isEmpty()) {
|
||||
textView.hint = context.resources.getString(R.string.untitled)
|
||||
} else {
|
||||
textView.text = name
|
||||
}
|
||||
return textView
|
||||
}
|
||||
|
||||
private fun inflateEmptySourcePlaceholderTextView(
|
||||
click: (ListenerType.Relation) -> Unit,
|
||||
ids: MutableList<Int>
|
||||
|
@ -337,7 +369,7 @@ class FeaturedRelationGroupWidget : ConstraintLayout {
|
|||
}
|
||||
|
||||
private fun inflateDefaultSourceTextView(
|
||||
relation: DocumentRelationView.Source.Base,
|
||||
relation: ObjectRelationView.Source.Base,
|
||||
click: (ListenerType.Relation) -> Unit,
|
||||
ids: MutableList<Int>
|
||||
) {
|
||||
|
@ -376,7 +408,7 @@ class FeaturedRelationGroupWidget : ConstraintLayout {
|
|||
}
|
||||
|
||||
private fun inflateSourceByRelationTextView(
|
||||
relation: DocumentRelationView.Source.Base,
|
||||
relation: ObjectRelationView.Source.Base,
|
||||
click: (ListenerType.Relation) -> Unit,
|
||||
ids: MutableList<Int>
|
||||
) {
|
||||
|
@ -431,7 +463,7 @@ class FeaturedRelationGroupWidget : ConstraintLayout {
|
|||
ids.add(view.id)
|
||||
}
|
||||
|
||||
private fun getPlaceholderHint(relation: DocumentRelationView.Default): String {
|
||||
private fun getPlaceholderHint(relation: ObjectRelationView.Default): String {
|
||||
return when (relation.format) {
|
||||
Relation.Format.SHORT_TEXT -> resources.getString(R.string.enter_text)
|
||||
Relation.Format.LONG_TEXT -> resources.getString(R.string.enter_text)
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
package com.anytypeio.anytype.core_ui.widgets.toolbar
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.anytypeio.anytype.core_ui.R
|
||||
import com.anytypeio.anytype.core_ui.databinding.ViewDataviewInfoBinding
|
||||
import com.anytypeio.anytype.core_ui.reactive.checkMainThread
|
||||
import com.anytypeio.anytype.core_utils.ext.invisible
|
||||
import com.anytypeio.anytype.core_utils.ext.visible
|
||||
import kotlinx.coroutines.channels.awaitClose
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.callbackFlow
|
||||
import kotlinx.coroutines.flow.conflate
|
||||
|
||||
class DataViewInfo @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr) {
|
||||
|
||||
val binding = ViewDataviewInfoBinding.inflate(LayoutInflater.from(context), this, true)
|
||||
private var type: TYPE = TYPE.INIT
|
||||
|
||||
fun show(type: TYPE, extra: String = "") {
|
||||
this.type = type
|
||||
visible()
|
||||
when (type) {
|
||||
TYPE.INIT -> {
|
||||
binding.title.text = null
|
||||
binding.description.text = null
|
||||
binding.button.text = ""
|
||||
}
|
||||
TYPE.COLLECTION_NO_ITEMS -> {
|
||||
binding.title.text = resources.getString(R.string.collection_no_items_title)
|
||||
binding.description.text =
|
||||
resources.getString(R.string.collection_no_items_description)
|
||||
binding.button.text = resources.getString(R.string.collection_no_items_button)
|
||||
}
|
||||
TYPE.SET_NO_QUERY -> {
|
||||
binding.title.text = resources.getString(R.string.set_no_query_title)
|
||||
binding.description.text = resources.getString(R.string.set_no_query_description)
|
||||
binding.button.text = resources.getString(R.string.set_no_query_button)
|
||||
}
|
||||
TYPE.SET_NO_ITEMS -> {
|
||||
binding.title.text = resources.getString(R.string.set_no_items_title)
|
||||
binding.description.text =
|
||||
resources.getString(R.string.set_no_items_description, extra)
|
||||
binding.button.text = resources.getString(R.string.set_no_items_button)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun hide() {
|
||||
invisible()
|
||||
}
|
||||
|
||||
fun clicks(): Flow<TYPE> = callbackFlow {
|
||||
checkMainThread()
|
||||
val listener = OnClickListener {
|
||||
trySend(this@DataViewInfo.type)
|
||||
}
|
||||
binding.button.setOnClickListener(listener)
|
||||
awaitClose { binding.button.setOnClickListener(null) }
|
||||
}.conflate()
|
||||
|
||||
enum class TYPE {
|
||||
INIT,
|
||||
COLLECTION_NO_ITEMS,
|
||||
SET_NO_QUERY,
|
||||
SET_NO_ITEMS
|
||||
}
|
||||
}
|
6
core-ui/src/main/res/color/ds_button_primary_text.xml
Normal file
6
core-ui/src/main/res/color/ds_button_primary_text.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/text_tertiary" android:state_enabled="false" />
|
||||
<item android:color="@color/button_text" android:state_enabled="true" />
|
||||
<item android:color="@color/button_text" android:state_enabled="true" android:state_pressed="true" />
|
||||
</selector>
|
5
core-ui/src/main/res/color/selector_viewer_header.xml
Normal file
5
core-ui/src/main/res/color/selector_viewer_header.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/glyph_inactive" android:state_enabled="false" />
|
||||
<item android:color="@color/glyph_selected"/>
|
||||
</selector>
|
7
core-ui/src/main/res/drawable/bg_featured_relation.xml
Normal file
7
core-ui/src/main/res/drawable/bg_featured_relation.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid
|
||||
android:color="@color/background_highlighted"/>
|
||||
<corners android:radius="4dp" />
|
||||
</shape>
|
9
core-ui/src/main/res/drawable/bg_menu_default.xml
Normal file
9
core-ui/src/main/res/drawable/bg_menu_default.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/background_primary"/>
|
||||
<corners
|
||||
android:radius="10dp"/>
|
||||
<padding
|
||||
android:bottom="8dp"
|
||||
android:top="8dp"/>
|
||||
</shape>
|
|
@ -1,8 +0,0 @@
|
|||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/amber_100" />
|
||||
<corners android:radius="@dimen/dp_6" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
13
core-ui/src/main/res/drawable/bg_viewer_settings_icon_bg.xml
Normal file
13
core-ui/src/main/res/drawable/bg_viewer_settings_icon_bg.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_enabled="false">
|
||||
<vector android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
|
||||
<path android:fillColor="@color/glyph_inactive" android:fillType="evenOdd" android:pathData="M16.5,7C16.5,7.828 15.828,8.5 15,8.5C14.172,8.5 13.5,7.828 13.5,7C13.5,6.172 14.172,5.5 15,5.5C15.828,5.5 16.5,6.172 16.5,7ZM20.25,6.25H17.906C17.573,4.956 16.398,4 15,4C13.602,4 12.427,4.956 12.094,6.25H3.75C3.336,6.25 3,6.586 3,7C3,7.414 3.336,7.75 3.75,7.75H12.094C12.427,9.044 13.602,10 15,10C16.398,10 17.573,9.044 17.906,7.75H20.25C20.664,7.75 21,7.414 21,7C21,6.586 20.664,6.25 20.25,6.25ZM7.5,17C7.5,17.828 8.172,18.5 9,18.5C9.828,18.5 10.5,17.828 10.5,17C10.5,16.172 9.828,15.5 9,15.5C8.172,15.5 7.5,16.172 7.5,17ZM6.095,17.75C6.428,19.044 7.602,20 9,20C10.398,20 11.573,19.044 11.906,17.75H20.25C20.664,17.75 21,17.414 21,17C21,16.586 20.664,16.25 20.25,16.25H11.906C11.573,14.956 10.398,14 9,14C7.602,14 6.428,14.956 6.095,16.25H3.75C3.336,16.25 3,16.586 3,17C3,17.414 3.336,17.75 3.75,17.75H6.095Z" />
|
||||
</vector>
|
||||
</item>
|
||||
<item>
|
||||
<vector android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
|
||||
<path android:fillColor="@color/glyph_active" android:fillType="evenOdd" android:pathData="M16.5,7C16.5,7.828 15.828,8.5 15,8.5C14.172,8.5 13.5,7.828 13.5,7C13.5,6.172 14.172,5.5 15,5.5C15.828,5.5 16.5,6.172 16.5,7ZM20.25,6.25H17.906C17.573,4.956 16.398,4 15,4C13.602,4 12.427,4.956 12.094,6.25H3.75C3.336,6.25 3,6.586 3,7C3,7.414 3.336,7.75 3.75,7.75H12.094C12.427,9.044 13.602,10 15,10C16.398,10 17.573,9.044 17.906,7.75H20.25C20.664,7.75 21,7.414 21,7C21,6.586 20.664,6.25 20.25,6.25ZM7.5,17C7.5,17.828 8.172,18.5 9,18.5C9.828,18.5 10.5,17.828 10.5,17C10.5,16.172 9.828,15.5 9,15.5C8.172,15.5 7.5,16.172 7.5,17ZM6.095,17.75C6.428,19.044 7.602,20 9,20C10.398,20 11.573,19.044 11.906,17.75H20.25C20.664,17.75 21,17.414 21,17C21,16.586 20.664,16.25 20.25,16.25H11.906C11.573,14.956 10.398,14 9,14C7.602,14 6.428,14.956 6.095,16.25H3.75C3.336,16.25 3,16.586 3,17C3,17.414 3.336,17.75 3.75,17.75H6.095Z" />
|
||||
</vector>
|
||||
</item>
|
||||
</selector>
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_enabled="false">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="6dp" />
|
||||
<solid android:color="@color/shape_tertiary" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_enabled="true" android:state_pressed="false">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="6dp" />
|
||||
<solid android:color="@color/glyph_selected" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:state_enabled="true" android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="6dp" />
|
||||
<solid android:color="@color/button_pressed" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
13
core-ui/src/main/res/drawable/ic_arrow_expand_dv_viewer.xml
Normal file
13
core-ui/src/main/res/drawable/ic_arrow_expand_dv_viewer.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_enabled="false">
|
||||
<vector android:width="16dp" android:height="16dp" android:viewportWidth="16" android:viewportHeight="16">
|
||||
<path android:fillColor="@color/glyph_inactive" android:fillType="evenOdd" android:pathData="M2.4697,5.4697C2.7626,5.1768 3.2374,5.1768 3.5303,5.4697L8,9.9393L12.4697,5.4697C12.7626,5.1768 13.2374,5.1768 13.5303,5.4697C13.8232,5.7626 13.8232,6.2374 13.5303,6.5303L8,12.0607L2.4697,6.5303C2.1768,6.2374 2.1768,5.7626 2.4697,5.4697Z" />
|
||||
</vector>
|
||||
</item>
|
||||
<item android:state_enabled="true">
|
||||
<vector android:width="16dp" android:height="16dp" android:viewportWidth="16" android:viewportHeight="16">
|
||||
<path android:fillColor="@color/glyph_selected" android:fillType="evenOdd" android:pathData="M2.4697,5.4697C2.7626,5.1768 3.2374,5.1768 3.5303,5.4697L8,9.9393L12.4697,5.4697C12.7626,5.1768 13.2374,5.1768 13.5303,5.4697C13.8232,5.7626 13.8232,6.2374 13.5303,6.5303L8,12.0607L2.4697,6.5303C2.1768,6.2374 2.1768,5.7626 2.4697,5.4697Z" />
|
||||
</vector>
|
||||
</item>
|
||||
</selector>
|
208
core-ui/src/main/res/layout/collection_loading_state.xml
Normal file
208
core-ui/src/main/res/layout/collection_loading_state.xml
Normal file
|
@ -0,0 +1,208 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.facebook.shimmer.ShimmerFrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/shimmerLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:shimmer_base_alpha="0.5"
|
||||
app:shimmer_colored="false"
|
||||
app:shimmer_duration="1000"
|
||||
app:shimmer_highlight_alpha="0.9"
|
||||
app:shimmer_repeat_delay="100"
|
||||
app:shimmer_tilt="0">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<View
|
||||
android:id="@+id/view18"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="14dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:background="@drawable/bg_object_loading_state"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/view16"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/view16" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view17"
|
||||
android:layout_width="0.5dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@drawable/bg_object_loading_state"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/view14"
|
||||
app:layout_constraintEnd_toStartOf="@+id/view18"
|
||||
app:layout_constraintTop_toTopOf="@+id/view14"
|
||||
app:layout_constraintVertical_bias="1.0" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view15"
|
||||
android:layout_width="0.5dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_marginStart="63dp"
|
||||
android:background="@drawable/bg_object_loading_state"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/view14"
|
||||
app:layout_constraintStart_toEndOf="@+id/view14"
|
||||
app:layout_constraintTop_toTopOf="@+id/view14"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view14"
|
||||
android:layout_width="73dp"
|
||||
android:layout_height="14dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/bg_object_loading_state"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/view13" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view13"
|
||||
android:layout_width="104dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="19dp"
|
||||
android:background="@drawable/bg_object_loading_state"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/view12" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view12"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0.5dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@drawable/bg_object_loading_state"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/view11" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view11"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:background="@drawable/bg_object_loading_state"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/view10"
|
||||
app:layout_constraintEnd_toStartOf="@+id/view10"
|
||||
app:layout_constraintTop_toTopOf="@+id/view10" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view10"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:background="@drawable/bg_object_loading_state"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/view9"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/view9" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view9"
|
||||
android:layout_width="102dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:background="@drawable/bg_object_loading_state"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/view6" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view8"
|
||||
android:layout_width="97dp"
|
||||
android:layout_height="14dp"
|
||||
android:layout_marginStart="17dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:background="@drawable/bg_object_loading_state"
|
||||
app:layout_constraintStart_toEndOf="@+id/view7"
|
||||
app:layout_constraintTop_toBottomOf="@+id/view5" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view7"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="14dp"
|
||||
android:layout_marginStart="17dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:background="@drawable/bg_object_loading_state"
|
||||
app:layout_constraintStart_toEndOf="@+id/view6"
|
||||
app:layout_constraintTop_toBottomOf="@+id/view5" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view6"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="14dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:background="@drawable/bg_object_loading_state"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/view5" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view5"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_14"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="26dp"
|
||||
android:background="@drawable/bg_object_loading_state"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/view4" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view4"
|
||||
android:layout_width="282dp"
|
||||
android:layout_height="14dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="11dp"
|
||||
android:background="@drawable/bg_object_loading_state"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/view3" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view3"
|
||||
android:layout_width="220dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/bg_object_loading_state"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/guideline2" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintGuide_begin="216dp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/default_cover_height"
|
||||
android:background="@drawable/bg_object_loading_state"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/docEmojiIconContainer"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="72dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginStart="16dp"
|
||||
android:background="@drawable/bg_object_icon_loading_state"
|
||||
app:layout_constraintBottom_toTopOf="@+id/guideline2"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view16"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="14dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:background="@drawable/bg_object_loading_state"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/view14"
|
||||
app:layout_constraintStart_toEndOf="@+id/view15"
|
||||
app:layout_constraintTop_toTopOf="@+id/view14" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</com.facebook.shimmer.ShimmerFrameLayout>
|
64
core-ui/src/main/res/layout/layout_object_set_dv_header.xml
Normal file
64
core-ui/src/main/res/layout/layout_object_set_dv_header.xml
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/default_collection_dv_header_height">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCurrentViewerName"
|
||||
style="@style/ViewerTitleStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:drawablePadding="2dp"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="@dimen/dp_20"
|
||||
app:drawableEndCompat="@drawable/ic_arrow_expand_dv_viewer"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:enabled="false"
|
||||
tools:text="All" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/customizeViewButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:contentDescription="@string/content_description_customize_view_button"
|
||||
android:paddingStart="@dimen/dp_20"
|
||||
android:src="@drawable/bg_viewer_settings_icon_bg"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/addNewButton"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:enabled="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/addNewButton"
|
||||
style="@style/DSXSmallButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_20"
|
||||
android:background="@drawable/ds_button_primary_background_selector"
|
||||
android:clickable="true"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:text="@string/button_new"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:enabled="false" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:background="@color/shape_primary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
60
core-ui/src/main/res/layout/view_dataview_info.xml
Normal file
60
core-ui/src/main/res/layout/view_dataview_info.xml
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="190dp"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context="com.anytypeio.anytype.core_ui.widgets.toolbar.DataViewInfo">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="48dp"
|
||||
android:fontFamily="@font/inter_regular"
|
||||
android:textColor="@color/text_secondary"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:fontFamily="@font/inter_regular"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/text_secondary"
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/title" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button"
|
||||
style="?attr/materialButtonOutlinedStyle"
|
||||
android:layout_width="118dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:fontFamily="@font/inter_regular"
|
||||
android:insetLeft="0dp"
|
||||
android:insetTop="6dp"
|
||||
android:insetRight="0dp"
|
||||
android:insetBottom="6dp"
|
||||
android:padding="0dp"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textAllCaps="false"
|
||||
android:textSize="13sp"
|
||||
app:cornerRadius="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/description"
|
||||
app:strokeColor="@color/shape_primary"
|
||||
app:strokeWidth="1dp" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
11
core-ui/src/main/res/menu/menu_set_type.xml
Normal file
11
core-ui/src/main/res/menu/menu_set_type.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/turn_into"
|
||||
android:title="@string/menu_turn_to_collection" />
|
||||
<item
|
||||
android:id="@+id/change_query"
|
||||
android:title="@string/menu_change_query" />
|
||||
</menu>
|
|
@ -23,6 +23,9 @@
|
|||
<color name="glyph_white">#FFFFFF</color>
|
||||
<color name="glyph_label">#000000</color>
|
||||
|
||||
<color name="button_text">#000000</color>
|
||||
<color name="button_pressed">#BEBCB1</color>
|
||||
|
||||
<color name="dashboard_card_background">#99000000</color>
|
||||
<color name="dashboard_background">#99252525</color>
|
||||
|
||||
|
@ -67,5 +70,6 @@
|
|||
<color name="object_loading_state_gradient_end_color">#1F1E1D</color>
|
||||
|
||||
<color name="library_action_btn_text_color">#000000</color>
|
||||
<color name="set_new_btn_text">#000000</color>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -138,6 +138,9 @@
|
|||
<color name="glyph_accent">#F09C0E</color>
|
||||
<color name="glyph_white">#FFFFFF</color>
|
||||
<color name="glyph_label">#FFFFFF</color>
|
||||
|
||||
<color name="button_text">#FFFFFF</color>
|
||||
<color name="button_pressed">#41403D</color>
|
||||
|
||||
<color name="dashboard_card_background">#FFFFFF</color>
|
||||
<color name="dashboard_background">#99F5F5F5</color>
|
||||
|
@ -191,5 +194,6 @@
|
|||
|
||||
<color name="widget_button">#A6FFFFFF</color>
|
||||
<color name="home_screen_button">#662C2B27</color>
|
||||
<color name="set_new_btn_text">#FFFFFF</color>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -82,6 +82,7 @@
|
|||
|
||||
<dimen name="sp_12">12sp</dimen>
|
||||
<dimen name="sp_13">13sp</dimen>
|
||||
<dimen name="sp_15">15sp</dimen>
|
||||
<dimen name="dp_2">2dp</dimen>
|
||||
<dimen name="dp_4">4dp</dimen>
|
||||
<dimen name="dp_6">6dp</dimen>
|
||||
|
@ -309,5 +310,6 @@
|
|||
<dimen name="block_data_view_height">96dp</dimen>
|
||||
|
||||
<dimen name="default_dv_gallery_first_line_margin_start">22dp</dimen>
|
||||
<dimen name="default_collection_dv_header_height">56dp</dimen>
|
||||
|
||||
</resources>
|
|
@ -276,6 +276,8 @@
|
|||
<item quantity="one">%d page selected</item>
|
||||
<item quantity="other">%d pages selected</item>
|
||||
</plurals>
|
||||
<string name="button_new">New</string>
|
||||
<string name="viewer_default_title">All</string>
|
||||
|
||||
<string name="sync_status_unknown">Preparing…</string>
|
||||
<string name="sync_status_offline">No connection</string>
|
||||
|
@ -481,6 +483,7 @@
|
|||
<string name="name_layout_profile">Profile</string>
|
||||
<string name="name_layout_todo">Task</string>
|
||||
<string name="name_layout_set">Set</string>
|
||||
<string name="name_layout_collection">Collection</string>
|
||||
<string name="name_layout_note">Note</string>
|
||||
<string name="name_type_note">Note</string>
|
||||
<string name="name_type_note_icon">🗒</string>
|
||||
|
@ -602,4 +605,18 @@
|
|||
|
||||
<string name="object_search_recently_opened_section_title">Recently opened</string>
|
||||
|
||||
<string name="content_description_customize_view_button">Customize-view button</string>
|
||||
<string name="collection_no_items_title">No objects</string>
|
||||
<string name="collection_no_items_description">Add objects or turn into set to aggregate objects with\n equal types or relations</string>
|
||||
<string name="collection_no_items_button">Create object</string>
|
||||
<string name="set_no_query_title">No query selected</string>
|
||||
<string name="set_no_query_description">All objects satisfying query will be displayed in Set</string>
|
||||
<string name="set_no_query_button">Select query</string>
|
||||
<string name="set_no_items_title">No objects</string>
|
||||
<string name="set_no_items_description">No objects of type \"%1$s\" found in your account, please create the first object</string>
|
||||
<string name="set_no_items_button">Create object</string>
|
||||
<string name="set_collection_view_not_present">View is not present in set or collection, please recreate object</string>
|
||||
<string name="menu_turn_to_collection">Turn into collection</string>
|
||||
<string name="menu_change_query">Change query</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -756,6 +756,26 @@
|
|||
<item name="android:singleLine">true</item>
|
||||
</style>
|
||||
|
||||
<style name="ViewerNewButtonStyle">
|
||||
<item name="android:textSize">13sp</item>
|
||||
<item name="android:fontFamily">@font/inter_medium</item>
|
||||
<item name="android:textColor">@color/set_new_btn_text</item>
|
||||
<item name="android:text">@string/button_new</item>
|
||||
<item name="android:textAllCaps">false</item>
|
||||
<item name="cornerRadius">6dp</item>
|
||||
</style>
|
||||
|
||||
<style name="ViewerTitleStyle">
|
||||
<item name="android:textSize">17sp</item>
|
||||
<item name="android:fontFamily">@font/inter_bold</item>
|
||||
<item name="android:textColor">@color/selector_viewer_header</item>
|
||||
<item name="android:ellipsize">end</item>
|
||||
<item name="android:gravity">center_vertical</item>
|
||||
<item name="android:maxLines">1</item>
|
||||
<item name="android:singleLine">true</item>
|
||||
<item name="android:maxWidth">250dp</item>
|
||||
</style>
|
||||
|
||||
<style name="EditorMultiSelectSelectAllButtonTextStyle">
|
||||
<item name="android:fontFamily">@font/inter_semibold</item>
|
||||
<item name="android:textSize">17sp</item>
|
||||
|
@ -1194,4 +1214,20 @@
|
|||
<item name="android:textSize">15sp</item>
|
||||
</style>
|
||||
|
||||
<style name="DefaultPopupMenuStyle" parent="@style/Widget.Material3.PopupMenu">
|
||||
<item name="android:popupBackground">@drawable/bg_menu_default</item>
|
||||
</style>
|
||||
|
||||
<!--https://www.figma.com/file/vgXV7x2v20vJajc7clYJ7a/Mobile-Design-System?node-id=1588%3A59&t=9DPtsMxKLupkwVfY-1-->
|
||||
<style name="DSXSmallButtonStyle">
|
||||
<item name="android:textSize">13sp</item>
|
||||
<item name="android:fontFamily">@font/inter_medium</item>
|
||||
<item name="android:textColor">@color/ds_button_primary_text</item>
|
||||
<item name="android:textAllCaps">false</item>
|
||||
<item name="android:ellipsize">end</item>
|
||||
<item name="android:maxLines">1</item>
|
||||
<item name="android:singleLine">true</item>
|
||||
<item name="rippleColor">@null</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
|
@ -14,7 +14,7 @@ import com.anytypeio.anytype.core_ui.features.editor.BlockViewDiffUtil.Payload
|
|||
import com.anytypeio.anytype.presentation.editor.editor.Markup
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.objects.ObjectIcon
|
||||
import com.anytypeio.anytype.presentation.relations.DocumentRelationView
|
||||
import com.anytypeio.anytype.presentation.relations.ObjectRelationView
|
||||
import com.anytypeio.anytype.presentation.sets.model.FileView
|
||||
import com.anytypeio.anytype.presentation.sets.model.ObjectView
|
||||
import com.anytypeio.anytype.presentation.sets.model.StatusView
|
||||
|
@ -1046,14 +1046,14 @@ class BlockViewDiffUtilTest {
|
|||
|
||||
val index = 0
|
||||
|
||||
val view = DocumentRelationView.Default(
|
||||
relationId = MockDataFactory.randomUuid(),
|
||||
relationKey = Relations.TYPE,
|
||||
val view = ObjectRelationView.Default(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
key = Relations.TYPE,
|
||||
value = null,
|
||||
format = RelationFormat.values().random(),
|
||||
name = MockDataFactory.randomString(),
|
||||
isSystem = false,
|
||||
isReadOnly = false
|
||||
system = false,
|
||||
readOnly = false
|
||||
)
|
||||
|
||||
val oldBlock = BlockView.Relation.Related(
|
||||
|
@ -1093,14 +1093,14 @@ class BlockViewDiffUtilTest {
|
|||
|
||||
val index = 0
|
||||
|
||||
val view = DocumentRelationView.Default(
|
||||
relationId = MockDataFactory.randomUuid(),
|
||||
relationKey = Relations.TYPE,
|
||||
val view = ObjectRelationView.Default(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
key = Relations.TYPE,
|
||||
value = null,
|
||||
format = RelationFormat.values().random(),
|
||||
name = MockDataFactory.randomString(),
|
||||
isSystem = false,
|
||||
isReadOnly = false
|
||||
system = false,
|
||||
readOnly = false
|
||||
)
|
||||
|
||||
val oldBlock = BlockView.Relation.Related(
|
||||
|
@ -1140,13 +1140,13 @@ class BlockViewDiffUtilTest {
|
|||
|
||||
val index = 0
|
||||
|
||||
val view = DocumentRelationView.Checkbox(
|
||||
relationId = MockDataFactory.randomUuid(),
|
||||
relationKey = Relations.TYPE,
|
||||
val view = ObjectRelationView.Checkbox(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
key = Relations.TYPE,
|
||||
name = MockDataFactory.randomString(),
|
||||
isChecked = MockDataFactory.randomBoolean(),
|
||||
isSystem = false,
|
||||
isReadOnly = false
|
||||
system = false,
|
||||
readOnly = false
|
||||
)
|
||||
|
||||
val oldBlock = BlockView.Relation.Related(
|
||||
|
@ -1198,13 +1198,13 @@ class BlockViewDiffUtilTest {
|
|||
color = ""
|
||||
)
|
||||
|
||||
val oldView = DocumentRelationView.Status(
|
||||
relationId = MockDataFactory.randomUuid(),
|
||||
relationKey = Relations.TYPE,
|
||||
val oldView = ObjectRelationView.Status(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
key = Relations.TYPE,
|
||||
name = MockDataFactory.randomString(),
|
||||
status = listOf(oldStatus),
|
||||
isSystem = false,
|
||||
isReadOnly = false
|
||||
system = false,
|
||||
readOnly = false
|
||||
)
|
||||
|
||||
val oldBlock = BlockView.Relation.Related(
|
||||
|
@ -1256,13 +1256,13 @@ class BlockViewDiffUtilTest {
|
|||
color = ""
|
||||
)
|
||||
|
||||
val oldView = DocumentRelationView.Tags(
|
||||
relationId = MockDataFactory.randomUuid(),
|
||||
relationKey = Relations.TYPE,
|
||||
val oldView = ObjectRelationView.Tags(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
key = Relations.TYPE,
|
||||
name = MockDataFactory.randomString(),
|
||||
tags = listOf(oldTag),
|
||||
isSystem = true,
|
||||
isReadOnly = false
|
||||
system = true,
|
||||
readOnly = false
|
||||
)
|
||||
|
||||
val oldBlock = BlockView.Relation.Related(
|
||||
|
@ -1313,13 +1313,13 @@ class BlockViewDiffUtilTest {
|
|||
name = MockDataFactory.randomString()
|
||||
)
|
||||
|
||||
val oldView = DocumentRelationView.Object(
|
||||
relationId = MockDataFactory.randomUuid(),
|
||||
relationKey = Relations.TYPE,
|
||||
val oldView = ObjectRelationView.Object(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
key = Relations.TYPE,
|
||||
name = MockDataFactory.randomString(),
|
||||
objects = listOf(oldObject),
|
||||
isSystem = true,
|
||||
isReadOnly = false
|
||||
system = true,
|
||||
readOnly = false
|
||||
)
|
||||
|
||||
val oldBlock = BlockView.Relation.Related(
|
||||
|
@ -1370,13 +1370,13 @@ class BlockViewDiffUtilTest {
|
|||
name = MockDataFactory.randomString()
|
||||
)
|
||||
|
||||
val oldView = DocumentRelationView.File(
|
||||
relationKey = MockDataFactory.randomUuid(),
|
||||
relationId = MockDataFactory.randomUuid(),
|
||||
val oldView = ObjectRelationView.File(
|
||||
key = MockDataFactory.randomUuid(),
|
||||
id = MockDataFactory.randomUuid(),
|
||||
name = MockDataFactory.randomString(),
|
||||
files = listOf(oldFile),
|
||||
isSystem = false,
|
||||
isReadOnly = false
|
||||
system = false,
|
||||
readOnly = false
|
||||
)
|
||||
|
||||
val oldBlock = BlockView.Relation.Related(
|
||||
|
|
|
@ -396,7 +396,8 @@ class BlockDataRepository(
|
|||
beforeId: Id?,
|
||||
afterId: Id?,
|
||||
ignoreWorkspace: Boolean?,
|
||||
noDepSubscription: Boolean?
|
||||
noDepSubscription: Boolean?,
|
||||
collection: Id?
|
||||
): SearchResult = remote.searchObjectsWithSubscription(
|
||||
subscription = subscription,
|
||||
sorts = sorts,
|
||||
|
@ -408,7 +409,8 @@ class BlockDataRepository(
|
|||
afterId = afterId,
|
||||
beforeId = beforeId,
|
||||
ignoreWorkspace = ignoreWorkspace,
|
||||
noDepSubscription = noDepSubscription
|
||||
noDepSubscription = noDepSubscription,
|
||||
collection = collection
|
||||
)
|
||||
|
||||
override suspend fun searchObjectsByIdWithSubscription(
|
||||
|
@ -539,6 +541,10 @@ class BlockDataRepository(
|
|||
return remote.objectToSet(ctx, source)
|
||||
}
|
||||
|
||||
override suspend fun objectToCollection(ctx: Id): Id {
|
||||
return remote.objectToCollection(ctx)
|
||||
}
|
||||
|
||||
override suspend fun clearBlockContent(ctx: Id, blockIds: List<Id>): Payload {
|
||||
return remote.clearBlockContent(ctx, blockIds)
|
||||
}
|
||||
|
@ -786,4 +792,12 @@ class BlockDataRepository(
|
|||
override suspend fun sortDataViewViewRelation(command: Command.SortRelations): Payload {
|
||||
return remote.sortDataViewViewRelation(command)
|
||||
}
|
||||
|
||||
override suspend fun addObjectToCollection(command: Command.AddObjectToCollection): Payload {
|
||||
return remote.addObjectToCollection(command)
|
||||
}
|
||||
|
||||
override suspend fun setQueryToSet(command: Command.SetQueryToSet): Payload {
|
||||
return remote.setQueryToSet(command)
|
||||
}
|
||||
}
|
|
@ -148,7 +148,8 @@ interface BlockDataStore {
|
|||
beforeId: Id?,
|
||||
afterId: Id?,
|
||||
ignoreWorkspace: Boolean?,
|
||||
noDepSubscription: Boolean?
|
||||
noDepSubscription: Boolean?,
|
||||
collection: Id?
|
||||
): SearchResult
|
||||
|
||||
suspend fun searchObjectsByIdWithSubscription(
|
||||
|
@ -225,6 +226,7 @@ interface BlockDataStore {
|
|||
suspend fun fillTableRow(ctx: String, targetIds: List<String>): Payload
|
||||
|
||||
suspend fun objectToSet(ctx: Id, source: List<String>): Id
|
||||
suspend fun objectToCollection(ctx: Id): Id
|
||||
|
||||
suspend fun blockDataViewSetSource(ctx: Id, block: Id, sources: List<String>): Payload
|
||||
|
||||
|
@ -344,4 +346,6 @@ interface BlockDataStore {
|
|||
suspend fun removeDataViewViewRelation(command: Command.DeleteRelation): Payload
|
||||
suspend fun replaceDataViewViewRelation(command: Command.UpdateRelation): Payload
|
||||
suspend fun sortDataViewViewRelation(command: Command.SortRelations): Payload
|
||||
suspend fun addObjectToCollection(command: Command.AddObjectToCollection): Payload
|
||||
suspend fun setQueryToSet(command: Command.SetQueryToSet): Payload
|
||||
}
|
|
@ -157,7 +157,8 @@ interface BlockRemote {
|
|||
beforeId: Id?,
|
||||
afterId: Id?,
|
||||
ignoreWorkspace: Boolean?,
|
||||
noDepSubscription: Boolean?
|
||||
noDepSubscription: Boolean?,
|
||||
collection: Id?
|
||||
): SearchResult
|
||||
|
||||
suspend fun searchObjectsByIdWithSubscription(
|
||||
|
@ -224,6 +225,7 @@ interface BlockRemote {
|
|||
suspend fun fillTableRow(ctx: String, targetIds: List<String>): Payload
|
||||
|
||||
suspend fun objectToSet(ctx: Id, source: List<String>): Id
|
||||
suspend fun objectToCollection(ctx: Id): Id
|
||||
|
||||
suspend fun blockDataViewSetSource(ctx: Id, block: Id, sources: List<String>): Payload
|
||||
|
||||
|
@ -338,4 +340,6 @@ interface BlockRemote {
|
|||
suspend fun removeDataViewViewRelation(command: Command.DeleteRelation): Payload
|
||||
suspend fun replaceDataViewViewRelation(command: Command.UpdateRelation): Payload
|
||||
suspend fun sortDataViewViewRelation(command: Command.SortRelations): Payload
|
||||
suspend fun addObjectToCollection(command: Command.AddObjectToCollection): Payload
|
||||
suspend fun setQueryToSet(command: Command.SetQueryToSet): Payload
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue