add error message on MMS compression failed
This commit is contained in:
parent
0774e0cb0f
commit
2605a61005
3 changed files with 13 additions and 1 deletions
|
|
@ -106,7 +106,11 @@ class ImageCompressor(private val context: Context) {
|
|||
private var iteration: Int = 0
|
||||
|
||||
fun isSatisfied(imageFile: File): Boolean {
|
||||
return imageFile.length() <= maxFileSize || iteration >= maxIteration
|
||||
// If size requirement is not met and iteration is maxed
|
||||
if(iteration >= maxIteration && imageFile.length() >= maxFileSize) {
|
||||
throw Exception("Unable to compress image to targeted size")
|
||||
}
|
||||
return imageFile.length() <= maxFileSize
|
||||
}
|
||||
|
||||
fun satisfy(imageFile: File): File {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue