diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/saver/ImageSaver.kt b/app/src/main/java/eu/kanade/tachiyomi/data/saver/ImageSaver.kt index 4b55ccb1f..3324efcd4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/saver/ImageSaver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/saver/ImageSaver.kt @@ -24,7 +24,7 @@ class ImageSaver( ) { @SuppressLint("InlinedApi") - suspend fun save(image: Image): Uri { + fun save(image: Image): Uri { val data = image.data val type = ImageUtil.findImageType(data) ?: throw Exception("Not an image") @@ -63,6 +63,8 @@ class ImageSaver( } } + DiskUtil.scanMedia(context, picture) + return picture } @@ -77,6 +79,8 @@ class ImageSaver( } } + DiskUtil.scanMedia(context, destFile) + return destFile.getUriCompat(context) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt index 5fd1b6fef..c4fd7c1eb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt @@ -343,7 +343,7 @@ class MangaPresenter( * @param image the image with specified location * @return flow Flow which emits the Uri which specifies where the image is saved when */ - suspend fun saveImage(image: Image): Uri { + fun saveImage(image: Image): Uri { return imageSaver.save(image) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt index 2c633406d..454d0148a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt @@ -597,7 +597,6 @@ class ReaderPresenter( val relativePath = if (preferences.folderPerManga()) DiskUtil.buildValidFilename(manga.title) else "" // Copy file in background. - try { presenterScope.launchIO { val uri = imageSaver.save( @@ -608,7 +607,6 @@ class ReaderPresenter( ) ) launchUI { - DiskUtil.scanMedia(context, uri) notifier.onComplete(uri) view!!.onSaveImageResult(SaveImageResult.Success(uri)) }