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:
parent
c1591dffa7
commit
fd7a35809b
@ -322,7 +322,9 @@ class ImageActivity : KauBaseActivity() {
|
|||||||
val body = response.body ?: throw IOException("Failed to retrieve image body")
|
val body = response.body ?: throw IOException("Failed to retrieve image body")
|
||||||
|
|
||||||
val tempFile = File(cacheDir(this@ImageActivity), "$imageHash.$imgExtension")
|
val tempFile = File(cacheDir(this@ImageActivity), "$imageHash.$imgExtension")
|
||||||
|
if (!tempFile.exists() || tempFile.length() == 0L) {
|
||||||
tempFile.copyFromInputStream(body.byteStream())
|
tempFile.copyFromInputStream(body.byteStream())
|
||||||
|
}
|
||||||
tempFile
|
tempFile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user