Improved and fixed handling of message and call transfer events
This commit is contained in:
@@ -677,7 +677,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
callUri.setText(UserAgent.uas()[aorSpinner.selectedItemPosition].account.resumeUri)
|
callUri.setText(UserAgent.uas()[aorSpinner.selectedItemPosition].account.resumeUri)
|
||||||
callButton.performClick()
|
callButton.performClick()
|
||||||
}
|
}
|
||||||
"transfer show", "transfer accept" ->
|
"call transfer", "transfer show", "transfer accept" ->
|
||||||
handleServiceEvent("$resumeAction,$resumeUri",
|
handleServiceEvent("$resumeAction,$resumeUri",
|
||||||
arrayListOf(resumeCall!!.ua.uap, resumeCall!!.callp))
|
arrayListOf(resumeCall!!.ua.uap, resumeCall!!.callp))
|
||||||
"message", "message show", "message reply" ->
|
"message", "message show", "message reply" ->
|
||||||
@@ -779,9 +779,10 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleIntent(intent: Intent, action: String?) {
|
private fun handleIntent(intent: Intent, action: String) {
|
||||||
Log.d(TAG, "Handling intent '$action'")
|
Log.d(TAG, "Handling intent '$action'")
|
||||||
when (action) {
|
val ev = action.split(",")
|
||||||
|
when (ev[0]) {
|
||||||
"accounts" -> {
|
"accounts" -> {
|
||||||
resumeAction = "accounts"
|
resumeAction = "accounts"
|
||||||
}
|
}
|
||||||
@@ -824,14 +825,14 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val uap = intent.getStringExtra("uap")!!
|
val uap = intent.getStringExtra("uap")!!
|
||||||
val ua = UserAgent.ofUap(uap)
|
val ua = UserAgent.ofUap(uap)
|
||||||
if (ua == null) {
|
if (ua == null) {
|
||||||
Log.w(TAG, "onNewIntent did not find ua $uap")
|
Log.w(TAG, "handleIntent did not find ua $uap")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (ua.account.aor != aorSpinner.tag)
|
if (ua.account.aor != aorSpinner.tag)
|
||||||
spinToAor(ua.account.aor)
|
spinToAor(ua.account.aor)
|
||||||
resumeAction = action
|
resumeAction = action
|
||||||
}
|
}
|
||||||
"transfer show", "transfer accept" -> {
|
"call transfer", "transfer show", "transfer accept" -> {
|
||||||
val callp = intent.getStringExtra("callp")!!
|
val callp = intent.getStringExtra("callp")!!
|
||||||
val call = Call.ofCallp(callp)
|
val call = Call.ofCallp(callp)
|
||||||
if (call == null) {
|
if (call == null) {
|
||||||
@@ -839,9 +840,12 @@ class MainActivity : AppCompatActivity() {
|
|||||||
moveTaskToBack(true)
|
moveTaskToBack(true)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
resumeAction = action
|
resumeAction = ev[0]
|
||||||
resumeCall = call
|
resumeCall = call
|
||||||
resumeUri = intent.getStringExtra("uri")!!
|
resumeUri = if (ev[0] == "call transfer")
|
||||||
|
ev[1]
|
||||||
|
else
|
||||||
|
intent.getStringExtra("uri")!!
|
||||||
}
|
}
|
||||||
"message", "message show", "message reply" -> {
|
"message", "message show", "message reply" -> {
|
||||||
val uap = intent.getStringExtra("uap")!!
|
val uap = intent.getStringExtra("uap")!!
|
||||||
@@ -1102,7 +1106,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
"message", "message show", "message reply" -> {
|
"message", "message show", "message reply" -> {
|
||||||
val peer = params[1]
|
val peer = params[1]
|
||||||
val i = Intent(applicationContext, ChatActivity::class.java)
|
val i = Intent(applicationContext, ChatActivity::class.java)
|
||||||
i.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
|
i.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP
|
||||||
val b = Bundle()
|
val b = Bundle()
|
||||||
b.putString("aor", aor)
|
b.putString("aor", aor)
|
||||||
b.putString("peer", peer)
|
b.putString("peer", peer)
|
||||||
|
|||||||
Reference in New Issue
Block a user