diff --git a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt index 68d8ed0a83..89adeea92e 100644 --- a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt @@ -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 @@ -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) @@ -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) } } diff --git a/app/src/main/java/com/nextcloud/talk/callnotification/CallNotificationActivity.kt b/app/src/main/java/com/nextcloud/talk/callnotification/CallNotificationActivity.kt index 57a3f2dc20..ca3844058b 100644 --- a/app/src/main/java/com/nextcloud/talk/callnotification/CallNotificationActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/callnotification/CallNotificationActivity.kt @@ -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 @@ -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) } @@ -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 { @@ -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) } diff --git a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt index 4c3fec46c9..875bd215ce 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt @@ -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 @@ -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() diff --git a/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.kt b/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.kt index 870bb94194..dfc7328dd3 100644 --- a/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.kt +++ b/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.kt @@ -220,6 +220,7 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor } } + private fun handleCallPushMessage() { 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.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) diff --git a/app/src/main/java/com/nextcloud/talk/utils/ConversationUtils.kt b/app/src/main/java/com/nextcloud/talk/utils/ConversationUtils.kt index 132e70d42e..08dbb8587a 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/ConversationUtils.kt +++ b/app/src/main/java/com/nextcloud/talk/utils/ConversationUtils.kt @@ -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 || diff --git a/app/src/main/java/com/nextcloud/talk/utils/bundle/BundleKeys.kt b/app/src/main/java/com/nextcloud/talk/utils/bundle/BundleKeys.kt index 3155d2a8f4..53de01b275 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/bundle/BundleKeys.kt +++ b/app/src/main/java/com/nextcloud/talk/utils/bundle/BundleKeys.kt @@ -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" }