From 7610ce994d82154c154fcd2c43aad627ba48c84e Mon Sep 17 00:00:00 2001 From: Evgenii Kozlov Date: Thu, 12 Dec 2024 23:10:03 +0100 Subject: [PATCH 1/2] DROID-2815 changed loading timeout for pictures --- .../core_ui/features/editor/holders/media/Picture.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 From a30c22d86c533114055bb0a357d6a4b170979a09 Mon Sep 17 00:00:00 2001 From: Evgenii Kozlov Date: Thu, 12 Dec 2024 23:39:10 +0100 Subject: [PATCH 2/2] DROID-2815 fixes --- .../anytypeio/anytype/presentation/mapper/MapperExtension.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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,