Fixed migration

This commit is contained in:
tom5079
2020-09-05 18:11:20 +09:00
parent 1ddb636dd0
commit 486fbe46a0
2 changed files with 8 additions and 5 deletions

View File

@@ -50,6 +50,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import xyz.quaver.hitomi.getReader
import xyz.quaver.io.util.getChild
import xyz.quaver.pupil.BuildConfig
import xyz.quaver.pupil.R
import xyz.quaver.pupil.favorites
@@ -169,7 +170,10 @@ class GalleryBlockAdapter(private val glide: RequestManager, private val galleri
target: Target<Drawable>?,
isFirstResource: Boolean
): Boolean {
Cache.getInstance(context, galleryID).findFile(".thumbnail")?.let { if (it.exists()) it.delete() }
Cache.getInstance(context, galleryID).let {
it.cacheFolder.getChild(".thumbnail").let { if (it.exists()) it.delete() }
it.downloadFolder?.getChild(".thumbnail")?.let { if (it.exists()) it.delete() }
}
return false
}

View File

@@ -310,15 +310,14 @@ fun xyz.quaver.pupil.util.downloader.DownloadManager.migrate() {
)
synchronized(Cache) {
Cache.instances.delete(galleryID)
Cache.delete(galleryID)
}
downloadFolderMap[galleryID] = folder.name
downloadFolder.getChild(".download").let { if (!it.exists()) it.createNewFile(); it.writeText(Json.encodeToString(downloadFolderMap)) }
}
}
downloadFolder.getChild(".download").let { if (!it.exists()) it.createNewFile() }
downloadFolder.getChild(".download").writeText(Json.encodeToString(downloadFolderMap))
notification
.setContentText(getText(R.string.import_old_galleries_notification_done))
.setProgress(0, 0, false)