mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-19 16:19:33 +01:00
Enable call vanity when joining a video call.
This commit is contained in:
@@ -125,7 +125,8 @@ fun CallScreen(
|
||||
callRecipient = callRecipient,
|
||||
isVideoCall = isRemoteVideoOffer,
|
||||
callStatus = callScreenState.callStatus,
|
||||
callScreenControlsListener = callScreenControlsListener
|
||||
callScreenControlsListener = callScreenControlsListener,
|
||||
localParticipant = localParticipant
|
||||
)
|
||||
|
||||
return
|
||||
|
||||
@@ -40,7 +40,9 @@ import org.signal.core.ui.compose.Previews
|
||||
import org.signal.glide.compose.GlideImage
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.avatar.AvatarImage
|
||||
import org.thoughtcrime.securesms.events.CallParticipant
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.ringrtc.CameraState
|
||||
|
||||
private val textShadow = Shadow(
|
||||
color = Color(0f, 0f, 0f, 0.25f),
|
||||
@@ -52,7 +54,8 @@ fun IncomingCallScreen(
|
||||
callRecipient: Recipient,
|
||||
callStatus: String?,
|
||||
isVideoCall: Boolean,
|
||||
callScreenControlsListener: CallScreenControlsListener
|
||||
callScreenControlsListener: CallScreenControlsListener,
|
||||
localParticipant: CallParticipant = CallParticipant.EMPTY
|
||||
) {
|
||||
val isLandscape = LocalConfiguration.current.orientation == Configuration.ORIENTATION_LANDSCAPE
|
||||
val callTypePadding = remember(isLandscape) {
|
||||
@@ -62,24 +65,37 @@ fun IncomingCallScreen(
|
||||
PaddingValues(top = 22.dp, bottom = 30.dp)
|
||||
}
|
||||
}
|
||||
val showLocalVideo = localParticipant.isVideoEnabled
|
||||
|
||||
Scaffold { contentPadding ->
|
||||
|
||||
GlideImage(
|
||||
model = callRecipient.contactPhoto,
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.blur(
|
||||
radiusX = 25.dp,
|
||||
radiusY = 25.dp,
|
||||
edgeTreatment = BlurredEdgeTreatment.Rectangle
|
||||
)
|
||||
)
|
||||
if (showLocalVideo) {
|
||||
RemoteParticipantContent(
|
||||
participant = localParticipant,
|
||||
renderInPip = false,
|
||||
raiseHandAllowed = false,
|
||||
mirrorVideo = localParticipant.cameraDirection == CameraState.Direction.FRONT,
|
||||
showAudioIndicator = false,
|
||||
onInfoMoreInfoClick = null,
|
||||
modifier = Modifier.fillMaxSize()
|
||||
)
|
||||
} else {
|
||||
GlideImage(
|
||||
model = callRecipient.contactPhoto,
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.blur(
|
||||
radiusX = 25.dp,
|
||||
radiusY = 25.dp,
|
||||
edgeTreatment = BlurredEdgeTreatment.Rectangle
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.background(color = Color.Black.copy(alpha = 0.4f))
|
||||
.background(color = Color.Black.copy(alpha = if (showLocalVideo) 0.2f else 0.4f))
|
||||
) {}
|
||||
|
||||
CallScreenTopAppBar(
|
||||
|
||||
@@ -7,6 +7,7 @@ package org.thoughtcrime.securesms.components.webrtc.v2
|
||||
|
||||
import android.Manifest
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.KeyguardManager
|
||||
import android.app.PictureInPictureParams
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
@@ -249,6 +250,8 @@ class WebRtcCallActivity : BaseActivity(), SafetyNumberChangeDialog.Callback, Re
|
||||
if (SignalStore.rateLimit.needsRecaptcha()) {
|
||||
RecaptchaProofBottomSheetFragment.show(supportFragmentManager)
|
||||
}
|
||||
|
||||
updateIncomingRingingVanity()
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent) {
|
||||
@@ -263,6 +266,8 @@ class WebRtcCallActivity : BaseActivity(), SafetyNumberChangeDialog.Callback, Re
|
||||
Log.i(TAG, "onPause")
|
||||
super.onPause()
|
||||
|
||||
disableIncomingRingingVanity()
|
||||
|
||||
if (!isInPipMode() || isFinishing) {
|
||||
EventBus.getDefault().unregister(this)
|
||||
}
|
||||
@@ -403,6 +408,9 @@ class WebRtcCallActivity : BaseActivity(), SafetyNumberChangeDialog.Callback, Re
|
||||
recreate()
|
||||
return
|
||||
}
|
||||
if (previousCallState != WebRtcViewModel.State.CALL_INCOMING) {
|
||||
updateIncomingRingingVanity()
|
||||
}
|
||||
}
|
||||
|
||||
WebRtcViewModel.State.CALL_OUTGOING -> handleOutgoingCall(event)
|
||||
@@ -1051,6 +1059,24 @@ class WebRtcCallActivity : BaseActivity(), SafetyNumberChangeDialog.Callback, Re
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateIncomingRingingVanity() {
|
||||
val event = previousEvent ?: return
|
||||
if (event.state != WebRtcViewModel.State.CALL_INCOMING) return
|
||||
|
||||
val keyguardManager = getSystemService(KeyguardManager::class.java)
|
||||
val shouldEnable = keyguardManager == null || !keyguardManager.isKeyguardLocked
|
||||
|
||||
Log.i(TAG, "updateIncomingRingingVanity(): shouldEnable=$shouldEnable, keyguardLocked=${keyguardManager?.isKeyguardLocked}")
|
||||
AppDependencies.signalCallManager.setIncomingRingingVanity(shouldEnable)
|
||||
}
|
||||
|
||||
private fun disableIncomingRingingVanity() {
|
||||
val event = previousEvent ?: return
|
||||
if (event.state == WebRtcViewModel.State.CALL_INCOMING) {
|
||||
AppDependencies.signalCallManager.setIncomingRingingVanity(false)
|
||||
}
|
||||
}
|
||||
|
||||
private fun initializeScreenshotSecurity() {
|
||||
if (TextSecurePreferences.isScreenSecurityEnabled(this)) {
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
|
||||
|
||||
Reference in New Issue
Block a user