* DROID-439 App | Relations refactoring, use SearchObjects for object types (#2592) * DROID-446 Objects | Enhancement | Store relation links and process its updates (#2597) * DROID-456 Tech | Remove deprecated API for creating object types (#2601) * DROID-455 Object types | Enhancement Get object type list from ObjectSearch on Global search screen (#2602) * DROID-459 Sets | Refactoring | Use relations links instead of relations for building search params to get data view data (#2603) * DROID-458 Objects | Refactoring | Integrate new api for creating objets (#2604) * DROID-464 Relations | Refactoring | New API for creating a relation from scratch - for data view or for an object (#2605) * DROID-467 Relations | Refactoring | New API for creating options - for tags and statuses (#2607) * DROID-470 Relations | Refactoring | New API for removing any relation from an object or from a data view (#2608) * DROID-460 Tech | Object relations list (#2610) * DROID-486 Sets | Refactoring | Displaying and controlling visibility of data view relations (#2611) * DROID-500 Relations | Refactoring | Extend API of ObjectStore to be able to get a relation by its id (#2619) * DROID-459 Sets | Fix | Get relations from store by id and not by key (#2618) * DROID-489 Tech | Relations as object, add relationKey to relation connected screens (#2622) * DROID-490 Sets | Refactoring | Displaying relation values for current object in bottom sheet cells (#2629) * DROID-505 Relations | Refactoring | New interface for relations store (#2633) * DROID-509 Relations | Refactoring | Bind new relations store with subscription container (#2635) * DROID-507 Tech | MW , migration + relation links (#2636) * DROID-507 Tech | MW , migration + relation links, fixes (#2637) * DROID-517 Sets | Fix | Provide correct keys for data view search-and-subscribe query (#2641) * DROID-409 Relations | Refactoring | Use relation key instead of id when creating new relation (#2642) * DROID-521 Sets & Objects | Refactoring | Add relation to a data view or to an object from existing relations (#2644) * DROID-522 Relations | Refactoring | Add objects to relations with object format (#2645) * DROID-523 Object types | Refactoring | Implement global store for object types (#2646) * DROID-527 Object types | Refactoring | Integrate global store for object types (#2647) * DROID-531 Relations | Refactoring | Parse tag and status relations values (#2649) * DROID-535 Tech | Integrate new MW lib with migration fixes (#2653) * DROID-535 Tech | MW integration fixes (#2660) * DROID-559 Relations | Refactoring | Parse tag and status values in editor (#2662) * DROID-560 Relations | Refactoring | Integrate new lib with fixes (#2663) * DROID-561 Relations | Refactoring | Parsing tag and status values in dv (#2665) * DROID-562 Dashboard | Refactoring | Use store of object types as object type provider for favorites tab on dashboard (#2667) * DROID-567 Relations | Refactoring | Suggest available options to populate a relation (#2671) * DROID-604 Relations | Refactoring | Use details from Object.CreateRelation.Response to populate relation store (#2705) * DROID-603 Relations | Refactoring | Creating relation options + Deleting relation from object (#2706) * DROID-619 Relations | Refactoring | Migrate data view sorts and filters to the new relation-as-object paradigm (#2711) * DROID-622 Relations | Tech | Update MW to 0.24.0-rc1 (#2714) * DROID-598 Sets | Refactoring | Provide relation format for date filters (#2715) * DROID-625 Protocol | Enhancement | Integrate v0.24.0-rc2 (#2718)
265 lines
9.1 KiB
Kotlin
265 lines
9.1 KiB
Kotlin
package com.anytypeio.anytype.core_models
|
|
|
|
import com.anytypeio.anytype.core_models.Block.Content.Text
|
|
import com.anytypeio.anytype.core_models.restrictions.DataViewRestrictions
|
|
import com.anytypeio.anytype.core_models.restrictions.ObjectRestriction
|
|
|
|
sealed class Event {
|
|
|
|
abstract val context: Id
|
|
|
|
sealed class Command : Event() {
|
|
|
|
sealed class BlockEvent : Command() {
|
|
data class SetRelation(
|
|
override val context: String,
|
|
val id: Id,
|
|
val key: String?
|
|
) : BlockEvent()
|
|
}
|
|
|
|
data class ShowObject(
|
|
override val context: Id,
|
|
val root: Id,
|
|
val details: Block.Details = Block.Details(emptyMap()),
|
|
val blocks: List<Block>,
|
|
val type: SmartBlockType = SmartBlockType.PAGE,
|
|
val objectTypes: List<ObjectType> = emptyList(),
|
|
val relations: List<Relation> = emptyList(),
|
|
val relationLinks: List<RelationLink> = emptyList(),
|
|
val objectRestrictions: List<ObjectRestriction> = emptyList(),
|
|
val dataViewRestrictions: List<DataViewRestrictions> = emptyList()
|
|
) : Command()
|
|
|
|
data class AddBlock(
|
|
override val context: String,
|
|
val blocks: List<Block>,
|
|
val details: Block.Details = Block.Details(emptyMap())
|
|
) : Command()
|
|
|
|
/**
|
|
* Command to delete blocks
|
|
* @property context id of the context
|
|
* @property targets id of the target blocks, which we need to delete
|
|
*/
|
|
data class DeleteBlock(
|
|
override val context: String,
|
|
val targets: List<Id>
|
|
) : Command()
|
|
|
|
data class UpdateBlockText(
|
|
override val context: String,
|
|
val id: Id,
|
|
val text: String
|
|
) : Command()
|
|
|
|
/**
|
|
* Command to update block's text content.
|
|
* @property id id of the target block
|
|
* @property text new text (considered updated if not null)
|
|
* @property style new style (considered updated if not null)
|
|
* @property color new color of the whole block (considered updated if not null)
|
|
* @property backgroundColor background color of the whole block (considered updated if not null)
|
|
*/
|
|
data class GranularChange(
|
|
override val context: String,
|
|
val id: Id,
|
|
val text: String? = null,
|
|
val style: Text.Style? = null,
|
|
val color: String? = null,
|
|
val backgroundColor: String? = null,
|
|
val marks: List<Text.Mark>? = null,
|
|
val alignment: Block.Align? = null,
|
|
val checked: Boolean? = null,
|
|
val emojiIcon: String? = null,
|
|
val imageIcon: String? = null,
|
|
) : Command()
|
|
|
|
/**
|
|
* Command to update link.
|
|
* @property context update's context
|
|
* @property id id of the link
|
|
* @property target id of the linked block
|
|
* @property fields link's fields (considered updated if not null)
|
|
*/
|
|
data class LinkGranularChange(
|
|
override val context: String,
|
|
val id: Id,
|
|
val target: Id,
|
|
val iconSize: Block.Content.Link.IconSize?,
|
|
val cardStyle: Block.Content.Link.CardStyle?,
|
|
val description: Block.Content.Link.Description?,
|
|
val relations: Set<Block.Content.Link.Relation>?,
|
|
) : Command()
|
|
|
|
/**
|
|
* Command to update bookmark
|
|
* @property context id of the context
|
|
* @property target id of the bookmark block
|
|
* @property url bookmark's url (considered updated if not null)
|
|
* @property title bookmark's title (considered updated if not null)
|
|
* @property description bookmark's description (considered updated if not null)
|
|
* @property image bookmark's image hash (considered updated if not null)
|
|
* @property favicon bookmark's favicon hash (considered updated if not null)
|
|
*/
|
|
data class BookmarkGranularChange(
|
|
override val context: Id,
|
|
val target: Id,
|
|
val url: Url?,
|
|
val title: String?,
|
|
val description: String?,
|
|
val image: Hash?,
|
|
val favicon: Hash?,
|
|
val targetObjectId: Id?,
|
|
val state: Block.Content.Bookmark.State?
|
|
) : Command()
|
|
|
|
/**
|
|
* Command to update a block structure.
|
|
* @property context context id for this command (i.e page id, dashboard id, etc.)
|
|
* @property id id of the block whose structure we need to update
|
|
* @property children list of children ids for this block [id]
|
|
*/
|
|
data class UpdateStructure(
|
|
override val context: String,
|
|
val id: Id,
|
|
val children: List<Id>
|
|
) : Command()
|
|
|
|
data class UpdateFields(
|
|
override val context: Id,
|
|
val target: Id,
|
|
val fields: Block.Fields
|
|
) : Command()
|
|
|
|
|
|
sealed class Details : Command() {
|
|
/**
|
|
* Command to set details (metadata) of the target block.
|
|
* Overwrites existing state.
|
|
* @property context id of the context
|
|
* @property target id of the target block, whose details we need to update
|
|
* @property details details of the target block
|
|
*/
|
|
data class Set(
|
|
override val context: Id,
|
|
val target: Id,
|
|
val details: Block.Fields
|
|
) : Details()
|
|
|
|
/**
|
|
* Command to amend details (metadata) of the target block.
|
|
* Amend existing state.
|
|
* @property context id of the context
|
|
* @property target id of the target block, whose details we need to update
|
|
* @property details slide of details of the target block
|
|
*/
|
|
data class Amend(
|
|
override val context: Id,
|
|
val target: Id,
|
|
val details: Map<Id, Any?>
|
|
) : Details()
|
|
|
|
/**
|
|
* Command to unset details (metadata) of the target block.
|
|
* Unset existing detail keys.
|
|
* @property context id of the context
|
|
* @property target id of the target block, whose details we need to update
|
|
* @property keys
|
|
*/
|
|
data class Unset(
|
|
override val context: Id,
|
|
val target: Id,
|
|
val keys: List<Id>
|
|
) : Details()
|
|
}
|
|
|
|
|
|
/**
|
|
* Command to update file block content
|
|
*/
|
|
data class UpdateFileBlock(
|
|
override val context: String,
|
|
val id: Id,
|
|
val state: Block.Content.File.State? = null,
|
|
val type: Block.Content.File.Type? = null,
|
|
val name: String? = null,
|
|
val hash: String? = null,
|
|
val mime: String? = null,
|
|
val size: Long? = null
|
|
) : Command()
|
|
|
|
data class UpdateDividerBlock(
|
|
override val context: String,
|
|
val id: Id,
|
|
val style: Block.Content.Divider.Style
|
|
) : Command()
|
|
|
|
sealed class ObjectRelationLinks : Command() {
|
|
data class Amend(
|
|
override val context: String,
|
|
val id: Id,
|
|
val relationLinks: List<RelationLink>
|
|
) : ObjectRelationLinks()
|
|
|
|
data class Remove(
|
|
override val context: String,
|
|
val id: Id,
|
|
val keys: List<Key>
|
|
) : ObjectRelationLinks()
|
|
}
|
|
|
|
sealed class ObjectRelation : Command() {
|
|
data class Set(
|
|
override val context: String,
|
|
val id: Id,
|
|
val key: Id,
|
|
val relations: List<Relation>
|
|
) : ObjectRelation()
|
|
|
|
data class Remove(
|
|
override val context: String,
|
|
val id: Id,
|
|
val key: Id
|
|
) : ObjectRelation()
|
|
}
|
|
|
|
sealed class DataView : Command() {
|
|
|
|
/**
|
|
* Sent when a data-view's view has been changed or added.
|
|
* @property [target] data view's block id
|
|
*/
|
|
data class SetView(
|
|
override val context: Id,
|
|
val target: Id,
|
|
val viewerId: Id,
|
|
val viewer: DVViewer
|
|
) : DataView()
|
|
|
|
data class DeleteView(
|
|
override val context: String,
|
|
val target: String,
|
|
val viewer: String
|
|
) : DataView()
|
|
|
|
/**
|
|
* Sent when a data-view's relation has been changed or added.
|
|
* @property [dv] data view's block id
|
|
* @property [links] relations link for this data view
|
|
*/
|
|
data class SetRelation(
|
|
override val context: Id,
|
|
val dv: Id,
|
|
val links: List<RelationLink>
|
|
) : DataView()
|
|
|
|
|
|
data class SetSource(
|
|
override val context: Id,
|
|
val dv: Id,
|
|
val sources: List<Id>
|
|
) : DataView()
|
|
}
|
|
}
|
|
} |