Fix #1855 : don't use timer for local notification of linphone on iOS8.

This commit is contained in:
Guillaume BIENKOWSKI 2014-11-26 10:39:02 +01:00
parent f6ab749681
commit 84d13bfeb8

View file

@ -671,15 +671,20 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char
// Create a new local notification
data->notification = [[UILocalNotification alloc] init];
if (data->notification) {
data->timer = [NSTimer scheduledTimerWithTimeInterval:4.0 target:self selector:@selector(localNotifContinue:) userInfo:data->notification repeats:TRUE];
// iOS8 doesn't need the timer trick for the local notification.
if( [[UIDevice currentDevice].systemVersion floatValue] >= 8){
data->notification.soundName = @"ring.caf";
data->notification.category = @"incoming_call";
} else {
data->notification.soundName = @"shortring.caf";
data->timer = [NSTimer scheduledTimerWithTimeInterval:4.0 target:self selector:@selector(localNotifContinue:) userInfo:data->notification repeats:TRUE];
}
data->notification.repeatInterval = 0;
if( [[UIDevice currentDevice].systemVersion floatValue] >= 8){
data->notification.category = @"incoming_call";
}
data->notification.alertBody =[NSString stringWithFormat:NSLocalizedString(@"IC_MSG",nil), address];
data->notification.alertAction = NSLocalizedString(@"Answer", nil);
data->notification.soundName = @"shortring.caf";
data->notification.userInfo = @{@"callId": callId, @"timer":[NSNumber numberWithInt:1] };
data->notification.applicationIconBadgeNumber = 1;
@ -692,7 +697,9 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char
incallBgTask=0;
}];
[[NSRunLoop currentRunLoop] addTimer:data->timer forMode:NSRunLoopCommonModes];
if( data->timer ){
[[NSRunLoop currentRunLoop] addTimer:data->timer forMode:NSRunLoopCommonModes];
}
}
}