mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-16 19:18:52 +01:00
Fix image forwarding
This commit is contained in:
@@ -88,9 +88,14 @@ class Navigator @Inject constructor(private val context: Context, private val no
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
fun showCompose(body: String? = null) {
|
||||
fun showCompose(body: String? = null, images: List<Uri>? = null) {
|
||||
val intent = Intent(context, ComposeActivity::class.java)
|
||||
intent.putExtra(Intent.EXTRA_TEXT, body)
|
||||
|
||||
images?.takeIf { it.isNotEmpty() }?.let {
|
||||
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, ArrayList(images))
|
||||
}
|
||||
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import android.telephony.PhoneNumberUtils
|
||||
import android.telephony.SmsMessage
|
||||
import android.view.KeyEvent
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import androidx.net.toUri
|
||||
import com.mlsdev.rximagepicker.RxImagePicker
|
||||
import com.mlsdev.rximagepicker.Sources
|
||||
import com.moez.QKSMS.R
|
||||
@@ -58,6 +59,7 @@ import model.PhoneNumber
|
||||
import repository.ContactRepository
|
||||
import repository.MessageRepository
|
||||
import util.extensions.asObservable
|
||||
import util.extensions.isImage
|
||||
import java.net.URLDecoder
|
||||
import java.util.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
@@ -210,7 +212,8 @@ class ComposeViewModel(intent: Intent) : QkViewModel<ComposeView, ComposeState>(
|
||||
// If the entry is a valid destination, allow it as a recipient
|
||||
if (PhoneNumberUtils.isWellFormedSmsAddress(query.toString())) {
|
||||
val newAddress = PhoneNumberUtils.formatNumber(query.toString(), Locale.getDefault().country)
|
||||
val newContact = Contact(numbers = RealmList(PhoneNumber(address = newAddress ?: query.toString())))
|
||||
val newContact = Contact(numbers = RealmList(PhoneNumber(address = newAddress
|
||||
?: query.toString())))
|
||||
filteredContacts = listOf(newContact) + filteredContacts
|
||||
}
|
||||
|
||||
@@ -398,7 +401,10 @@ class ComposeViewModel(intent: Intent) : QkViewModel<ComposeView, ComposeState>(
|
||||
// Forward the message
|
||||
view.forwardMessageIntent
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe { message -> navigator.showCompose(message.body) }
|
||||
.subscribe { message ->
|
||||
val images = message.parts.filter { it.isImage() }.mapNotNull { it.image?.toUri() }
|
||||
navigator.showCompose(message.body, images)
|
||||
}
|
||||
|
||||
// Delete the selected message
|
||||
view.deleteMessageIntent
|
||||
|
||||
Reference in New Issue
Block a user