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

DROID-3367 Primitives | Object icons (#2180)

This commit is contained in:
Konstantin Ivanov 2025-03-21 14:30:06 +01:00 committed by GitHub
parent ccbdc3c146
commit b003a9e915
Signed by: github
GPG key ID: B5690EEEBB952194
88 changed files with 632 additions and 1877 deletions

View file

@ -16,6 +16,8 @@ import com.anytypeio.anytype.core_models.primitives.SpaceId
import com.anytypeio.anytype.core_models.restrictions.ObjectRestriction
import com.anytypeio.anytype.domain.all_content.RestoreAllContentState
import com.anytypeio.anytype.domain.misc.UrlBuilder
import com.anytypeio.anytype.domain.objects.StoreOfObjectTypes
import com.anytypeio.anytype.domain.objects.getTypeOfObject
import com.anytypeio.anytype.domain.primitives.FieldParser
import com.anytypeio.anytype.feature_allcontent.presentation.AllContentViewModel.Companion.DEFAULT_INITIAL_TAB
import com.anytypeio.anytype.presentation.mapper.objectIcon
@ -182,12 +184,13 @@ fun RestoreAllContentState.Response.Success.mapToSort(): ObjectsListSort {
}
}
fun ObjectWrapper.Basic.toAllContentItem(
suspend fun ObjectWrapper.Basic.toAllContentItem(
space: SpaceId,
urlBuilder: UrlBuilder,
objectTypes: List<ObjectWrapper.Type>,
isOwnerOrEditor: Boolean,
fieldParser: FieldParser
fieldParser: FieldParser,
storeOfObjectTypes: StoreOfObjectTypes
): UiContentItem.Item {
val obj = this
val typeUrl = obj.getProperType()
@ -207,7 +210,10 @@ fun ObjectWrapper.Basic.toAllContentItem(
}
}?.name,
layout = layout,
icon = obj.objectIcon(builder = urlBuilder),
icon = obj.objectIcon(
builder = urlBuilder,
objType = storeOfObjectTypes.getTypeOfObject(obj)
),
lastModifiedDate = DateParser.parse(obj.getValue(Relations.LAST_MODIFIED_DATE)) ?: 0L,
createdDate = DateParser.parse(obj.getValue(Relations.CREATED_DATE)) ?: 0L,
isPossibleToDelete = isOwnerOrEditor
@ -229,7 +235,7 @@ fun ObjectWrapper.Type.toAllContentType(
return UiContentItem.Type(
id = obj.id,
name = obj.name.orEmpty(),
icon = obj.objectIcon(urlBuilder),
icon = obj.objectIcon(),
sourceObject = obj.map[SOURCE_OBJECT]?.toString(),
uniqueKey = obj.uniqueKey,
readOnly = obj.restrictions.contains(ObjectRestriction.DELETE) || !isOwnerOrEditor,

View file

@ -343,7 +343,8 @@ class AllContentViewModel(
urlBuilder = urlBuilder,
isOwnerOrEditor = isOwnerOrEditor,
fieldParser = fieldParser,
objectTypes = storeOfObjectTypes.getAll()
objectTypes = storeOfObjectTypes.getAll(),
storeOfObjectTypes = storeOfObjectTypes
)
}
val result = when (activeSort) {