mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-26 23:25:20 +03: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
5 changed files with 22 additions and 7 deletions
|
@ -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_PASSWORD;
|
||||
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_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO;
|
||||
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 canPublishVideoStream;
|
||||
|
||||
private boolean isModerator;
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -369,6 +372,7 @@ public class CallActivity extends CallBaseActivity {
|
|||
isCallWithoutNotification = extras.getBoolean(KEY_CALL_WITHOUT_NOTIFICATION, false);
|
||||
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);
|
||||
|
||||
if (extras.containsKey(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() {
|
||||
boolean showMoreCallActionsItem = isAllowedToRecordCall();
|
||||
boolean showMoreCallActionsItem = isAllowedToStartOrStopRecording();
|
||||
if (showMoreCallActionsItem) {
|
||||
binding.moreCallActions.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
binding.moreCallActions.setVisibility(View.GONE);
|
||||
binding.moreCallActions.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -541,7 +545,9 @@ public class CallActivity extends CallBaseActivity {
|
|||
});
|
||||
|
||||
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) {
|
||||
switch (activeAudioDevice) {
|
||||
case BLUETOOTH:
|
||||
binding.audioOutputButton.setImageResource ( R.drawable.ic_baseline_bluetooth_audio_24);
|
||||
binding.audioOutputButton.setImageResource(R.drawable.ic_baseline_bluetooth_audio_24);
|
||||
break;
|
||||
case SPEAKER_PHONE:
|
||||
binding.audioOutputButton.setImageResource(R.drawable.ic_volume_up_white_24dp);
|
||||
|
@ -2974,9 +2980,10 @@ public class CallActivity extends CallBaseActivity {
|
|||
binding.callRecordingIndicator.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public boolean isAllowedToRecordCall() {
|
||||
public boolean isAllowedToStartOrStopRecording() {
|
||||
return CapabilitiesUtilNew.hasSpreedFeatureCapability(conversationUser, "recording-v1") &&
|
||||
CapabilitiesUtilNew.isCallRecordingAvailable(conversationUser);
|
||||
CapabilitiesUtilNew.isCallRecordingAvailable(conversationUser)
|
||||
&& isModerator;
|
||||
}
|
||||
|
||||
private class SelfVideoTouchListener implements View.OnTouchListener {
|
||||
|
|
|
@ -169,6 +169,10 @@ class CallNotificationActivity : CallBaseActivity() {
|
|||
BundleKeys.KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO,
|
||||
participantPermission.canPublishVideo()
|
||||
)
|
||||
originalBundle!!.putBoolean(
|
||||
BundleKeys.KEY_IS_MODERATOR,
|
||||
currentConversation!!.isParticipantOwnerOrModerator
|
||||
)
|
||||
|
||||
val intent = Intent(this, CallActivity::class.java)
|
||||
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_FILE_PATHS
|
||||
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_ROOM_ID
|
||||
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(KEY_CONVERSATION_NAME, it.displayName)
|
||||
bundle.putInt(KEY_RECORDING_STATE, it.callRecording)
|
||||
bundle.putBoolean(KEY_IS_MODERATOR, it.isParticipantOwnerOrModerator)
|
||||
bundle.putBoolean(
|
||||
BundleKeys.KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO,
|
||||
participantPermissions.canPublishAudio()
|
||||
|
@ -3291,6 +3293,7 @@ class ChatController(args: Bundle) :
|
|||
bundle.putParcelable(KEY_USER_ENTITY, conversationUser)
|
||||
bundle.putString(KEY_ROOM_TOKEN, roomOverall.ocs!!.data!!.token)
|
||||
bundle.putString(KEY_ROOM_ID, roomOverall.ocs!!.data!!.roomId)
|
||||
bundle.putBoolean(KEY_IS_MODERATOR, roomOverall.ocs!!.data!!.isParticipantOwnerOrModerator)
|
||||
|
||||
if (conversationUser != null) {
|
||||
bundle.putParcelable(
|
||||
|
|
|
@ -67,7 +67,7 @@ class MoreCallActionsDialog(private val callActivity: CallActivity) : BottomShee
|
|||
}
|
||||
|
||||
private fun initItemsVisibility() {
|
||||
if (callActivity.isAllowedToRecordCall) {
|
||||
if (callActivity.isAllowedToStartOrStopRecording) {
|
||||
binding.recordCall.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.recordCall.visibility = View.GONE
|
||||
|
|
|
@ -79,4 +79,5 @@ object BundleKeys {
|
|||
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_VIDEO = "KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO"
|
||||
const val KEY_IS_MODERATOR = "KEY_IS_MODERATOR"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue