diff --git a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/slash/SlashRelationsAdapter.kt b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/slash/SlashPropertiesAdapter.kt similarity index 92% rename from core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/slash/SlashRelationsAdapter.kt rename to core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/slash/SlashPropertiesAdapter.kt index c291d26246..78b3220837 100644 --- a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/slash/SlashRelationsAdapter.kt +++ b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/slash/SlashPropertiesAdapter.kt @@ -25,12 +25,12 @@ import com.anytypeio.anytype.core_utils.diff.DefaultDiffUtil import com.anytypeio.anytype.core_utils.ext.dimen 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.editor.editor.slash.SlashPropertyView import com.anytypeio.anytype.presentation.relations.ObjectRelationView import timber.log.Timber -class SlashRelationsAdapter( - private var items: List, +class SlashPropertiesAdapter( + private var items: List, private val clicks: (SlashItem) -> Unit ) : RecyclerView.Adapter() { @@ -142,7 +142,7 @@ class SlashRelationsAdapter( ).apply { updatePadding(this.itemView, defaultPadding) itemView.setOnClickListener { - clicks(SlashItem.RelationNew) + clicks(SlashItem.PropertyNew) } } } @@ -160,8 +160,8 @@ class SlashRelationsAdapter( private fun onItemClicked(position: Int) { if (position != RecyclerView.NO_POSITION) { val view = items[position] - check(view is SlashRelationView.Item) - clicks(SlashItem.Relation(view)) + check(view is SlashPropertyView.Item) + clicks(SlashItem.Property(view)) } } @@ -183,49 +183,49 @@ class SlashRelationsAdapter( val item = items[position] when (holder) { is ListRelationViewHolder.Status -> { - check(item is SlashRelationView.Item) + check(item is SlashPropertyView.Item) val view = item.view check(view is ObjectRelationView.Status) holder.bind(view) } is ListRelationViewHolder.Checkbox -> { - check(item is SlashRelationView.Item) + check(item is SlashPropertyView.Item) val view = item.view check(view is ObjectRelationView.Checkbox) holder.bind(view) } is ListRelationViewHolder.Tags -> { - check(item is SlashRelationView.Item) + check(item is SlashPropertyView.Item) val view = item.view check(view is ObjectRelationView.Tags) holder.bind(view) } is ListRelationViewHolder.Object -> { - check(item is SlashRelationView.Item) + check(item is SlashPropertyView.Item) val view = item.view check(view is ObjectRelationView.Object) holder.bind(view) } is ListRelationViewHolder.File -> { - check(item is SlashRelationView.Item) + check(item is SlashPropertyView.Item) val view = item.view check(view is ObjectRelationView.File) holder.bind(view) } is ListRelationViewHolder.Default -> { - check(item is SlashRelationView.Item) + check(item is SlashPropertyView.Item) val view = item.view check(view is ObjectRelationView.Default) holder.bind(view) } is ListRelationViewHolder.Date -> { - check(item is SlashRelationView.Item) + check(item is SlashPropertyView.Item) val view = item.view check(view is ObjectRelationView.Date) holder.bind(view) } is RelationsSubheaderMenuHolder -> { - check(item is SlashRelationView.Section) + check(item is SlashPropertyView.Section) holder.bind(item) } is RelationsSubheaderOnlyMenuHolder -> { @@ -240,7 +240,7 @@ class SlashRelationsAdapter( override fun getItemCount(): Int = items.size override fun getItemViewType(position: Int): Int = when (val item = items[position]) { - is SlashRelationView.Item -> { + is SlashPropertyView.Item -> { when (item.view) { is ObjectRelationView.Checkbox -> R.layout.item_relation_list_relation_checkbox is ObjectRelationView.Object -> R.layout.item_relation_list_relation_object @@ -251,12 +251,12 @@ class SlashRelationsAdapter( else -> R.layout.item_relation_list_relation_default } } - is SlashRelationView.Section.SubheaderWithBack -> R.layout.item_slash_widget_subheader - SlashRelationView.Section.Subheader -> R.layout.item_slash_widget_subheader_left - SlashRelationView.RelationNew -> R.layout.item_relation_add_new + is SlashPropertyView.Section.SubheaderWithBack -> R.layout.item_slash_widget_subheader + SlashPropertyView.Section.Subheader -> R.layout.item_slash_widget_subheader_left + SlashPropertyView.PropertyNew -> R.layout.item_relation_add_new } - fun update(update: List) { + fun update(update: List) { Timber.d("Updating adapter: $update") val differ = DefaultDiffUtil(old = items, new = update) val result = DiffUtil.calculateDiff(differ, false) diff --git a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/slash/SlashWidget.kt b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/slash/SlashWidget.kt index dac0ef158c..5fd879b308 100644 --- a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/slash/SlashWidget.kt +++ b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/slash/SlashWidget.kt @@ -54,7 +54,7 @@ class SlashWidget @JvmOverloads constructor( } private val relationsAdapter by lazy { - SlashRelationsAdapter( + SlashPropertiesAdapter( items = listOf(), clicks = { _clickEvents.trySend(it) } ) diff --git a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/slash/holders/MainMenuHolder.kt b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/slash/holders/MainMenuHolder.kt index 77807ae54a..75560e21aa 100644 --- a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/slash/holders/MainMenuHolder.kt +++ b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/slash/holders/MainMenuHolder.kt @@ -38,7 +38,7 @@ class MainMenuHolder(val binding: ItemSlashWidgetMainBinding) : textMain.setText(R.string.slash_widget_main_other) iconMain.setImageResource(R.drawable.ic_slash_main_other) } - SlashItem.Main.Relations -> { + SlashItem.Main.Properties -> { textMain.setText(R.string.slash_widget_main_relations) iconMain.setImageResource(R.drawable.ic_properties_purple_24) } diff --git a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/slash/holders/RelationsSubheaderMenuHolder.kt b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/slash/holders/RelationsSubheaderMenuHolder.kt index 27c755ade8..ffafb7516d 100644 --- a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/slash/holders/RelationsSubheaderMenuHolder.kt +++ b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/slash/holders/RelationsSubheaderMenuHolder.kt @@ -6,19 +6,19 @@ import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetSubheaderBinding import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetSubheaderLeftBinding import com.anytypeio.anytype.core_utils.ext.invisible import com.anytypeio.anytype.core_utils.ext.visible -import com.anytypeio.anytype.presentation.editor.editor.slash.SlashRelationView +import com.anytypeio.anytype.presentation.editor.editor.slash.SlashPropertyView class RelationsSubheaderMenuHolder( val binding: ItemSlashWidgetSubheaderBinding ) : RecyclerView.ViewHolder(binding.root) { - fun bind(item: SlashRelationView.Section) = with(binding) { + fun bind(item: SlashPropertyView.Section) = with(binding) { val text = when (item) { - SlashRelationView.Section.Subheader -> { + SlashPropertyView.Section.Subheader -> { flBack.invisible() R.string.slash_widget_main_relations } - SlashRelationView.Section.SubheaderWithBack -> { + SlashPropertyView.Section.SubheaderWithBack -> { flBack.visible() R.string.slash_widget_main_relations } diff --git a/core-utils/src/main/java/com/anytypeio/anytype/core_utils/const/SlashConst.kt b/core-utils/src/main/java/com/anytypeio/anytype/core_utils/const/SlashConst.kt index c359c957cf..40883ad262 100644 --- a/core-utils/src/main/java/com/anytypeio/anytype/core_utils/const/SlashConst.kt +++ b/core-utils/src/main/java/com/anytypeio/anytype/core_utils/const/SlashConst.kt @@ -5,7 +5,7 @@ object SlashConst { const val SLASH_MAIN_STYLE = "Style" const val SLASH_MAIN_MEDIA = "Media" const val SLASH_MAIN_OBJECTS = "Objects" - const val SLASH_MAIN_RELATIONS = "Relations" + const val SLASH_MAIN_PROPERTIES = "Properties" const val SLASH_MAIN_OTHER = "Other" const val SLASH_MAIN_ACTIONS = "Actions" const val SLASH_MAIN_ALIGNMENT = "Alignment" @@ -58,5 +58,5 @@ object SlashConst { const val SLASH_BACK = "Back" - const val SLASH_RELATION_NEW = "Relation new" + const val SLASH_PROPERTY_NEW = "Property new" } \ No newline at end of file diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/EditorViewModel.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/EditorViewModel.kt index 1373823f95..0c6fcebc99 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/EditorViewModel.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/EditorViewModel.kt @@ -30,7 +30,6 @@ import com.anytypeio.anytype.core_models.Position import com.anytypeio.anytype.core_models.Relation import com.anytypeio.anytype.core_models.RelationFormat import com.anytypeio.anytype.core_models.Relations -import com.anytypeio.anytype.core_models.Struct import com.anytypeio.anytype.core_models.TextBlock import com.anytypeio.anytype.core_models.ThemeColor import com.anytypeio.anytype.core_models.Url @@ -162,7 +161,7 @@ import com.anytypeio.anytype.presentation.editor.editor.slash.SlashExtensions.SL import com.anytypeio.anytype.presentation.editor.editor.slash.SlashExtensions.getSlashWidgetAlignmentItems import com.anytypeio.anytype.presentation.editor.editor.slash.SlashExtensions.getSlashWidgetStyleItems import com.anytypeio.anytype.presentation.editor.editor.slash.SlashItem -import com.anytypeio.anytype.presentation.editor.editor.slash.SlashRelationView +import com.anytypeio.anytype.presentation.editor.editor.slash.SlashPropertyView import com.anytypeio.anytype.presentation.editor.editor.slash.SlashWidgetState import com.anytypeio.anytype.presentation.editor.editor.slash.convertToMarkType import com.anytypeio.anytype.presentation.editor.editor.slash.convertToUiBlock @@ -249,7 +248,6 @@ import com.anytypeio.anytype.core_models.ext.toObject import com.anytypeio.anytype.core_models.multiplayer.SpaceMemberPermissions import com.anytypeio.anytype.presentation.editor.ControlPanelMachine.Event.SAM.* import com.anytypeio.anytype.core_models.ObjectViewDetails -import com.anytypeio.anytype.domain.objects.getTypeOfObject import com.anytypeio.anytype.presentation.editor.editor.Intent.Clipboard.Copy import com.anytypeio.anytype.presentation.editor.editor.Intent.Clipboard.Paste import com.anytypeio.anytype.presentation.editor.editor.ext.isAllowedToShowTypesWidget @@ -262,8 +260,6 @@ import com.anytypeio.anytype.presentation.editor.model.OnEditorDatePickerEvent.O import com.anytypeio.anytype.presentation.editor.model.OnEditorDatePickerEvent.OnTodayClick import com.anytypeio.anytype.presentation.editor.model.OnEditorDatePickerEvent.OnTomorrowClick import com.anytypeio.anytype.presentation.extension.getFileDetailsForBlock -import com.anytypeio.anytype.presentation.extension.getObjRelationsViews -import com.anytypeio.anytype.presentation.extension.getRecommendedRelations import com.anytypeio.anytype.presentation.extension.getTypeForObject import com.anytypeio.anytype.presentation.extension.getUrlForFileContent import com.anytypeio.anytype.presentation.navigation.NavPanelState @@ -275,7 +271,6 @@ import com.anytypeio.anytype.presentation.objects.hasLayoutConflict import com.anytypeio.anytype.presentation.objects.isTemplatesAllowed import com.anytypeio.anytype.presentation.objects.toViews import com.anytypeio.anytype.presentation.relations.ObjectRelationView -import com.anytypeio.anytype.presentation.relations.type import com.anytypeio.anytype.presentation.relations.view import com.anytypeio.anytype.presentation.search.ObjectSearchConstants import com.anytypeio.anytype.presentation.search.ObjectSearchViewModel @@ -4965,11 +4960,11 @@ class EditorViewModel( proceedWithGettingObjectTypes( sorts = ObjectSearchConstants.defaultObjectTypeSearchSorts() ) { objectTypes -> - getRelations { relations -> + getProperties { properties -> val widgetState = SlashExtensions.getUpdatedSlashWidgetState( text = event.filter, objectTypes = objectTypes.toSlashItemView(), - relations = relations, + properties = properties, viewType = slashViewType ) incFilterSearchEmptyCount(widgetState) @@ -5040,8 +5035,8 @@ class EditorViewModel( ) ) } - is SlashItem.Main.Relations -> { - getRelations { proceedWithRelations(it) } + is SlashItem.Main.Properties -> { + getProperties { proceedWithProperties(it) } } is SlashItem.Main.Objects -> { proceedWithGettingObjectTypes( @@ -5158,9 +5153,9 @@ class EditorViewModel( controlPanelInteractor.onEvent(ControlPanelMachine.Event.Slash.OnStop) onAddNewObjectClicked(objectTypeView = item.objectTypeView) } - is SlashItem.Relation -> { + is SlashItem.Property -> { val isBlockEmpty = cutSlashFilter(targetId = targetId) - val relationKey = item.relation.view.key + val relationKey = item.property.view.key onSlashRelationItemClicked( relationKey = relationKey, targetId = targetId, @@ -5207,7 +5202,7 @@ class EditorViewModel( is SlashItem.Subheader -> { Timber.d("Click on Slash Subheader, do nothing") } - SlashItem.RelationNew -> { + SlashItem.PropertyNew -> { dispatch( Command.OpenAddRelationScreen(ctx = context, target = targetId) ) @@ -5352,7 +5347,7 @@ class EditorViewModel( } } - private fun getRelations(action: (List) -> Unit) { + private fun getProperties(action: (List) -> Unit) { val objectViewDetails = orchestrator.stores.details.current() val currentObj = objectViewDetails.getObject(vmParams.ctx) if (currentObj == null) { @@ -5382,7 +5377,7 @@ class EditorViewModel( storeOfObjectTypes = storeOfObjectTypes ) }.map { - SlashRelationView.Item(it) + SlashPropertyView.Item(it) } action.invoke(properties) @@ -5397,10 +5392,10 @@ class EditorViewModel( ) } - private fun proceedWithRelations(relations: List) { + private fun proceedWithProperties(properties: List) { onSlashWidgetStateChanged( SlashWidgetState.UpdateItems.empty().copy( - relationItems = SlashExtensions.getSlashWidgetRelationItems(relations) + relationItems = SlashExtensions.getSlashWidgetPropertyItems(properties) ) ) } diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/editor/slash/SlashExtensions.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/editor/slash/SlashExtensions.kt index 8e1aff4339..16316ca70d 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/editor/slash/SlashExtensions.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/editor/slash/SlashExtensions.kt @@ -2,6 +2,7 @@ package com.anytypeio.anytype.presentation.editor.editor.slash import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.ThemeColor +import com.anytypeio.anytype.core_utils.const.SlashConst import com.anytypeio.anytype.core_utils.ext.parseMatchedInt import com.anytypeio.anytype.domain.table.CreateTable.Companion.DEFAULT_COLUMN_COUNT import com.anytypeio.anytype.domain.table.CreateTable.Companion.DEFAULT_MAX_COLUMN_COUNT @@ -49,7 +50,7 @@ object SlashExtensions { SlashItem.Main.Style, SlashItem.Main.Media, SlashItem.Main.Objects, - SlashItem.Main.Relations, + SlashItem.Main.Properties, SlashItem.Main.Other, SlashItem.Main.Actions, SlashItem.Main.Alignment, @@ -136,11 +137,11 @@ object SlashExtensions { SlashItem.SelectDate ) + objectTypes.toSlashItemView() - fun getSlashWidgetRelationItems(relations: List): List = + fun getSlashWidgetPropertyItems(properties: List): List = listOf( - SlashRelationView.Section.SubheaderWithBack, + SlashPropertyView.Section.SubheaderWithBack, //SlashRelationView.RelationNew - ) + relations + ) + properties fun getSlashWidgetColorItems(color: ThemeColor?): List = ThemeColor.values().map { themeColor -> @@ -165,7 +166,7 @@ object SlashExtensions { viewType: Int, text: CharSequence, objectTypes: List, - relations: List + properties: List ): SlashWidgetState.UpdateItems { val filter = text.subSequence(1, text.length).toString() val filteredStyle = filterSlashItems( @@ -205,9 +206,9 @@ object SlashExtensions { filter = filter, items = listOf(SlashItem.Actions.LinkTo, SlashItem.SelectDate) + objectTypes ) - val filteredRelations = filterRelations( + val filteredRelations = filterProperties( filter = filter, - items = relations + items = properties ) return SlashWidgetState.UpdateItems.empty().copy( styleItems = filteredStyle, @@ -251,28 +252,31 @@ object SlashExtensions { return updateWithSubheader(filtered) } - private fun filterRelations( + private fun filterProperties( filter: String, - items: List - ): List { - val filtered = mutableListOf() - if (SlashRelationView.RelationNew.identifier.contains(filter, true)) { - filtered.add(SlashRelationView.RelationNew) - } + items: List + ): List { + val filtered = mutableListOf() +// if (SlashRelationView.RelationNew.identifier.contains(filter, true)) { +// filtered.add(SlashRelationView.RelationNew) +// } + + // Process property items. items.forEach { item -> if (searchBySubheadingOrName( filter = filter, - subheading = SlashItem.Main.Relations.getSearchName(), + subheading = listOf(SlashConst.SLASH_MAIN_PROPERTIES, "Relations"), name = item.view.name ) ) { filtered.add(item) } } + // If there are any filtered items, prepend a section header. return if (filtered.isEmpty()) { filtered } else { - listOf(SlashRelationView.Section.Subheader) + filtered + listOf(SlashPropertyView.Section.Subheader) + filtered } } @@ -337,7 +341,15 @@ object SlashExtensions { name: String, abbreviation: List? = null ): Boolean = subheading.startsWith(filter, true) || name.contains(filter, true) || - abbreviation?.any { it.contains(filter, true) } ?: false + abbreviation?.any { it.contains(filter, true) } == true + + private fun searchBySubheadingOrName( + filter: String, + subheading: List, + name: String, + abbreviation: List? = null + ): Boolean = subheading.any { it.startsWith(filter, true) } || name.contains(filter, true) || + abbreviation?.any { it.contains(filter, true) } == true private fun updateWithSubheader(items: List): List = if (items.isNotEmpty()) { diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/editor/slash/SlashItem.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/editor/slash/SlashItem.kt index e051e745b9..551daddcb3 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/editor/slash/SlashItem.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/editor/slash/SlashItem.kt @@ -12,7 +12,7 @@ sealed class SlashWidgetState { val styleItems: List, val mediaItems: List, val objectItems: List, - val relationItems: List, + val relationItems: List, val otherItems: List, val actionsItems: List, val alignmentItems: List, @@ -148,8 +148,8 @@ sealed class SlashItem { override fun getAbbreviation(): List? = null } - object Relations : Main() { - override fun getSearchName(): String = SlashConst.SLASH_MAIN_RELATIONS + object Properties : Main() { + override fun getSearchName(): String = SlashConst.SLASH_MAIN_PROPERTIES override fun getAbbreviation(): List? = null } @@ -305,14 +305,14 @@ sealed class SlashItem { } //endregion - //region RELATION - data class Relation(val relation: SlashRelationView.Item) : SlashItem() { - override fun getSearchName(): String = relation.view.name + //region Properties + data class Property(val property: SlashPropertyView.Item) : SlashItem() { + override fun getSearchName(): String = property.view.name override fun getAbbreviation(): List? = null } - object RelationNew : SlashItem() { - override fun getSearchName(): String = SlashConst.SLASH_RELATION_NEW + object PropertyNew : SlashItem() { + override fun getSearchName(): String = SlashConst.SLASH_PROPERTY_NEW override fun getAbbreviation(): List? = null } //endregion diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/editor/slash/SlashRelationView.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/editor/slash/SlashPropertyView.kt similarity index 72% rename from presentation/src/main/java/com/anytypeio/anytype/presentation/editor/editor/slash/SlashRelationView.kt rename to presentation/src/main/java/com/anytypeio/anytype/presentation/editor/editor/slash/SlashPropertyView.kt index ccf8409323..52de4f3d4e 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/editor/slash/SlashRelationView.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/editor/slash/SlashPropertyView.kt @@ -3,12 +3,12 @@ package com.anytypeio.anytype.presentation.editor.editor.slash import com.anytypeio.anytype.core_utils.diff.DefaultObjectDiffIdentifier import com.anytypeio.anytype.presentation.relations.ObjectRelationView -sealed class SlashRelationView : DefaultObjectDiffIdentifier { - data class Item(val view: ObjectRelationView) : SlashRelationView() { +sealed class SlashPropertyView : DefaultObjectDiffIdentifier { + data class Item(val view: ObjectRelationView) : SlashPropertyView() { override val identifier: String get() = view.identifier } - sealed class Section : SlashRelationView() { + sealed class Section : SlashPropertyView() { object Subheader : Section() { override val identifier: String get() = javaClass.simpleName } @@ -17,7 +17,7 @@ sealed class SlashRelationView : DefaultObjectDiffIdentifier { override val identifier: String get() = javaClass.simpleName } } - object RelationNew : SlashRelationView() { + object PropertyNew : SlashPropertyView() { override val identifier: String get() = javaClass.simpleName } } \ No newline at end of file diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetClicksTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetClicksTest.kt index 24cee28b1f..fb593ad869 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetClicksTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetClicksTest.kt @@ -1,24 +1,16 @@ package com.anytypeio.anytype.presentation.editor.editor import androidx.arch.core.executor.testing.InstantTaskExecutorRule -import com.anytypeio.anytype.core_models.ObjectViewDetails import com.anytypeio.anytype.core_models.Block -import com.anytypeio.anytype.core_models.ObjectType -import com.anytypeio.anytype.core_models.Relation -import com.anytypeio.anytype.core_models.Relations -import com.anytypeio.anytype.core_models.StubRelationObject import com.anytypeio.anytype.presentation.MockObjectTypes import com.anytypeio.anytype.presentation.MockTypicalDocumentFactory import com.anytypeio.anytype.presentation.editor.editor.model.types.Types import com.anytypeio.anytype.presentation.editor.editor.slash.SlashEvent import com.anytypeio.anytype.presentation.editor.editor.slash.SlashItem -import com.anytypeio.anytype.presentation.editor.editor.slash.SlashRelationView import com.anytypeio.anytype.presentation.editor.editor.slash.SlashWidgetState -import com.anytypeio.anytype.presentation.number.NumberParser import com.anytypeio.anytype.presentation.objects.ObjectIcon import com.anytypeio.anytype.presentation.objects.ObjectTypeView import com.anytypeio.anytype.presentation.objects.custom_icon.CustomIconColor -import com.anytypeio.anytype.presentation.relations.ObjectRelationView import com.anytypeio.anytype.presentation.util.DefaultCoroutineTestRule import com.anytypeio.anytype.test_utils.MockDataFactory import kotlin.test.assertEquals diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetRelationsTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetRelationsTest.kt index 0d037b0c9b..4a65ed1a8b 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetRelationsTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetRelationsTest.kt @@ -16,7 +16,7 @@ import com.anytypeio.anytype.presentation.editor.EditorViewModel import com.anytypeio.anytype.presentation.editor.editor.model.BlockView import com.anytypeio.anytype.presentation.editor.editor.slash.SlashEvent import com.anytypeio.anytype.presentation.editor.editor.slash.SlashItem -import com.anytypeio.anytype.presentation.editor.editor.slash.SlashRelationView +import com.anytypeio.anytype.presentation.editor.editor.slash.SlashPropertyView import com.anytypeio.anytype.presentation.relations.ObjectRelationView import com.anytypeio.anytype.presentation.util.DefaultCoroutineTestRule import com.anytypeio.anytype.presentation.util.TXT @@ -129,8 +129,8 @@ class EditorSlashWidgetRelationsTest: EditorPresentationTestSetup() { advanceUntilIdle() vm.onSlashItemClicked( - SlashItem.Relation( - relation = SlashRelationView.Item( + SlashItem.Property( + property = SlashPropertyView.Item( view = ObjectRelationView.Default( id = r2.id, key = r2.key, @@ -260,8 +260,8 @@ class EditorSlashWidgetRelationsTest: EditorPresentationTestSetup() { //TESTING vm.onSlashItemClicked( - SlashItem.Relation( - relation = SlashRelationView.Item( + SlashItem.Property( + property = SlashPropertyView.Item( view = ObjectRelationView.Default( key = r3.key, id = r3.id, @@ -383,8 +383,8 @@ class EditorSlashWidgetRelationsTest: EditorPresentationTestSetup() { //TESTING vm.onSlashItemClicked( - SlashItem.Relation( - relation = SlashRelationView.Item( + SlashItem.Property( + property = SlashPropertyView.Item( view = ObjectRelationView.Default( id = r3.id, key = r3.key, @@ -477,8 +477,8 @@ class EditorSlashWidgetRelationsTest: EditorPresentationTestSetup() { //TESTING vm.onSlashItemClicked( - SlashItem.Relation( - relation = SlashRelationView.Item( + SlashItem.Property( + property = SlashPropertyView.Item( view = ObjectRelationView.Default( key = r2.key, id = r2.id, @@ -568,8 +568,8 @@ class EditorSlashWidgetRelationsTest: EditorPresentationTestSetup() { id = a.id, selection = IntRange(14, 14) ) - onSlashItemClicked(SlashItem.Main.Relations) - onSlashItemClicked(SlashItem.RelationNew) + onSlashItemClicked(SlashItem.Main.Properties) + onSlashItemClicked(SlashItem.PropertyNew) advanceUntilIdle() //open RelationListScreen