mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-15 08:45:04 +01:00
show recording controls depending on moderator state
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
1aafc9989d
commit
a8a9d6f25e
@ -175,6 +175,7 @@ import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_CALL_WITHOUT_NOTIFI
|
|||||||
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_CONVERSATION_NAME;
|
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_CONVERSATION_NAME;
|
||||||
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_CONVERSATION_PASSWORD;
|
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_CONVERSATION_PASSWORD;
|
||||||
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_FROM_NOTIFICATION_START_CALL;
|
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_FROM_NOTIFICATION_START_CALL;
|
||||||
|
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_IS_MODERATOR;
|
||||||
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_MODIFIED_BASE_URL;
|
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_MODIFIED_BASE_URL;
|
||||||
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO;
|
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO;
|
||||||
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO;
|
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO;
|
||||||
@ -346,6 +347,8 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
private boolean canPublishAudioStream;
|
private boolean canPublishAudioStream;
|
||||||
private boolean canPublishVideoStream;
|
private boolean canPublishVideoStream;
|
||||||
|
|
||||||
|
private boolean isModerator;
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
@ -369,6 +372,7 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
isCallWithoutNotification = extras.getBoolean(KEY_CALL_WITHOUT_NOTIFICATION, false);
|
isCallWithoutNotification = extras.getBoolean(KEY_CALL_WITHOUT_NOTIFICATION, false);
|
||||||
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);
|
||||||
|
|
||||||
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);
|
||||||
@ -468,11 +472,11 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initFeaturesVisibility() {
|
private void initFeaturesVisibility() {
|
||||||
boolean showMoreCallActionsItem = isAllowedToRecordCall();
|
boolean showMoreCallActionsItem = isAllowedToStartOrStopRecording();
|
||||||
if (showMoreCallActionsItem) {
|
if (showMoreCallActionsItem) {
|
||||||
binding.moreCallActions.setVisibility(View.VISIBLE);
|
binding.moreCallActions.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
binding.moreCallActions.setVisibility(View.GONE);
|
binding.moreCallActions.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -541,7 +545,9 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
});
|
});
|
||||||
|
|
||||||
binding.callRecordingIndicator.setOnClickListener(l -> {
|
binding.callRecordingIndicator.setOnClickListener(l -> {
|
||||||
callRecordingViewModel.clickRecordButton();
|
if (isAllowedToStartOrStopRecording()) {
|
||||||
|
callRecordingViewModel.clickRecordButton();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -638,7 +644,7 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
private void updateAudioOutputButton(WebRtcAudioManager.AudioDevice activeAudioDevice) {
|
private void updateAudioOutputButton(WebRtcAudioManager.AudioDevice activeAudioDevice) {
|
||||||
switch (activeAudioDevice) {
|
switch (activeAudioDevice) {
|
||||||
case BLUETOOTH:
|
case BLUETOOTH:
|
||||||
binding.audioOutputButton.setImageResource ( R.drawable.ic_baseline_bluetooth_audio_24);
|
binding.audioOutputButton.setImageResource(R.drawable.ic_baseline_bluetooth_audio_24);
|
||||||
break;
|
break;
|
||||||
case SPEAKER_PHONE:
|
case SPEAKER_PHONE:
|
||||||
binding.audioOutputButton.setImageResource(R.drawable.ic_volume_up_white_24dp);
|
binding.audioOutputButton.setImageResource(R.drawable.ic_volume_up_white_24dp);
|
||||||
@ -2974,9 +2980,10 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
binding.callRecordingIndicator.setVisibility(View.GONE);
|
binding.callRecordingIndicator.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAllowedToRecordCall() {
|
public boolean isAllowedToStartOrStopRecording() {
|
||||||
return CapabilitiesUtilNew.hasSpreedFeatureCapability(conversationUser, "recording-v1") &&
|
return CapabilitiesUtilNew.hasSpreedFeatureCapability(conversationUser, "recording-v1") &&
|
||||||
CapabilitiesUtilNew.isCallRecordingAvailable(conversationUser);
|
CapabilitiesUtilNew.isCallRecordingAvailable(conversationUser)
|
||||||
|
&& isModerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SelfVideoTouchListener implements View.OnTouchListener {
|
private class SelfVideoTouchListener implements View.OnTouchListener {
|
||||||
|
@ -169,6 +169,10 @@ class CallNotificationActivity : CallBaseActivity() {
|
|||||||
BundleKeys.KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO,
|
BundleKeys.KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO,
|
||||||
participantPermission.canPublishVideo()
|
participantPermission.canPublishVideo()
|
||||||
)
|
)
|
||||||
|
originalBundle!!.putBoolean(
|
||||||
|
BundleKeys.KEY_IS_MODERATOR,
|
||||||
|
currentConversation!!.isParticipantOwnerOrModerator
|
||||||
|
)
|
||||||
|
|
||||||
val intent = Intent(this, CallActivity::class.java)
|
val intent = Intent(this, CallActivity::class.java)
|
||||||
intent.putExtras(originalBundle!!)
|
intent.putExtras(originalBundle!!)
|
||||||
|
@ -174,6 +174,7 @@ import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ACTIVE_CONVERSATION
|
|||||||
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_CONVERSATION_NAME
|
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_CONVERSATION_NAME
|
||||||
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_FILE_PATHS
|
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_MODERATOR
|
||||||
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_TOKEN
|
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN
|
||||||
@ -2740,6 +2741,7 @@ class ChatController(args: Bundle) :
|
|||||||
bundle.putString(BundleKeys.KEY_MODIFIED_BASE_URL, conversationUser?.baseUrl)
|
bundle.putString(BundleKeys.KEY_MODIFIED_BASE_URL, conversationUser?.baseUrl)
|
||||||
bundle.putString(KEY_CONVERSATION_NAME, it.displayName)
|
bundle.putString(KEY_CONVERSATION_NAME, it.displayName)
|
||||||
bundle.putInt(KEY_RECORDING_STATE, it.callRecording)
|
bundle.putInt(KEY_RECORDING_STATE, it.callRecording)
|
||||||
|
bundle.putBoolean(KEY_IS_MODERATOR, it.isParticipantOwnerOrModerator)
|
||||||
bundle.putBoolean(
|
bundle.putBoolean(
|
||||||
BundleKeys.KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO,
|
BundleKeys.KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO,
|
||||||
participantPermissions.canPublishAudio()
|
participantPermissions.canPublishAudio()
|
||||||
@ -3291,6 +3293,7 @@ class ChatController(args: Bundle) :
|
|||||||
bundle.putParcelable(KEY_USER_ENTITY, conversationUser)
|
bundle.putParcelable(KEY_USER_ENTITY, conversationUser)
|
||||||
bundle.putString(KEY_ROOM_TOKEN, roomOverall.ocs!!.data!!.token)
|
bundle.putString(KEY_ROOM_TOKEN, roomOverall.ocs!!.data!!.token)
|
||||||
bundle.putString(KEY_ROOM_ID, roomOverall.ocs!!.data!!.roomId)
|
bundle.putString(KEY_ROOM_ID, roomOverall.ocs!!.data!!.roomId)
|
||||||
|
bundle.putBoolean(KEY_IS_MODERATOR, roomOverall.ocs!!.data!!.isParticipantOwnerOrModerator)
|
||||||
|
|
||||||
if (conversationUser != null) {
|
if (conversationUser != null) {
|
||||||
bundle.putParcelable(
|
bundle.putParcelable(
|
||||||
|
@ -67,7 +67,7 @@ class MoreCallActionsDialog(private val callActivity: CallActivity) : BottomShee
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun initItemsVisibility() {
|
private fun initItemsVisibility() {
|
||||||
if (callActivity.isAllowedToRecordCall) {
|
if (callActivity.isAllowedToStartOrStopRecording) {
|
||||||
binding.recordCall.visibility = View.VISIBLE
|
binding.recordCall.visibility = View.VISIBLE
|
||||||
} else {
|
} else {
|
||||||
binding.recordCall.visibility = View.GONE
|
binding.recordCall.visibility = View.GONE
|
||||||
|
@ -79,4 +79,5 @@ object BundleKeys {
|
|||||||
const val KEY_MIME_TYPE_FILTER = "KEY_MIME_TYPE_FILTER"
|
const val KEY_MIME_TYPE_FILTER = "KEY_MIME_TYPE_FILTER"
|
||||||
const val KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO = "KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO"
|
const val KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO = "KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO"
|
||||||
const val KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO = "KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO"
|
const val KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO = "KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO"
|
||||||
|
const val KEY_IS_MODERATOR = "KEY_IS_MODERATOR"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user