Skip to content

Commit

Permalink
Fix hang up bug
Browse files Browse the repository at this point in the history
  • Loading branch information
liviu-timar committed Sep 20, 2024
1 parent f163c62 commit 260d269
Showing 1 changed file with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,17 @@ public open class DefaultNotificationHandler(
val notificationId = callId.hashCode() // Notification ID

// Intents
val ongoingCallIntent = intentResolver.searchOngoingCallPendingIntent(
callId,
notificationId,
)
val onClickIntent = if (isOutgoingCall) {
intentResolver.searchOutgoingCallPendingIntent(
callId,
notificationId,
)
} else {
intentResolver.searchOngoingCallPendingIntent(
callId,
notificationId,
)
}
val hangUpIntent = if (isOutgoingCall) {
intentResolver.searchRejectCallPendingIntent(callId)
} else {
Expand Down Expand Up @@ -334,8 +341,8 @@ public open class DefaultNotificationHandler(
.setSmallIcon(notificationIconRes)
.also {
// If the intent is configured, clicking the notification will return to the call
if (ongoingCallIntent != null) {
it.setContentIntent(ongoingCallIntent)
if (onClickIntent != null) {
it.setContentIntent(onClickIntent)
} else {
logger.w { "Ongoing intent is null click on the ongoing call notification will not work." }
}
Expand Down Expand Up @@ -519,7 +526,7 @@ public open class DefaultNotificationHandler(
}

private fun NotificationCompat.Builder.addHangUpAction(
rejectCallPendingIntent: PendingIntent,
hangUpIntent: PendingIntent,
callDisplayName: String,
remoteParticipantCount: Int,
): NotificationCompat.Builder = apply {
Expand Down Expand Up @@ -548,15 +555,15 @@ public open class DefaultNotificationHandler(
}
}
.build(),
rejectCallPendingIntent,
hangUpIntent,
),
)
} else {
addAction(
NotificationCompat.Action.Builder(
null,
application.getString(R.string.stream_video_call_notification_action_leave),
rejectCallPendingIntent,
hangUpIntent,
).build(),
)
}
Expand Down

0 comments on commit 260d269

Please sign in to comment.