1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 05:47:05 +09:00

DROID-3435 Primitives | Type as Set, object creation logic (#2137)

This commit is contained in:
Konstantin Ivanov 2025-03-09 18:17:08 +01:00 committed by GitHub
parent 4ec2c825fa
commit 4f56a5ffc5
Signed by: github
GPG key ID: B5690EEEBB952194

View file

@ -1200,6 +1200,38 @@ class ObjectSetViewModel(
}
}
private suspend fun proceedWithCreatingObjectTypeSetObject(currentState: ObjectState.DataView.TypeSet) {
val objectType = storeOfObjectTypes.get(vmParams.ctx)
val objectTypeUniqueKey = objectType?.uniqueKey ?:return
if (objectTypeUniqueKey == ObjectTypeIds.BOOKMARK) {
dispatch(
ObjectSetCommand.Modal
.CreateBookmark(
ctx = vmParams.ctx,
space = vmParams.space.id
)
)
} else {
val dvRelationLinks = currentState.dataViewContent.relationLinks
val viewer = currentState.viewerByIdOrFirst(session.currentViewerId.value) ?: return
val prefilled = viewer.prefillNewObjectDetails(
storeOfRelations = storeOfRelations,
dateProvider = dateProvider,
dataViewRelationLinks = dvRelationLinks
)
proceedWithCreatingDataViewObject(
CreateDataViewObject.Params.SetByType(
type = TypeKey(objectTypeUniqueKey),
filters = viewer.filters,
template = objectType.defaultTemplateId,
prefilled = prefilled
)
)
}
}
fun onSelectQueryButtonClicked() {
dispatch(ObjectSetCommand.Modal.OpenEmptyDataViewSelectQueryScreen)
}
@ -2785,9 +2817,8 @@ class ObjectSetViewModel(
}
is ObjectState.DataView.TypeSet -> {
proceedWithCreatingSetObject(
currentState = state,
templateChosenBy = templateId
proceedWithCreatingObjectTypeSetObject(
currentState = state
)
}
}