send the number to Thread activity too, use it if necessary
This commit is contained in:
parent
b231f2c644
commit
ab9aa5d2ba
|
@ -174,6 +174,7 @@ class NewConversationActivity : SimpleActivity() {
|
|||
putExtra(THREAD_ID, getThreadId(phoneNumber).toInt())
|
||||
putExtra(THREAD_TITLE, name)
|
||||
putExtra(THREAD_TEXT, text)
|
||||
putExtra(THREAD_NUMBER, phoneNumber)
|
||||
|
||||
if (intent.action == Intent.ACTION_SEND && intent.extras?.containsKey(Intent.EXTRA_STREAM) == true) {
|
||||
val uri = intent.getParcelableExtra<Uri>(Intent.EXTRA_STREAM)
|
||||
|
|
|
@ -80,6 +80,19 @@ class ThreadActivity : SimpleActivity() {
|
|||
messages.first().participants
|
||||
}
|
||||
|
||||
if (participants.isEmpty()) {
|
||||
val name = intent.getStringExtra(THREAD_TITLE) ?: ""
|
||||
val number = intent.getStringExtra(THREAD_NUMBER)
|
||||
if (number == null) {
|
||||
toast(R.string.unknown_error_occurred)
|
||||
finish()
|
||||
return@ensureBackgroundThread
|
||||
}
|
||||
|
||||
val contact = Contact(0, name, "", number)
|
||||
participants.add(contact)
|
||||
}
|
||||
|
||||
messages.filter { it.attachment != null }.forEach {
|
||||
it.attachment!!.attachments.forEach {
|
||||
try {
|
||||
|
|
|
@ -6,6 +6,7 @@ import org.greenrobot.eventbus.EventBus
|
|||
const val THREAD_ID = "thread_id"
|
||||
const val THREAD_TITLE = "thread_title"
|
||||
const val THREAD_TEXT = "thread_text"
|
||||
const val THREAD_NUMBER = "thread_number"
|
||||
const val THREAD_ATTACHMENT_URI = "thread_attachment_uri"
|
||||
const val THREAD_ATTACHMENT_URIS = "thread_attachment_uris"
|
||||
|
||||
|
|
Loading…
Reference in New Issue