From 9fa089c2efbd45752430f28990def8af1c536ec6 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 17 Jan 2013 11:37:41 +0100 Subject: [PATCH] Dispose the call notification in LinphoneManager --- Classes/LinphoneManager.m | 26 +++++++++++++++----------- Classes/PhoneMainView.m | 11 ----------- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 860fa91b3..f466cd7ae 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -455,16 +455,7 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char } } } - - - if(state == LinphoneCallReleased) { - if(data != NULL) { - [data release]; - linphone_call_set_user_pointer(call, NULL); - } - } - - + // Disable speaker when no more call if ((state == LinphoneCallEnd || state == LinphoneCallError)) { if(linphone_core_get_calls_nb(theLinphoneCore) == 0) { @@ -474,7 +465,20 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char if (incallBgTask) { [[UIApplication sharedApplication] endBackgroundTask:incallBgTask]; incallBgTask=0; - } + } + if(data != nil && data->notification != nil) { + // cancel local notif if needed + [[UIApplication sharedApplication] cancelLocalNotification:data->notification]; + [data->notification release]; + data->notification = nil; + } + } + + if(state == LinphoneCallReleased) { + if(data != NULL) { + [data release]; + linphone_call_set_user_pointer(call, NULL); + } } // Enable speaker when video diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index 8392df26b..128e7bb79 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -288,7 +288,6 @@ static PhoneMainView* phoneMainViewInstance=nil; } case LinphoneCallEnd: { - [self dismissIncomingCall:call]; if (canHideInCallView) { // Go to dialer view DialerViewController *controller = DYNAMIC_CAST([self changeCurrentView:[DialerViewController compositeViewDescription]], DialerViewController); @@ -528,16 +527,6 @@ static PhoneMainView* phoneMainViewInstance=nil; [error release]; } -- (void)dismissIncomingCall:(LinphoneCall*)call { - LinphoneCallAppData* appData = (LinphoneCallAppData*) linphone_call_get_user_pointer(call); - - if(appData != nil && appData->notification != nil) { - // cancel local notif if needed - [[UIApplication sharedApplication] cancelLocalNotification:appData->notification]; - [appData->notification release]; - } -} - - (void)addInhibitedEvent:(id)event { [inhibitedEvents addObject:event]; }