package com.adealink.weparty.imageselect.util

import com.adealink.frame.storage.file.clipImagePath
import com.adealink.frame.storage.file.imageProgressPath
import com.adealink.frame.storage.file.videoProgressPath
import com.adealink.frame.util.createDirByDeleteOldDir
import com.adealink.frame.util.getDirSizeBytes
import java.io.File

fun getProcessedImageCacheSize(): Long {
    var size: Long = 0
    clipImagePath?.let {
        size += getDirSizeBytes(File(it))
    }
    imageProgressPath?.let {
        size += getDirSizeBytes(File(it))
    }
    videoProgressPath?.let {
        size += getDirSizeBytes(File(it))
    }
    return size
}

fun clearAllProcessedImage() {
    createDirByDeleteOldDir(clipImagePath)
    createDirByDeleteOldDir(imageProgressPath)
    createDirByDeleteOldDir(videoProgressPath)
}