From 22e8a5c09eb6b313e5cbaf03130053039687f399 Mon Sep 17 00:00:00 2001 From: Danil Nikolaev Date: Tue, 19 Aug 2025 22:58:13 +0300 Subject: [PATCH] Prevent PhotoViewer share/copy while loading This commit prevents the share and copy actions in the PhotoViewer from being triggered if the content is still loading. --- .../kotlin/dev/meloda/fast/photoviewer/PhotoViewViewModel.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/feature/photoviewer/src/main/kotlin/dev/meloda/fast/photoviewer/PhotoViewViewModel.kt b/feature/photoviewer/src/main/kotlin/dev/meloda/fast/photoviewer/PhotoViewViewModel.kt index 62c712d5..542c1b63 100644 --- a/feature/photoviewer/src/main/kotlin/dev/meloda/fast/photoviewer/PhotoViewViewModel.kt +++ b/feature/photoviewer/src/main/kotlin/dev/meloda/fast/photoviewer/PhotoViewViewModel.kt @@ -79,6 +79,8 @@ class PhotoViewViewModelImpl( } override fun onShareClicked() { + if (screenState.value.isLoading) return + val url = screenState.value.images .getOrNull(screenState.value.selectedPage) ?.extractUrl() ?: return @@ -137,6 +139,8 @@ class PhotoViewViewModelImpl( } override fun onCopyClicked() { + if (screenState.value.isLoading) return + val clipboardManager = applicationContext.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager