Fix repetition of UILocalNotif when app starts

This commit is contained in:
Benjamin Reis 2016-12-06 09:02:34 +01:00
parent 9b6194c32c
commit 1d2343fa2e

View file

@ -506,24 +506,25 @@
categories:categories];
[[UIApplication sharedApplication] registerUserNotificationSettings:set];
UILocalNotification *notif = [[UILocalNotification alloc] init];
if (notif) {
notif.repeatInterval = 0;
// UILocalNotification *notif = [[UILocalNotification alloc] init];
if (notification) {
notification.repeatInterval = 0;
if ([[UIDevice currentDevice].systemVersion floatValue] >= 8) {
#pragma deploymate push "ignored-api-availability"
notif.category = @"incoming_msg";
notification.category = @"incoming_msg";
#pragma deploymate pop
}
if ([LinphoneManager.instance lpConfigBoolForKey:@"show_msg_in_notif" withDefault:YES]) {
notif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"IM_FULLMSG", nil), from, chat];
notification.alertBody =
[NSString stringWithFormat:NSLocalizedString(@"IM_FULLMSG", nil), from, chat];
} else {
notif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"IM_MSG", nil), from];
notification.alertBody = [NSString stringWithFormat:NSLocalizedString(@"IM_MSG", nil), from];
}
notif.alertAction = NSLocalizedString(@"Show", nil);
notif.soundName = @"msg.caf";
notif.userInfo = @{ @"from" : from, @"from_addr" : remote_uri, @"call-id" : callID };
notif.accessibilityLabel = @"Message notif";
[[UIApplication sharedApplication] presentLocalNotificationNow:notif];
notification.alertAction = NSLocalizedString(@"Show", nil);
notification.soundName = @"msg.caf";
notification.userInfo = @{ @"from" : from, @"from_addr" : remote_uri, @"call-id" : callID };
notification.accessibilityLabel = @"Message notif";
[[UIApplication sharedApplication] presentLocalNotificationNow:notification];
}
} else {
UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init];