Use telephony provider also when sending message to tel URI
This commit is contained in:
@ -2,6 +2,7 @@ package com.tutpro.baresip
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.DialogInterface
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.os.SystemClock
|
||||
@ -17,6 +18,7 @@ import android.widget.Toast
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.lifecycle.Observer
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.tutpro.baresip.databinding.ActivityChatBinding
|
||||
|
||||
class ChatActivity : AppCompatActivity() {
|
||||
@ -121,16 +123,28 @@ class ChatActivity : AppCompatActivity() {
|
||||
val msg = Message(aor, peerUri, msgText, time, R.drawable.arrow_up_yellow,
|
||||
0, "", true)
|
||||
msg.add()
|
||||
var msgUri = ""
|
||||
chatMessages.add(msg)
|
||||
if (Api.message_send(ua.uap, peerUri, msgText, time.toString()) != 0) {
|
||||
Toast.makeText(applicationContext, "${getString(R.string.message_failed)}!",
|
||||
Toast.LENGTH_SHORT).show()
|
||||
msg.direction = R.drawable.arrow_up_red
|
||||
msg.responseReason = getString(R.string.message_failed)
|
||||
} else {
|
||||
newMessage.text.clear()
|
||||
BaresipService.chatTexts.remove("$aor::$peerUri")
|
||||
}
|
||||
if (Utils.isTelUri(peerUri))
|
||||
if (ua.account.telProvider == "") {
|
||||
Utils.alertView(this, getString(R.string.notice),
|
||||
String.format(getString(R.string.no_telephony_provider),
|
||||
Utils.plainAor(aor)))
|
||||
} else {
|
||||
msgUri = Utils.telToSip(peerUri, ua.account)
|
||||
}
|
||||
else
|
||||
msgUri = peerUri
|
||||
if (msgUri != "")
|
||||
if (Api.message_send(ua.uap, msgUri, msgText, time.toString()) != 0) {
|
||||
Toast.makeText(applicationContext, "${getString(R.string.message_failed)}!",
|
||||
Toast.LENGTH_SHORT).show()
|
||||
msg.direction = R.drawable.arrow_up_red
|
||||
msg.responseReason = getString(R.string.message_failed)
|
||||
} else {
|
||||
newMessage.text.clear()
|
||||
BaresipService.chatTexts.remove("$aor::$peerUri")
|
||||
}
|
||||
mlAdapter.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
||||
@ -465,6 +465,8 @@
|
||||
<string name="invalid_sip_uri">Virheellinen SIP URI \'%1$s\'</string>
|
||||
<string name="no_telephony_providers">Millekään tilille ei ole konfiguroitu puhelinpalvelun
|
||||
tarjoajaa</string>
|
||||
<string name="no_telephony_provider">Tilille \'%1$s\' ei ole konfiguroitu puhelinpalvelun
|
||||
tarjoajaa</string>
|
||||
<string name="callee">Puhelun kohde</string>
|
||||
<string name="hangup">Lopeta</string>
|
||||
<string name="video_call">Videopuhelu</string>
|
||||
|
||||
@ -437,6 +437,7 @@
|
||||
<string name="diverted_by_dots">Diverted by …</string>
|
||||
<string name="transferring_call_to_dots">Transferring call to …</string>
|
||||
<string name="invalid_sip_uri">Invalid SIP URI \'%1$s\'</string>
|
||||
<string name="no_telephony_provider">Account \'%1$s\' has no Telephony Provider</string>
|
||||
<string name="no_telephony_providers">Telephony Provider has not been configured for any account.</string>
|
||||
<string name="choose_telephony_provider_account">Choose Telephony Provider account</string>
|
||||
<string name="callee">Callee</string>
|
||||
|
||||
Reference in New Issue
Block a user