diff --git a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/holders/media/Picture.kt b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/holders/media/Picture.kt index 632f8d1222..d894f4ca23 100644 --- a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/holders/media/Picture.kt +++ b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/holders/media/Picture.kt @@ -43,7 +43,7 @@ class Picture(val binding: ItemBlockPictureBinding) : Media(binding.root), Decor isFirstResource: Boolean ): Boolean { error.visible() - Timber.w(e, "Error while loading picture") + Timber.w(e, "Error while loading picture with url: $model") return false } @@ -65,6 +65,7 @@ class Picture(val binding: ItemBlockPictureBinding) : Media(binding.root), Decor .with(image) .load(item.url) .listener(listener) + .timeout(LOADING_TIMEOUT_IN_MILLIS) .into(image) } @@ -88,4 +89,8 @@ class Picture(val binding: ItemBlockPictureBinding) : Media(binding.root), Decor res = itemView.resources ) } + + companion object { + const val LOADING_TIMEOUT_IN_MILLIS = 30000 + } } \ No newline at end of file diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/mapper/MapperExtension.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/mapper/MapperExtension.kt index a71848b517..def778eefb 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/mapper/MapperExtension.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/mapper/MapperExtension.kt @@ -62,8 +62,8 @@ fun Block.Content.File.toPictureView( val url = urlBuilder.getUrlForFileContent(this) val targetId = this.targetObjectId val struct = details.details[targetId]?.map - if (url != null && targetId != null && !struct.isNullOrEmpty()) { - val targetObject = ObjectWrapper.File(struct) + if (url != null && targetId != null) { + val targetObject = ObjectWrapper.File(struct.orEmpty()) BlockView.Media.Picture( id = blockId, targetObjectId = targetId,