set bundle keys in CallNotificationActivity

Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
sowjanyakch 2024-10-29 11:48:23 +01:00 committed by Marcel Hibbe
parent dff22845eb
commit e5789c0cf6
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B
6 changed files with 20 additions and 37 deletions

View File

@ -112,13 +112,12 @@ import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_CONVERSATION_PASSWORD
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_FROM_NOTIFICATION_START_CALL import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_FROM_NOTIFICATION_START_CALL
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_IS_BREAKOUT_ROOM import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_IS_BREAKOUT_ROOM
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_IS_MODERATOR import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_IS_MODERATOR
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_IS_ROOM_GROUP
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_IS_ROOM_ONE_TO_ONE
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_MODIFIED_BASE_URL import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_MODIFIED_BASE_URL
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_RECORDING_STATE import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_RECORDING_STATE
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_ID import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_ID
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_ONE_TO_ONE
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_START_CALL_AFTER_ROOM_SWITCH import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_START_CALL_AFTER_ROOM_SWITCH
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_SWITCH_TO_ROOM import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_SWITCH_TO_ROOM
@ -385,8 +384,7 @@ class CallActivity : CallBaseActivity() {
canPublishAudioStream = extras.getBoolean(KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO) canPublishAudioStream = extras.getBoolean(KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO)
canPublishVideoStream = extras.getBoolean(KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO) canPublishVideoStream = extras.getBoolean(KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO)
isModerator = extras.getBoolean(KEY_IS_MODERATOR, false) isModerator = extras.getBoolean(KEY_IS_MODERATOR, false)
isOneToOneConversation = extras.getBoolean(KEY_IS_ROOM_ONE_TO_ONE, false) isOneToOneConversation = extras.getBoolean(KEY_ROOM_ONE_TO_ONE, false)
isGroupConversation = extras.getBoolean(KEY_IS_ROOM_GROUP, false)
if (extras.containsKey(KEY_FROM_NOTIFICATION_START_CALL)) { if (extras.containsKey(KEY_FROM_NOTIFICATION_START_CALL)) {
isIncomingCallFromNotification = extras.getBoolean(KEY_FROM_NOTIFICATION_START_CALL) isIncomingCallFromNotification = extras.getBoolean(KEY_FROM_NOTIFICATION_START_CALL)
@ -676,29 +674,23 @@ class CallActivity : CallBaseActivity() {
} }
} }
if (isGroupConversation) {
binding!!.hangupButton.setOnClickListener {
hangup(true, null)
}
}
if (isOneToOneConversation && isModerator) {
binding!!.hangupButton.setOnClickListener {
showPopupMenu()
}
}
if (isOneToOneConversation) { if (isOneToOneConversation) {
binding!!.hangupButton.setOnLongClickListener { binding!!.hangupButton.setOnLongClickListener {
hangup(true, null) hangup(true, null)
true true
} }
} binding!!.hangupButton.setOnClickListener {
if (isModerator && isGroupConversation) {
binding!!.hangupButton.setOnLongClickListener {
showPopupMenu() showPopupMenu()
true }
}else{
if (isModerator) {
binding!!.hangupButton.setOnLongClickListener {
showPopupMenu()
true
}
}
binding!!.hangupButton.setOnClickListener {
hangup(true, null)
} }
} }

View File

@ -36,6 +36,7 @@ import com.nextcloud.talk.utils.NotificationUtils
import com.nextcloud.talk.utils.SpreedFeatures import com.nextcloud.talk.utils.SpreedFeatures
import com.nextcloud.talk.utils.bundle.BundleKeys import com.nextcloud.talk.utils.bundle.BundleKeys
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_CALL_VOICE_ONLY import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_CALL_VOICE_ONLY
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_ONE_TO_ONE
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN
import okhttp3.Cache import okhttp3.Cache
import java.io.IOException import java.io.IOException
@ -91,7 +92,7 @@ class CallNotificationActivity : CallBaseActivity() {
notificationTimestamp = extras.getInt(BundleKeys.KEY_NOTIFICATION_TIMESTAMP) notificationTimestamp = extras.getInt(BundleKeys.KEY_NOTIFICATION_TIMESTAMP)
displayName = extras.getString(BundleKeys.KEY_CONVERSATION_DISPLAY_NAME, "") displayName = extras.getString(BundleKeys.KEY_CONVERSATION_DISPLAY_NAME, "")
callFlag = extras.getInt(BundleKeys.KEY_CALL_FLAG) callFlag = extras.getInt(BundleKeys.KEY_CALL_FLAG)
isOneToOneCall = extras.getBoolean(BundleKeys.KEY_ROOM_ONE_TO_ONE) isOneToOneCall = extras.getBoolean(KEY_ROOM_ONE_TO_ONE)
conversationName = extras.getString(BundleKeys.KEY_CONVERSATION_NAME, "") conversationName = extras.getString(BundleKeys.KEY_CONVERSATION_NAME, "")
internalUserId = extras.getLong(BundleKeys.KEY_INTERNAL_USER_ID) internalUserId = extras.getLong(BundleKeys.KEY_INTERNAL_USER_ID)
} }
@ -175,6 +176,7 @@ class CallNotificationActivity : CallBaseActivity() {
binding!!.callAnswerVoiceOnlyView.setOnClickListener { binding!!.callAnswerVoiceOnlyView.setOnClickListener {
Log.d(TAG, "accept call (voice only)") Log.d(TAG, "accept call (voice only)")
intent.putExtra(KEY_CALL_VOICE_ONLY, true) intent.putExtra(KEY_CALL_VOICE_ONLY, true)
intent.putExtra(KEY_ROOM_ONE_TO_ONE,isOneToOneCall)
proceedToCall() proceedToCall()
} }
binding!!.callAnswerCameraView.setOnClickListener { binding!!.callAnswerCameraView.setOnClickListener {
@ -192,6 +194,7 @@ class CallNotificationActivity : CallBaseActivity() {
private fun proceedToCall() { private fun proceedToCall() {
val callIntent = Intent(this, CallActivity::class.java) val callIntent = Intent(this, CallActivity::class.java)
intent.putExtra(KEY_ROOM_ONE_TO_ONE,isOneToOneCall)
callIntent.putExtras(intent.extras!!) callIntent.putExtras(intent.extras!!)
startActivity(callIntent) startActivity(callIntent)
} }

View File

@ -167,8 +167,6 @@ import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_FILE_PATHS
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_INTERNAL_USER_ID import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_INTERNAL_USER_ID
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_IS_BREAKOUT_ROOM import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_IS_BREAKOUT_ROOM
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_IS_MODERATOR import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_IS_MODERATOR
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_IS_ROOM_GROUP
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_IS_ROOM_ONE_TO_ONE
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_RECORDING_STATE import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_RECORDING_STATE
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_START_CALL_AFTER_ROOM_SWITCH import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_START_CALL_AFTER_ROOM_SWITCH
@ -3074,8 +3072,7 @@ class ChatActivity :
BundleKeys.KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO, BundleKeys.KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO,
participantPermissions.canPublishAudio() participantPermissions.canPublishAudio()
) )
bundle.putBoolean(KEY_IS_ROOM_ONE_TO_ONE, ConversationUtils.isOneToOneConversation(it)) bundle.putBoolean(BundleKeys.KEY_ROOM_ONE_TO_ONE, isOneToOneConversation())
bundle.putBoolean(KEY_IS_ROOM_GROUP, ConversationUtils.isGroupConversation(it))
bundle.putBoolean( bundle.putBoolean(
BundleKeys.KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO, BundleKeys.KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO,
participantPermissions.canPublishVideo() participantPermissions.canPublishVideo()

View File

@ -220,6 +220,7 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
} }
} }
private fun handleCallPushMessage() { private fun handleCallPushMessage() {
val userBeingCalled = userManager.getUserWithId(signatureVerification.user!!.id!!).blockingGet() val userBeingCalled = userManager.getUserWithId(signatureVerification.user!!.id!!).blockingGet()
@ -231,7 +232,7 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
bundle.putLong(KEY_INTERNAL_USER_ID, signatureVerification.user!!.id!!) bundle.putLong(KEY_INTERNAL_USER_ID, signatureVerification.user!!.id!!)
bundle.putBoolean(KEY_FROM_NOTIFICATION_START_CALL, true) bundle.putBoolean(KEY_FROM_NOTIFICATION_START_CALL, true)
val isOneToOneCall = conversation.type === ConversationEnums.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL val isOneToOneCall = conversation.type == ConversationEnums.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL
bundle.putBoolean(KEY_ROOM_ONE_TO_ONE, isOneToOneCall) // ggf change in Activity? not necessary???? bundle.putBoolean(KEY_ROOM_ONE_TO_ONE, isOneToOneCall) // ggf change in Activity? not necessary????
bundle.putString(BundleKeys.KEY_CONVERSATION_NAME, conversation.name) bundle.putString(BundleKeys.KEY_CONVERSATION_NAME, conversation.name)

View File

@ -24,14 +24,6 @@ object ConversationUtils {
Participant.ParticipantType.USER_FOLLOWING_LINK == conversation.participantType Participant.ParticipantType.USER_FOLLOWING_LINK == conversation.participantType
} }
fun isOneToOneConversation(conversation: ConversationModel): Boolean {
return ConversationEnums.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL == conversation.type
}
fun isGroupConversation(conversation: ConversationModel): Boolean {
return ConversationEnums.ConversationType.ROOM_GROUP_CALL == conversation.type
}
fun isParticipantOwnerOrModerator(conversation: ConversationModel): Boolean { fun isParticipantOwnerOrModerator(conversation: ConversationModel): Boolean {
return Participant.ParticipantType.OWNER == conversation.participantType || return Participant.ParticipantType.OWNER == conversation.participantType ||
Participant.ParticipantType.GUEST_MODERATOR == conversation.participantType || Participant.ParticipantType.GUEST_MODERATOR == conversation.participantType ||

View File

@ -80,6 +80,4 @@ object BundleKeys {
const val KEY_CREDENTIALS: String = "KEY_CREDENTIALS" const val KEY_CREDENTIALS: String = "KEY_CREDENTIALS"
const val KEY_FIELD_MAP: String = "KEY_FIELD_MAP" const val KEY_FIELD_MAP: String = "KEY_FIELD_MAP"
const val KEY_CHAT_URL: String = "KEY_CHAT_URL" const val KEY_CHAT_URL: String = "KEY_CHAT_URL"
const val KEY_IS_ROOM_ONE_TO_ONE: String = "KEY_IS_ROOM_ONE_TO_ONE"
const val KEY_IS_ROOM_GROUP: String = "KEY_IS_ROOM_GROUP"
} }