Tapping on message and missed call notification with app not started navigation

This commit is contained in:
Christophe Deschamps 2024-02-13 13:25:13 +01:00
parent d70c60d5fa
commit b5f9daba55
3 changed files with 13 additions and 1 deletions

View file

@ -282,7 +282,6 @@
intentIdentifiers:[[NSMutableArray alloc] init] intentIdentifiers:[[NSMutableArray alloc] init]
options:UNNotificationCategoryOptionCustomDismissAction]; options:UNNotificationCategoryOptionCustomDismissAction];
[UNUserNotificationCenter currentNotificationCenter].delegate = self;
NSSet *categories = [NSSet setWithObjects:cat_call, cat_msg, video_call, cat_zrtp, nil]; NSSet *categories = [NSSet setWithObjects:cat_call, cat_msg, video_call, cat_zrtp, nil];
[[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:categories]; [[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:categories];
@ -295,6 +294,7 @@
[FIRApp configure]; [FIRApp configure];
#endif #endif
[UNUserNotificationCenter currentNotificationCenter].delegate = self;
if ([VFSUtil vfsEnabledWithGroupName:kLinphoneMsgNotificationAppGroupId]) { if ([VFSUtil vfsEnabledWithGroupName:kLinphoneMsgNotificationAppGroupId]) {
if (TARGET_IPHONE_SIMULATOR) { if (TARGET_IPHONE_SIMULATOR) {
@ -611,6 +611,15 @@
withCompletionHandler:(void (^)(void))completionHandler { withCompletionHandler:(void (^)(void))completionHandler {
LOGD(@"UN : response received"); LOGD(@"UN : response received");
LOGD(response.description); 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"]; NSString *callId = (NSString *)[response.notification.request.content.userInfo objectForKey:@"CallId"];
if (!callId) if (!callId)

View file

@ -408,6 +408,8 @@
sideMenu:(NSNumber *)sideMenu sideMenu:(NSNumber *)sideMenu
fullscreen:(NSNumber *)fullscreen { fullscreen:(NSNumber *)fullscreen {
currentOrientation = [self getCorrectInterfaceOrientation:[[UIDevice currentDevice] orientation]];
UIViewController *oldMainViewController = self.mainViewController; UIViewController *oldMainViewController = self.mainViewController;
UIViewController *oldDetailsViewController = self.detailsViewController; UIViewController *oldDetailsViewController = self.detailsViewController;
UIViewController *oldStatusBarViewController = self.statusBarViewController; UIViewController *oldStatusBarViewController = self.statusBarViewController;

View file

@ -684,6 +684,7 @@ import AVFoundation
let content = UNMutableNotificationContent() let content = UNMutableNotificationContent()
content.title = NSString.localizedUserNotificationString(forKey: NSLocalizedString("Missed call", comment: ""), arguments: nil) content.title = NSString.localizedUserNotificationString(forKey: NSLocalizedString("Missed call", comment: ""), arguments: nil)
content.body = NSString.localizedUserNotificationString(forKey: displayName, arguments: nil) content.body = NSString.localizedUserNotificationString(forKey: displayName, arguments: nil)
content.userInfo = ["missed_call" : true]
// Deliver the notification. // Deliver the notification.
let request = UNNotificationRequest(identifier: "call_request", content: content, trigger: nil) // Schedule the notification. let request = UNNotificationRequest(identifier: "call_request", content: content, trigger: nil) // Schedule the notification.