handle the SEND_TO intent properly

This commit is contained in:
tibbi
2020-04-11 23:00:10 +02:00
parent 7f441218d2
commit e966b7bccd

View File

@@ -34,6 +34,10 @@ class NewMessageActivity : SimpleActivity() {
} }
private fun initContacts() { private fun initContacts() {
if (isThirdPartyIntent()) {
return
}
getAvailableContacts { getAvailableContacts {
allContacts = it allContacts = it
runOnUiThread { runOnUiThread {
@@ -63,6 +67,15 @@ class NewMessageActivity : SimpleActivity() {
} }
} }
private fun isThirdPartyIntent(): Boolean {
if (intent.action == Intent.ACTION_SENDTO && intent.dataString != null) {
val number = intent.dataString!!.removePrefix("sms:").removePrefix("smsto:").removePrefix("mms").removePrefix("mmsto:").trim()
launchThreadActivity(number, "")
return true
}
return false
}
private fun setupAdapter(contacts: ArrayList<Contact>) { private fun setupAdapter(contacts: ArrayList<Contact>) {
ContactsAdapter(this, contacts, suggestions_list, null) { ContactsAdapter(this, contacts, suggestions_list, null) {
hideKeyboard() hideKeyboard()