Skip to content

Commit

Permalink
whatsapp call null coalesce
Browse files Browse the repository at this point in the history
  • Loading branch information
crc-32 committed Sep 11, 2024
1 parent c5bf2c6 commit abf0601
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import android.service.notification.StatusBarNotification

class WhatsAppCallNotificationInterpreter: CallNotificationInterpreter {
override fun processCallNotification(sbn: StatusBarNotification): CallNotification? {
val acceptAction = sbn.notification.actions.firstOrNull { it.title.toString().contains("Answer", true) }
val declineAction = sbn.notification.actions.firstOrNull { it.title.toString().contains("Decline", true) }
val hangUpAction = sbn.notification.actions.firstOrNull { it.title.toString().contains("Hang up", true) }
val acceptAction = sbn.notification.actions?.firstOrNull { it.title.toString().contains("Answer", true) }
val declineAction = sbn.notification.actions?.firstOrNull { it.title.toString().contains("Decline", true) }
val hangUpAction = sbn.notification.actions?.firstOrNull { it.title.toString().contains("Hang up", true) }

if (acceptAction != null && declineAction != null) {
val contactName = sbn.notification.extras.getCharSequence("android.title")?.toString()?.let {
Expand Down

0 comments on commit abf0601

Please sign in to comment.