mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-02-17 04:00:35 +01:00
add error message on MMS compression failed
This commit is contained in:
parent
0774e0cb0f
commit
2605a61005
@ -671,6 +671,13 @@ class ThreadActivity : SimpleActivity() {
|
||||
if (compressedUri != null) {
|
||||
attachmentSelections[originalUriString] = AttachmentSelection(compressedUri, false)
|
||||
loadAttachmentPreview(attachmentView, compressedUri)
|
||||
} else {
|
||||
toast(R.string.compress_error)
|
||||
thread_attachments_wrapper.removeView(attachmentView)
|
||||
attachmentSelections.remove(originalUriString)
|
||||
if (attachmentSelections.isEmpty()) {
|
||||
thread_attachments_holder.beGone()
|
||||
}
|
||||
}
|
||||
checkSendMessageAvailability()
|
||||
attachmentView.thread_attachment_progress.beGone()
|
||||
|
@ -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 {
|
||||
|
@ -19,6 +19,7 @@
|
||||
<string name="pin_conversation">Pin to the top</string>
|
||||
<string name="unpin_conversation">Unpin</string>
|
||||
<string name="forward_message">Forward</string>
|
||||
<string name="compress_error">Unable to compress image to selected size</string>
|
||||
<!-- New conversation -->
|
||||
<string name="new_conversation">New conversation</string>
|
||||
<string name="add_contact_or_number">Add Contact or Number…</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user