From 4d05de7bc93441cc70027aa5589363fefeb5ad16 Mon Sep 17 00:00:00 2001 From: Paul Cartier Date: Wed, 1 Apr 2020 14:22:54 +0200 Subject: [PATCH] Temporary fix for notif song of chat room invite and chat room invite msg --- msgNotificationService/NotificationService.swift | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/msgNotificationService/NotificationService.swift b/msgNotificationService/NotificationService.swift index a85c9b278..7bf99b172 100644 --- a/msgNotificationService/NotificationService.swift +++ b/msgNotificationService/NotificationService.swift @@ -68,6 +68,7 @@ class NotificationService: UNNotificationServiceExtension { bestAttemptContent.body = chatRoom.subject } + bestAttemptContent.sound = UNNotificationSound(named: UNNotificationSoundName("msg.caf")) // TODO : temporary fix, to be removed after flexisip release contentHandler(bestAttemptContent) return } @@ -118,8 +119,15 @@ class NotificationService: UNNotificationServiceExtension { if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent { NSLog("[msgNotificationService] serviceExtensionTimeWillExpire") bestAttemptContent.categoryIdentifier = "app_active" - bestAttemptContent.title = NSLocalizedString("Message received", comment: "") - bestAttemptContent.body = NSLocalizedString("You have received a message.", comment: "") + + if let chatRoomInviteAddr = bestAttemptContent.userInfo["chat-room-addr"] as? String, !chatRoomInviteAddr.isEmpty { + bestAttemptContent.title = NSLocalizedString("You have been added to a chat room", comment: "") + bestAttemptContent.body = "" + bestAttemptContent.sound = UNNotificationSound(named: UNNotificationSoundName("msg.caf")) // TODO : temporary fix, to be removed after flexisip release + } else { + bestAttemptContent.title = NSLocalizedString("Message received", comment: "") + bestAttemptContent.body = NSLocalizedString("You have received a message.", comment: "") + } contentHandler(bestAttemptContent) } }