mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 03:59:35 +01:00
set more call actions visibility depending on available features
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
c77013bb75
commit
7b48b8fc1f
@ -98,6 +98,7 @@ import com.nextcloud.talk.utils.ApiUtils;
|
||||
import com.nextcloud.talk.utils.DisplayUtils;
|
||||
import com.nextcloud.talk.utils.NotificationUtils;
|
||||
import com.nextcloud.talk.utils.animations.PulseAnimation;
|
||||
import com.nextcloud.talk.utils.database.user.CapabilitiesUtilNew;
|
||||
import com.nextcloud.talk.utils.permissions.PlatformPermissionUtil;
|
||||
import com.nextcloud.talk.utils.power.PowerManagerUtils;
|
||||
import com.nextcloud.talk.utils.singletons.ApplicationWideCurrentRoomHolder;
|
||||
@ -414,6 +415,7 @@ public class CallActivity extends CallBaseActivity {
|
||||
}
|
||||
});
|
||||
|
||||
initFeaturesVisibility();
|
||||
initClickListeners();
|
||||
binding.microphoneButton.setOnTouchListener(new MicrophoneButtonTouchListener());
|
||||
|
||||
@ -460,6 +462,18 @@ public class CallActivity extends CallBaseActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private void initFeaturesVisibility() {
|
||||
// TODO: check for isAllowedToRecordCall once api is ready
|
||||
// boolean showMoreCallActionsItem = isAllowedToRecordCall();
|
||||
// if (showMoreCallActionsItem) {
|
||||
// binding.moreCallActions.setVisibility(View.VISIBLE);
|
||||
// } else {
|
||||
// binding.moreCallActions.setVisibility(View.GONE);
|
||||
// }
|
||||
|
||||
binding.moreCallActions.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private void initClickListeners() {
|
||||
binding.pictureInPictureButton.setOnClickListener(l -> enterPipMode());
|
||||
|
||||
@ -2940,6 +2954,11 @@ public class CallActivity extends CallBaseActivity {
|
||||
binding.callRecordingIndicator.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public boolean isAllowedToRecordCall() {
|
||||
return CapabilitiesUtilNew.hasSpreedFeatureCapability(conversationUser, "recording-v1") &&
|
||||
CapabilitiesUtilNew.isCallRecordingAvailable(conversationUser);
|
||||
}
|
||||
|
||||
private class SelfVideoTouchListener implements View.OnTouchListener {
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
|
@ -54,10 +54,27 @@ class MoreCallActionsDialog(private val callActivity: CallActivity) : BottomShee
|
||||
|
||||
viewThemeUtils.platform.themeDialogDark(binding.root)
|
||||
|
||||
initItemsVisibility()
|
||||
initClickListeners()
|
||||
initObservers()
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
val bottomSheet = findViewById<View>(R.id.design_bottom_sheet)
|
||||
val behavior = BottomSheetBehavior.from(bottomSheet as View)
|
||||
behavior.state = BottomSheetBehavior.STATE_COLLAPSED
|
||||
}
|
||||
|
||||
private fun initItemsVisibility() {
|
||||
// if (callActivity.isAllowedToRecordCall) {
|
||||
if (true) {
|
||||
binding.recordCall.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.recordCall.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
private fun initClickListeners() {
|
||||
binding.recordCall.setOnClickListener {
|
||||
callActivity.callRecordingViewModel.clickRecordButton()
|
||||
@ -70,14 +87,14 @@ class MoreCallActionsDialog(private val callActivity: CallActivity) : BottomShee
|
||||
is CallRecordingViewModel.RecordingStartedState -> {
|
||||
binding.recordCallText.text = context.getText(R.string.record_stop_description)
|
||||
binding.recordCallIcon.setImageDrawable(
|
||||
ContextCompat.getDrawable(context, R.drawable.record_start)
|
||||
ContextCompat.getDrawable(context, R.drawable.record_stop)
|
||||
)
|
||||
dismiss()
|
||||
}
|
||||
is CallRecordingViewModel.RecordingStoppedState -> {
|
||||
binding.recordCallText.text = context.getText(R.string.record_start_description)
|
||||
binding.recordCallIcon.setImageDrawable(
|
||||
ContextCompat.getDrawable(context, R.drawable.record_stop)
|
||||
ContextCompat.getDrawable(context, R.drawable.record_start)
|
||||
)
|
||||
dismiss()
|
||||
}
|
||||
@ -97,13 +114,6 @@ class MoreCallActionsDialog(private val callActivity: CallActivity) : BottomShee
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
val bottomSheet = findViewById<View>(R.id.design_bottom_sheet)
|
||||
val behavior = BottomSheetBehavior.from(bottomSheet as View)
|
||||
behavior.state = BottomSheetBehavior.STATE_COLLAPSED
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "MoreCallActionsDialog"
|
||||
}
|
||||
|
@ -98,6 +98,7 @@ object CapabilitiesUtilNew {
|
||||
return false
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun isCallRecordingAvailable(user: User): Boolean {
|
||||
if (user.capabilities?.spreedCapability?.config?.containsKey("call") == true) {
|
||||
val map: Map<String, String>? = user.capabilities!!.spreedCapability!!.config!!["call"]
|
||||
|
Loading…
Reference in New Issue
Block a user