Update incoming call notification content to "📹 Incoming call"
This commit is contained in:
parent
c5f3b3450a
commit
7878f97453
14 changed files with 85 additions and 9 deletions
|
|
@ -43,6 +43,7 @@ class DefaultElementCallEntryPoint @Inject constructor(
|
|||
avatarUrl: String?,
|
||||
timestamp: Long,
|
||||
notificationChannelId: String,
|
||||
textContent: String?,
|
||||
) {
|
||||
val incomingCallNotificationData = CallNotificationData(
|
||||
sessionId = callType.sessionId,
|
||||
|
|
@ -54,6 +55,7 @@ class DefaultElementCallEntryPoint @Inject constructor(
|
|||
avatarUrl = avatarUrl,
|
||||
timestamp = timestamp,
|
||||
notificationChannelId = notificationChannelId,
|
||||
textContent = textContent,
|
||||
)
|
||||
activeCallManager.registerIncomingCall(notificationData = incomingCallNotificationData)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,4 +25,5 @@ data class CallNotificationData(
|
|||
val avatarUrl: String?,
|
||||
val notificationChannelId: String,
|
||||
val timestamp: Long,
|
||||
val textContent: String?,
|
||||
) : Parcelable
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ class RingingCallNotificationCreator @Inject constructor(
|
|||
roomAvatarUrl: String?,
|
||||
notificationChannelId: String,
|
||||
timestamp: Long,
|
||||
textContent: String?,
|
||||
): Notification? {
|
||||
val matrixClient = matrixClientProvider.getOrRestore(sessionId).getOrNull() ?: return null
|
||||
val imageLoader = imageLoaderHolder.get(matrixClient)
|
||||
|
|
@ -84,7 +85,8 @@ class RingingCallNotificationCreator @Inject constructor(
|
|||
senderName = senderDisplayName,
|
||||
avatarUrl = roomAvatarUrl,
|
||||
notificationChannelId = notificationChannelId,
|
||||
timestamp = timestamp
|
||||
timestamp = timestamp,
|
||||
textContent = textContent,
|
||||
)
|
||||
|
||||
val declineIntent = PendingIntentCompat.getBroadcast(
|
||||
|
|
@ -120,6 +122,10 @@ class RingingCallNotificationCreator @Inject constructor(
|
|||
.setOngoing(true)
|
||||
.setShowWhen(false)
|
||||
.apply {
|
||||
if (textContent != null) {
|
||||
setContentText(textContent)
|
||||
// Else the content text is set by the style (will be "Incoming call")
|
||||
}
|
||||
if (ringtoneUri != null) {
|
||||
setSound(ringtoneUri, AudioManager.STREAM_RING)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,6 +173,7 @@ internal fun IncomingCallScreenPreview() = ElementPreview {
|
|||
avatarUrl = null,
|
||||
notificationChannelId = "incoming_call",
|
||||
timestamp = 0L,
|
||||
textContent = null,
|
||||
),
|
||||
onAnswer = {},
|
||||
onCancel = {},
|
||||
|
|
|
|||
|
|
@ -160,7 +160,8 @@ class DefaultActiveCallManager @Inject constructor(
|
|||
senderDisplayName = notificationData.senderName ?: notificationData.senderId.value,
|
||||
roomAvatarUrl = notificationData.avatarUrl,
|
||||
notificationChannelId = notificationData.notificationChannelId,
|
||||
timestamp = notificationData.timestamp
|
||||
timestamp = notificationData.timestamp,
|
||||
textContent = notificationData.textContent,
|
||||
) ?: return
|
||||
runCatching {
|
||||
notificationManagerCompat.notify(
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ class DefaultElementCallEntryPointTest {
|
|||
avatarUrl = "avatarUrl",
|
||||
timestamp = 0,
|
||||
notificationChannelId = "notificationChannelId",
|
||||
textContent = "textContent",
|
||||
)
|
||||
|
||||
registerIncomingCallLambda.assertions().isCalledOnce()
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ class RingingCallNotificationCreatorTest {
|
|||
roomAvatarUrl = "https://example.com/avatar.jpg",
|
||||
notificationChannelId = "channelId",
|
||||
timestamp = 0L,
|
||||
textContent = "textContent",
|
||||
)
|
||||
|
||||
private fun createRingingCallNotificationCreator(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue