Skip to content

Commit

Permalink
set bundle keys in CallNotificationActivity
Browse files Browse the repository at this point in the history
Signed-off-by: sowjanyakch <[email protected]>
  • Loading branch information
sowjanyakch committed Oct 29, 2024
1 parent 3c145ea commit 2975392
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 37 deletions.
34 changes: 13 additions & 21 deletions app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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_IS_BREAKOUT_ROOM
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_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_RECORDING_STATE
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_START_CALL_AFTER_ROOM_SWITCH
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_SWITCH_TO_ROOM
Expand Down Expand Up @@ -385,8 +384,7 @@ class CallActivity : CallBaseActivity() {
canPublishAudioStream = extras.getBoolean(KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO)
canPublishVideoStream = extras.getBoolean(KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO)
isModerator = extras.getBoolean(KEY_IS_MODERATOR, false)
isOneToOneConversation = extras.getBoolean(KEY_IS_ROOM_ONE_TO_ONE, false)
isGroupConversation = extras.getBoolean(KEY_IS_ROOM_GROUP, false)
isOneToOneConversation = extras.getBoolean(KEY_ROOM_ONE_TO_ONE, false)

if (extras.containsKey(KEY_FROM_NOTIFICATION_START_CALL)) {
isIncomingCallFromNotification = extras.getBoolean(KEY_FROM_NOTIFICATION_START_CALL)
Expand Down Expand Up @@ -676,29 +674,23 @@ class CallActivity : CallBaseActivity() {
}
}

if (isGroupConversation) {
binding!!.hangupButton.setOnClickListener {
hangup(true, null)
}
}

if (isOneToOneConversation && isModerator) {
binding!!.hangupButton.setOnClickListener {
showPopupMenu()
}
}

if (isOneToOneConversation) {
binding!!.hangupButton.setOnLongClickListener {
hangup(true, null)
true
}
}

if (isModerator && isGroupConversation) {
binding!!.hangupButton.setOnLongClickListener {
binding!!.hangupButton.setOnClickListener {
showPopupMenu()
true
}
}else{
if (isModerator) {
binding!!.hangupButton.setOnLongClickListener {
showPopupMenu()
true
}
}
binding!!.hangupButton.setOnClickListener {
hangup(true, null)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import com.nextcloud.talk.utils.NotificationUtils
import com.nextcloud.talk.utils.SpreedFeatures
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_ROOM_ONE_TO_ONE
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN
import okhttp3.Cache
import java.io.IOException
Expand Down Expand Up @@ -91,7 +92,7 @@ class CallNotificationActivity : CallBaseActivity() {
notificationTimestamp = extras.getInt(BundleKeys.KEY_NOTIFICATION_TIMESTAMP)
displayName = extras.getString(BundleKeys.KEY_CONVERSATION_DISPLAY_NAME, "")
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, "")
internalUserId = extras.getLong(BundleKeys.KEY_INTERNAL_USER_ID)
}
Expand Down Expand Up @@ -175,6 +176,7 @@ class CallNotificationActivity : CallBaseActivity() {
binding!!.callAnswerVoiceOnlyView.setOnClickListener {
Log.d(TAG, "accept call (voice only)")
intent.putExtra(KEY_CALL_VOICE_ONLY, true)
intent.putExtra(KEY_ROOM_ONE_TO_ONE,isOneToOneCall)
proceedToCall()
}
binding!!.callAnswerCameraView.setOnClickListener {
Expand All @@ -192,6 +194,7 @@ class CallNotificationActivity : CallBaseActivity() {

private fun proceedToCall() {
val callIntent = Intent(this, CallActivity::class.java)
intent.putExtra(KEY_ROOM_ONE_TO_ONE,isOneToOneCall)
callIntent.putExtras(intent.extras!!)
startActivity(callIntent)
}
Expand Down
5 changes: 1 addition & 4 deletions app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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_IS_BREAKOUT_ROOM
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_ROOM_TOKEN
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_START_CALL_AFTER_ROOM_SWITCH
Expand Down Expand Up @@ -3095,8 +3093,7 @@ class ChatActivity :
BundleKeys.KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO,
participantPermissions.canPublishAudio()
)
bundle.putBoolean(KEY_IS_ROOM_ONE_TO_ONE, ConversationUtils.isOneToOneConversation(it))
bundle.putBoolean(KEY_IS_ROOM_GROUP, ConversationUtils.isGroupConversation(it))
bundle.putBoolean(BundleKeys.KEY_ROOM_ONE_TO_ONE, isOneToOneConversation())
bundle.putBoolean(
BundleKeys.KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO,
participantPermissions.canPublishVideo()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
}
}


private fun handleCallPushMessage() {
val userBeingCalled = userManager.getUserWithId(signatureVerification.user!!.id!!).blockingGet()

Expand All @@ -231,7 +232,7 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
bundle.putLong(KEY_INTERNAL_USER_ID, signatureVerification.user!!.id!!)
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.putString(BundleKeys.KEY_CONVERSATION_NAME, conversation.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ object ConversationUtils {
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 {
return Participant.ParticipantType.OWNER == conversation.participantType ||
Participant.ParticipantType.GUEST_MODERATOR == conversation.participantType ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,4 @@ object BundleKeys {
const val KEY_CREDENTIALS: String = "KEY_CREDENTIALS"
const val KEY_FIELD_MAP: String = "KEY_FIELD_MAP"
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"
}

0 comments on commit 2975392

Please sign in to comment.