From 85ebe742cba385b1dd10e9a6180784875c58479b Mon Sep 17 00:00:00 2001 From: Christophe Deschamps Date: Tue, 13 Feb 2024 13:06:46 +0100 Subject: [PATCH] Open call history when tapping on a missed call notification --- Classes/LinphoneAppDelegate.m | 8 ++++++++ Classes/Swift/CallManager.swift | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 5f1869cbf..5df5b27b7 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -613,6 +613,14 @@ LOGD(@"UN : response received"); LOGD(response.description); + + if (![response.actionIdentifier isEqualToString:@"com.apple.UNNotificationDismissActionIdentifier"] && + [response.notification.request.content.userInfo objectForKey:@"missed_call"]) { + [PhoneMainView.instance changeCurrentView:VIEW(HistoryListView).compositeViewDescription]; + [PhoneMainView.instance.mainViewController didRotateFromInterfaceOrientation:PhoneMainView.instance.mainViewController.currentOrientation]; + return; + } + startedInBackground = true; NSString *callId = (NSString *)[response.notification.request.content.userInfo objectForKey:@"CallId"]; diff --git a/Classes/Swift/CallManager.swift b/Classes/Swift/CallManager.swift index 565553c8e..0a9398b6e 100644 --- a/Classes/Swift/CallManager.swift +++ b/Classes/Swift/CallManager.swift @@ -686,7 +686,7 @@ import AVFoundation let content = UNMutableNotificationContent() content.title = NSString.localizedUserNotificationString(forKey: NSLocalizedString("Missed call", comment: ""), arguments: nil) content.body = NSString.localizedUserNotificationString(forKey: displayName, arguments: nil) - + content.userInfo = ["missed_call" : true] // Deliver the notification. let request = UNNotificationRequest(identifier: "call_request", content: content, trigger: nil) // Schedule the notification. let center = UNUserNotificationCenter.current()