From 14a45725e1d3fdd4c31cb09093ab89f2a4b62ae3 Mon Sep 17 00:00:00 2001 From: Mahdi Javaheri Date: Fri, 27 Oct 2023 13:36:13 +0330 Subject: [PATCH] Fix decline from notif not ending in dashboard When the app is in the background and user declines a call it's not ending the call from SendBird's Dashboard --- .../calls/quickstart/call/CallActivity.kt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/sendbird/calls/quickstart/call/CallActivity.kt b/app/src/main/java/com/sendbird/calls/quickstart/call/CallActivity.kt index e50b2b5..a0eb661 100644 --- a/app/src/main/java/com/sendbird/calls/quickstart/call/CallActivity.kt +++ b/app/src/main/java/com/sendbird/calls/quickstart/call/CallActivity.kt @@ -97,7 +97,7 @@ abstract class CallActivity : AppCompatActivity() { setCurrentState() if (mDoEnd) { Log.i(TAG, "[CallActivity] init() => (mDoEnd == true)") - end() + declineFromNotif() return } checkAuthentication() @@ -134,6 +134,20 @@ abstract class CallActivity : AppCompatActivity() { mDoEnd = intent.getBooleanExtra(EXTRA_DO_END, false) if (mDoEnd) { Log.i(TAG, "[CallActivity] onNewIntent() => (mDoEnd == true)") + declineFromNotif() + } + } + + private fun declineFromNotif() { + if (currentUser == null) { + autoAuthenticate(this) { userId -> + if (userId == null) { + finishWithEnding("autoAuthenticate() failed.") + return@autoAuthenticate + } + end() + } + } else { end() } }