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

DROID-1105 Editor | Fix | Should map bookmark state when pasting a bookmark block (#15)

This commit is contained in:
Konstantin Ivanov 2023-06-05 11:39:00 +02:00 committed by GitHub
parent b1d54dabb0
commit 1794ba26bc
Signed by: github
GPG key ID: 4AEE18F83AFDEB23

View file

@ -99,9 +99,18 @@ fun Block.Content.Bookmark.toMiddlewareModel(): MBBookmark = MBBookmark(
faviconHash = favicon.orEmpty(),
title = title.orEmpty(),
url = url.orEmpty(),
imageHash = image.orEmpty()
imageHash = image.orEmpty(),
state = state.toMiddlewareModel(),
targetObjectId = targetObjectId.orEmpty()
)
fun Block.Content.Bookmark.State.toMiddlewareModel(): MBookmarkState = when (this) {
Block.Content.Bookmark.State.EMPTY -> MBookmarkState.Empty
Block.Content.Bookmark.State.DONE -> MBookmarkState.Done
Block.Content.Bookmark.State.ERROR -> MBookmarkState.Error
Block.Content.Bookmark.State.FETCHING -> MBookmarkState.Fetching
}
fun Block.Content.File.toMiddlewareModel(): MBFile = MBFile(
hash = hash.orEmpty(),
name = name.orEmpty(),