WIP: Support using Element Call for voice calls in DMs

This commit is contained in:
Valere
2026-01-12 10:48:20 +01:00
committed by Benoit Marty
parent 66c3bf267a
commit ec420332c3
26 changed files with 122 additions and 42 deletions

View File

@@ -26,9 +26,10 @@ sealed interface CallType : NodeInputs, Parcelable {
data class RoomCall(
val sessionId: SessionId,
val roomId: RoomId,
val voiceIntent: Boolean
) : CallType {
override fun toString(): String {
return "RoomCall(sessionId=$sessionId, roomId=$roomId)"
return "RoomCall(sessionId=$sessionId, roomId=$roomId, voiceIntent=$voiceIntent)"
}
}
}

View File

@@ -88,7 +88,8 @@ class RingingCallNotificationCreator(
.setImportant(true)
.build()
val answerIntent = IntentProvider.getPendingIntent(context, CallType.RoomCall(sessionId, roomId))
// TODO
val answerIntent = IntentProvider.getPendingIntent(context, CallType.RoomCall(sessionId, roomId, voiceIntent = false))
val notificationData = CallNotificationData(
sessionId = sessionId,
roomId = roomId,

View File

@@ -45,8 +45,9 @@ class DeclineCallBroadcastReceiver : BroadcastReceiver() {
callType = CallType.RoomCall(
sessionId = notificationData.sessionId,
roomId = notificationData.roomId,
),
notificationData = notificationData,
// TODO
voiceIntent = false
)
)
}
}

View File

@@ -226,6 +226,7 @@ class CallScreenPresenter(
sessionId = inputs.sessionId,
roomId = inputs.roomId,
clientId = UUID.randomUUID().toString(),
voiceOnly = inputs.voiceIntent,
languageTag = languageTag,
theme = theme,
).getOrThrow()

View File

@@ -112,7 +112,14 @@ class IncomingCallActivity : AppCompatActivity() {
}
private fun onAnswer(notificationData: CallNotificationData) {
elementCallEntryPoint.startCall(CallType.RoomCall(notificationData.sessionId, notificationData.roomId))
elementCallEntryPoint.startCall(
CallType.RoomCall(
notificationData.sessionId,
notificationData.roomId,
// TODO
voiceIntent = false
)
)
}
private fun onCancel() {

View File

@@ -146,6 +146,8 @@ class DefaultActiveCallManager(
callType = CallType.RoomCall(
sessionId = notificationData.sessionId,
roomId = notificationData.roomId,
// TODO
voiceIntent = false,
),
callState = CallState.Ringing(notificationData),
)

View File

@@ -16,6 +16,7 @@ interface CallWidgetProvider {
suspend fun getWidget(
sessionId: SessionId,
roomId: RoomId,
voiceOnly: Boolean,
clientId: String,
languageTag: String?,
theme: String?,

View File

@@ -32,6 +32,7 @@ class DefaultCallWidgetProvider(
override suspend fun getWidget(
sessionId: SessionId,
roomId: RoomId,
voiceOnly: Boolean,
clientId: String,
languageTag: String?,
theme: String?,
@@ -50,6 +51,7 @@ class DefaultCallWidgetProvider(
baseUrl = baseUrl,
encrypted = isEncrypted,
direct = room.isDm(),
voiceOnly = voiceOnly,
hasActiveCall = roomInfo.hasRoomCall,
)
val callUrl = room.generateWidgetWebViewUrl(