mirror of
https://git.mihon.tech/mihonapp/mihon
synced 2024-11-23 05:35:51 +03:00
Ensure media store scan is triggered after saving an image (fixes #6808)
This commit is contained in:
parent
f0eb42e72d
commit
346652e508
3 changed files with 6 additions and 4 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue