Merge pull request #2841 from nextcloud/bugfix/noid/avoidNpeStartCall

Fix rare crash when starting call
This commit is contained in:
Marcel Hibbe 2023-03-07 10:32:24 +01:00 committed by GitHub
commit 397b498d48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1994,6 +1994,8 @@ class ChatController(args: Bundle) :
Log.d(TAG, "joinRoomWithPassword - joinRoom - got response: $startNanoTime") Log.d(TAG, "joinRoomWithPassword - joinRoom - got response: $startNanoTime")
val conversation = roomOverall.ocs!!.data!! val conversation = roomOverall.ocs!!.data!!
currentConversation = conversation
sessionIdAfterRoomJoined = conversation.sessionId sessionIdAfterRoomJoined = conversation.sessionId
ApplicationWideCurrentRoomHolder.getInstance().session = conversation.sessionId ApplicationWideCurrentRoomHolder.getInstance().session = conversation.sessionId
ApplicationWideCurrentRoomHolder.getInstance().currentRoomId = conversation.roomId ApplicationWideCurrentRoomHolder.getInstance().currentRoomId = conversation.roomId
@ -2823,14 +2825,18 @@ class ChatController(args: Bundle) :
} }
private fun startACall(isVoiceOnlyCall: Boolean, callWithoutNotification: Boolean) { private fun startACall(isVoiceOnlyCall: Boolean, callWithoutNotification: Boolean) {
val pp = ParticipantPermissions(conversationUser!!, currentConversation!!) currentConversation?.let {
if (!pp.canStartCall() && currentConversation?.hasCall == false) { if (conversationUser != null) {
Toast.makeText(context, R.string.startCallForbidden, Toast.LENGTH_LONG).show() val pp = ParticipantPermissions(conversationUser, it)
} else { if (!pp.canStartCall() && currentConversation?.hasCall == false) {
ApplicationWideCurrentRoomHolder.getInstance().isDialing = true Toast.makeText(context, R.string.startCallForbidden, Toast.LENGTH_LONG).show()
val callIntent = getIntentForCall(isVoiceOnlyCall, callWithoutNotification) } else {
if (callIntent != null) { ApplicationWideCurrentRoomHolder.getInstance().isDialing = true
startActivity(callIntent) val callIntent = getIntentForCall(isVoiceOnlyCall, callWithoutNotification)
if (callIntent != null) {
startActivity(callIntent)
}
}
} }
} }
} }