Set video call information in incoming CallStyle notification

This commit is contained in:
Sylvain Berfini 2022-03-21 13:31:16 +01:00
parent 20dcb23b8a
commit bb31a0014b

View file

@ -64,10 +64,16 @@ class Api31Compatibility {
.setKey(person.key)
.setImportant(person.isImportant)
.build()
val declineIntent = notificationsManager.getCallDeclinePendingIntent(notifiable)
val answerIntent = notificationsManager.getCallAnswerPendingIntent(notifiable)
val isVideoEnabledInRemoteParams = call.remoteParams?.isVideoEnabled ?: false
val isVideoAutomaticallyAccepted = call.core.videoActivationPolicy.automaticallyAccept
val isVideo = isVideoEnabledInRemoteParams && isVideoAutomaticallyAccepted
val builder = Notification.Builder(context, context.getString(R.string.notification_channel_incoming_call_id))
.setStyle(Notification.CallStyle.forIncomingCall(caller, declineIntent, answerIntent))
.setStyle(Notification.CallStyle.forIncomingCall(caller, declineIntent, answerIntent).setIsVideo(isVideo))
.setSmallIcon(R.drawable.topbar_call_notification)
.setCategory(Notification.CATEGORY_CALL)
.setVisibility(Notification.VISIBILITY_PUBLIC)