add button for end call for everyone

Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
sowjanyakch 2024-10-25 16:45:48 +02:00 committed by Marcel Hibbe
parent ed9fc185bf
commit ca0533a686
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B
2 changed files with 36 additions and 15 deletions

View File

@ -263,7 +263,7 @@ class CallActivity : CallBaseActivity() {
override fun onCallEndedForAll() { override fun onCallEndedForAll() {
Log.d(TAG, "A moderator ended the call for all.") Log.d(TAG, "A moderator ended the call for all.")
hangup(true, false) hangup(true, null)
} }
} }
private var callParticipantList: CallParticipantList? = null private var callParticipantList: CallParticipantList? = null
@ -271,7 +271,7 @@ class CallActivity : CallBaseActivity() {
private var isBreakoutRoom = false private var isBreakoutRoom = false
private val localParticipantMessageListener = LocalParticipantMessageListener { token -> private val localParticipantMessageListener = LocalParticipantMessageListener { token ->
switchToRoomToken = token switchToRoomToken = token
hangup(true,false) hangup(true,null)
} }
private val offerMessageListener = OfferMessageListener { sessionId, roomType, sdp, nick -> private val offerMessageListener = OfferMessageListener { sessionId, roomType, sdp, nick ->
getOrCreatePeerConnectionWrapperForSessionIdAndType( getOrCreatePeerConnectionWrapperForSessionIdAndType(
@ -498,7 +498,7 @@ class CallActivity : CallBaseActivity() {
} }
.setNegativeButton(R.string.nc_no) { _, _ -> .setNegativeButton(R.string.nc_no) { _, _ ->
recordingConsentGiven = false recordingConsentGiven = false
hangup(true,false) hangup(true,null)
} }
viewThemeUtils.dialog.colorMaterialAlertDialogBackground(this, materialAlertDialogBuilder) viewThemeUtils.dialog.colorMaterialAlertDialogBackground(this, materialAlertDialogBuilder)
@ -666,7 +666,7 @@ class CallActivity : CallBaseActivity() {
} }
binding!!.hangupButton.setOnClickListener { binding!!.hangupButton.setOnClickListener {
hangup(true, false) hangup(true, null)
} }
if (isModerator) { if (isModerator) {
@ -676,6 +676,27 @@ class CallActivity : CallBaseActivity() {
} }
} }
binding!!.callLayout.setOnTouchListener { _, event ->
if (event.action == MotionEvent.ACTION_DOWN) {
if (binding!!.popupMenu.visibility == View.VISIBLE) {
val location = IntArray(2)
binding!!.popupMenu.getLocationOnScreen(location)
val popupMenuWidth = binding!!.popupMenu.width
val popupMenuHeight = binding!!.popupMenu.height
val x = event.rawX
val y = event.rawY
if (x < location[0] || x > location[0] + popupMenuWidth ||
y < location[1] || y > location[1] + popupMenuHeight) {
binding!!.popupMenu.visibility = View.GONE
}
}
}
true
}
binding!!.popupMenu.setOnClickListener { binding!!.popupMenu.setOnClickListener {
hangup(true, true) hangup(true, true)
binding!!.popupMenu.visibility = View.GONE binding!!.popupMenu.visibility = View.GONE
@ -691,7 +712,7 @@ class CallActivity : CallBaseActivity() {
binding!!.callStates.callStateRelativeLayout.setOnClickListener { binding!!.callStates.callStateRelativeLayout.setOnClickListener {
if (currentCallStatus === CallStatus.CALLING_TIMEOUT) { if (currentCallStatus === CallStatus.CALLING_TIMEOUT) {
setCallState(CallStatus.RECONNECTING) setCallState(CallStatus.RECONNECTING)
hangupNetworkCalls(false, false) hangupNetworkCalls(false, null)
} }
} }
binding!!.callRecordingIndicator.setOnClickListener { binding!!.callRecordingIndicator.setOnClickListener {
@ -1463,7 +1484,7 @@ class CallActivity : CallBaseActivity() {
Log.d(TAG, "localStream is null") Log.d(TAG, "localStream is null")
} }
if (currentCallStatus !== CallStatus.LEAVING) { if (currentCallStatus !== CallStatus.LEAVING) {
hangup(true, false) hangup(true, null)
} }
powerManagerUtils!!.updatePhoneState(PowerManagerUtils.PhoneState.IDLE) powerManagerUtils!!.updatePhoneState(PowerManagerUtils.PhoneState.IDLE)
super.onDestroy() super.onDestroy()
@ -1747,7 +1768,7 @@ class CallActivity : CallBaseActivity() {
override fun onError(e: Throwable) { override fun onError(e: Throwable) {
Log.e(TAG, "Failed to join call", e) Log.e(TAG, "Failed to join call", e)
Snackbar.make(binding!!.root, R.string.nc_common_error_sorry, Snackbar.LENGTH_LONG).show() Snackbar.make(binding!!.root, R.string.nc_common_error_sorry, Snackbar.LENGTH_LONG).show()
hangup(true, false) hangup(true, null)
} }
override fun onComplete() { override fun onComplete() {
@ -1898,7 +1919,7 @@ class CallActivity : CallBaseActivity() {
Log.d(TAG, "onMessageEvent 'hello'") Log.d(TAG, "onMessageEvent 'hello'")
if (!webSocketCommunicationEvent.getHashMap()!!.containsKey("oldResumeId")) { if (!webSocketCommunicationEvent.getHashMap()!!.containsKey("oldResumeId")) {
if (currentCallStatus === CallStatus.RECONNECTING) { if (currentCallStatus === CallStatus.RECONNECTING) {
hangup(false, false) hangup(false, null)
} else { } else {
setCallState(CallStatus.RECONNECTING) setCallState(CallStatus.RECONNECTING)
runOnUiThread { initiateCall() } runOnUiThread { initiateCall() }
@ -1974,7 +1995,7 @@ class CallActivity : CallBaseActivity() {
} }
} }
private fun hangup(shutDownView: Boolean, endCallForAll:Boolean) { private fun hangup(shutDownView: Boolean, endCallForAll:Boolean?) {
Log.d(TAG, "hangup! shutDownView=$shutDownView") Log.d(TAG, "hangup! shutDownView=$shutDownView")
if (shutDownView) { if (shutDownView) {
setCallState(CallStatus.LEAVING) setCallState(CallStatus.LEAVING)
@ -2042,7 +2063,7 @@ class CallActivity : CallBaseActivity() {
hangupNetworkCalls(shutDownView,endCallForAll) hangupNetworkCalls(shutDownView,endCallForAll)
} }
private fun hangupNetworkCalls(shutDownView: Boolean, endCallForAll: Boolean) { private fun hangupNetworkCalls(shutDownView: Boolean, endCallForAll: Boolean?) {
Log.d(TAG, "hangupNetworkCalls. shutDownView=$shutDownView") Log.d(TAG, "hangupNetworkCalls. shutDownView=$shutDownView")
val apiVersion = ApiUtils.getCallApiVersion(conversationUser, intArrayOf(ApiUtils.API_V4, 1)) val apiVersion = ApiUtils.getCallApiVersion(conversationUser, intArrayOf(ApiUtils.API_V4, 1))
if (callParticipantList != null) { if (callParticipantList != null) {
@ -2144,7 +2165,7 @@ class CallActivity : CallBaseActivity() {
ApplicationWideCurrentRoomHolder.getInstance().isInCall ApplicationWideCurrentRoomHolder.getInstance().isInCall
) { ) {
Log.d(TAG, "Most probably a moderator ended the call for all.") Log.d(TAG, "Most probably a moderator ended the call for all.")
hangup(true, false) hangup(true, null)
return return
} }
@ -2271,7 +2292,7 @@ class CallActivity : CallBaseActivity() {
context.resources.getString(R.string.nc_common_error_sorry), context.resources.getString(R.string.nc_common_error_sorry),
Snackbar.LENGTH_LONG Snackbar.LENGTH_LONG
).show() ).show()
hangup(true,false) hangup(true,null)
return null return null
} }
peerConnectionWrapper = if (hasMCU && publisher) { peerConnectionWrapper = if (hasMCU && publisher) {
@ -2587,7 +2608,7 @@ class CallActivity : CallBaseActivity() {
} }
CallStatus.CALLING_TIMEOUT -> handler!!.post { CallStatus.CALLING_TIMEOUT -> handler!!.post {
hangup(false, false) hangup(false, null)
binding!!.callStates.callStateTextView.setText(R.string.nc_call_timeout) binding!!.callStates.callStateTextView.setText(R.string.nc_call_timeout)
binding!!.callModeTextView.text = descriptionForCallType binding!!.callModeTextView.text = descriptionForCallType
if (binding!!.callStates.callStateRelativeLayout.visibility != View.VISIBLE) { if (binding!!.callStates.callStateRelativeLayout.visibility != View.VISIBLE) {
@ -2857,7 +2878,7 @@ class CallActivity : CallBaseActivity() {
if (iceConnectionState == IceConnectionState.FAILED) { if (iceConnectionState == IceConnectionState.FAILED) {
setCallState(CallStatus.PUBLISHER_FAILED) setCallState(CallStatus.PUBLISHER_FAILED)
webSocketClient!!.clearResumeId() webSocketClient!!.clearResumeId()
hangup(false, false) hangup(false, null)
} }
} }
} }

View File

@ -247,7 +247,7 @@ public interface NcApi {
*/ */
@DELETE @DELETE
Observable<GenericOverall> leaveCall(@Nullable @Header("Authorization") String authorization, @Url String url, Observable<GenericOverall> leaveCall(@Nullable @Header("Authorization") String authorization, @Url String url,
@Query("all") Boolean all); @Nullable @Query("all") Boolean all);
@GET @GET
Observable<SignalingSettingsOverall> getSignalingSettings(@Nullable @Header("Authorization") String authorization, Observable<SignalingSettingsOverall> getSignalingSettings(@Nullable @Header("Authorization") String authorization,