Max MMS size is now configurable

Fix #858
This commit is contained in:
Moez Bhatti
2018-01-19 22:17:55 -05:00
parent 2486042d8f
commit dc73c636b9
11 changed files with 125 additions and 18 deletions
@@ -83,14 +83,14 @@ class SendMessage @Inject constructor(
attachments
.map { uri -> RxImageConverters.uriToBitmap(context, uri).blockingFirst() }
.map { bitmap -> shrink(bitmap, 1000 * 1024) }
.map { bitmap -> shrink(bitmap, prefs.mmsSize.get() * 1024) }
.forEach { bitmap -> message.addMedia(bitmap, "image/jpeg") }
val transaction = Transaction(context, settings)
transaction.sendNewMessage(message, threadId)
}
private fun shrink(src: Bitmap, maxBytes: Long): ByteArray {
private fun shrink(src: Bitmap, maxBytes: Int): ByteArray {
var step = 0.0
val factor = 0.5
val quality = 60