From 9bbd554547cd0da6db5a465aef00e2d9b2c5cf81 Mon Sep 17 00:00:00 2001 From: Benoit Martins Date: Fri, 4 Oct 2024 11:28:02 +0200 Subject: [PATCH] Check if chatRoom.peerAddress is not nil in didReceive NotificationService --- msgNotificationService/NotificationService.swift | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/msgNotificationService/NotificationService.swift b/msgNotificationService/NotificationService.swift index 98b2b210e..d8e77cbc8 100644 --- a/msgNotificationService/NotificationService.swift +++ b/msgNotificationService/NotificationService.swift @@ -125,10 +125,16 @@ class NotificationService: UNNotificationServiceExtension { Log.info("chat room invite received") bestAttemptContent.title = NSLocalizedString("GC_MSG", comment: "") if chatRoom.hasCapability(mask: ChatRoom.Capabilities.OneToOne.rawValue) { - if chatRoom.peerAddress?.displayName?.isEmpty != true { - bestAttemptContent.body = chatRoom.peerAddress!.displayName! + if chatRoom.peerAddress != nil { + if chatRoom.peerAddress!.displayName != nil && chatRoom.peerAddress!.displayName!.isEmpty != true { + bestAttemptContent.body = chatRoom.peerAddress!.displayName! + } else if chatRoom.peerAddress!.username != nil { + bestAttemptContent.body = chatRoom.peerAddress!.username! + } else { + bestAttemptContent.body = "Peer Address Error" + } } else { - bestAttemptContent.body = chatRoom.peerAddress!.username! + bestAttemptContent.body = "Peer Address Error" } } else { bestAttemptContent.body = chatRoom.subject!