@@ -7,6 +7,7 @@ import android.provider.BlockedNumberContract
77import android.provider.ContactsContract
88import android.provider.Telephony
99import android.text.InputType
10+ import android.util.Log
1011import android.widget.Toast
1112import androidx.activity.compose.BackHandler
1213import androidx.activity.result.contract.ActivityResultContracts
@@ -213,21 +214,34 @@ fun processIntents(
213214): Triple <String ?, String ?, String ?>? {
214215 if (intent.action != null &&
215216 ((intent.action == Intent .ACTION_SENDTO ) || (intent.action == Intent .ACTION_SEND ))) {
217+ val text = if (intent.hasExtra(" sms_body" )) intent.getStringExtra(" sms_body" )
218+ else if (intent.hasExtra(" android.intent.extra.TEXT" )) {
219+ intent.getStringExtra(" android.intent.extra.TEXT" )
220+ } else " "
221+
216222 val sendToString = intent.dataString
217- val text = if (intent.hasExtra(" sms_body" )) intent.getStringExtra(" sms_body" ) else " "
218- if (sendToString != null &&
219- (sendToString.contains(" smsto:" ) || sendToString.contains(" sms:" ))
223+
224+ if ((
225+ sendToString != null &&
226+ (sendToString.contains(" smsto:" ) ||
227+ sendToString.contains(" sms:" ))) ||
228+ intent.hasExtra(" address" )
220229 ) {
221- val address = Helpers .getFormatCompleteNumber(sendToString, defaultRegion)
230+
231+ val address = Helpers .getFormatCompleteNumber(
232+ if (intent.hasExtra(" address" )) intent.getStringExtra(" address" )
233+ else sendToString, defaultRegion)
234+
222235 val threadId =
223236 ThreadedConversationsHandler .get(context, address)
224237 .thread_id
225-
226238 return Triple (address, threadId, text)
227239 }
228240 }
229241 else if (intent.hasExtra(" address" )) {
230- var text = " "
242+ var text = if (intent.hasExtra(" android.intent.extra.TEXT" ))
243+ intent.getStringExtra(" android.intent.extra.TEXT" ) else " "
244+
231245 val address = intent.getStringExtra(" address" )
232246 val threadId = intent.getStringExtra(" thread_id" )
233247 return Triple (address, threadId, text)
@@ -510,12 +524,14 @@ fun ThreadConversationLayout(
510524 val context = LocalContext .current
511525
512526 intent?.let {
527+ // conversationsViewModel.text = ""
513528 val defaultRegion = if (inPreviewMode) " cm" else Helpers .getUserCountry(context)
514529 processIntents(context, intent, defaultRegion)?.let {
515530 intent.apply {
516531 removeExtra(" address" )
517532 removeExtra(" thread_id" )
518533 removeExtra(" sms_body" )
534+ removeExtra(" android.intent.extra.TEXT" )
519535 data = null
520536 }
521537 it.first?.let { address ->
@@ -534,7 +550,6 @@ fun ThreadConversationLayout(
534550 }
535551 }
536552 }
537- conversationsViewModel.text = " "
538553
539554 val counts by conversationsViewModel.getCount(context).observeAsState(null )
540555
0 commit comments