1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-11-08 20:12:39 +01:00

Avoid downloading temp image if it already exists

This commit is contained in:
Allan Wang 2020-03-01 01:32:10 -08:00
parent c1591dffa7
commit fd7a35809b
No known key found for this signature in database
GPG Key ID: C93E3F9C679D7A56

View File

@ -322,7 +322,9 @@ class ImageActivity : KauBaseActivity() {
val body = response.body ?: throw IOException("Failed to retrieve image body")
val tempFile = File(cacheDir(this@ImageActivity), "$imageHash.$imgExtension")
tempFile.copyFromInputStream(body.byteStream())
if (!tempFile.exists() || tempFile.length() == 0L) {
tempFile.copyFromInputStream(body.byteStream())
}
tempFile
}