From 402ff3da1b45d32d70d9d4cbf027be8045b26dc7 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 31 Jan 2013 11:43:46 +0100 Subject: [PATCH] Go to history details on missed call notification --- Classes/LinphoneAppDelegate.m | 20 ++++++++++++++++++++ Classes/LinphoneManager.m | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index d2846823d..03910325c 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -226,6 +226,26 @@ if(controller != nil) { [controller setRemoteAddress:remoteContact]; } + } else if([notification.userInfo objectForKey:@"callLog"] != nil) { + NSString *callLog = (NSString*)[notification.userInfo objectForKey:@"callLog"]; + LinphoneCallLog* theLog = NULL; + const MSList * logs = linphone_core_get_call_logs([LinphoneManager getLc]); + while(logs != NULL) { + LinphoneCallLog* log = (LinphoneCallLog *) logs->data; + if([callLog isEqualToString:[NSString stringWithUTF8String:log->call_id]]) { + theLog = log; + break; + } + logs = logs->next; + } + if(theLog != NULL) { + // Go to HistoryDetails view + [[PhoneMainView instance] changeCurrentView:[HistoryViewController compositeViewDescription]]; + HistoryDetailsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[HistoryDetailsViewController compositeViewDescription] push:TRUE], HistoryDetailsViewController); + if(controller != nil) { + [controller setCallLog:theLog]; + } + } } } diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index e19f7f3e8..0fe37be17 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -480,7 +480,7 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char notification.repeatInterval = 0; notification.alertBody = [NSString stringWithFormat:NSLocalizedString(@"You miss %@ call", nil), address]; notification.alertAction = NSLocalizedString(@"Show", nil); - notification.userInfo = [NSDictionary dictionaryWithObject:[NSString stringWithUTF8String:log->call_id] forKey:@"callLog"]; + notification.userInfo = [NSDictionary dictionaryWithObject:[NSString stringWithUTF8String:log->call_id] forKey:@"callLog"]; [[UIApplication sharedApplication] presentLocalNotificationNow:notification]; [notification release]; }