mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
ignore push notification not intented for us
This commit is contained in:
parent
9fc5ce5a59
commit
f9c497cdd2
1 changed files with 11 additions and 4 deletions
|
|
@ -371,25 +371,32 @@
|
|||
}
|
||||
|
||||
NSString *loc_key = [aps objectForKey:@"loc-key"] ?: [[aps objectForKey:@"alert"] objectForKey:@"loc-key"];
|
||||
NSString *callId = [aps objectForKey:@"call-id"] ?: @"";
|
||||
if (!loc_key) {
|
||||
LOGE(@"Notification [%p] has no loc_key, it's impossible to process it.", userInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *uuid = [NSString stringWithFormat:@"<urn:uuid:%@>", [LinphoneManager.instance lpConfigStringForKey:@"uuid" inSection:@"misc" withDefault:NULL]];
|
||||
NSString *sipInstance = [aps objectForKey:@"uuid"];
|
||||
if (sipInstance && uuid && ![sipInstance isEqualToString:uuid]) {
|
||||
LOGE(@"Notification [%p] was intended for another device, ignoring it.", userInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *callId = [aps objectForKey:@"call-id"] ?: @"";
|
||||
if ([self addLongTaskIDforCallID:callId] && [UIApplication sharedApplication].applicationState != UIApplicationStateActive)
|
||||
[LinphoneManager.instance startPushLongRunningTask:loc_key callId:callId];
|
||||
|
||||
// if we receive a push notification, it is probably because our TCP background socket was no more working.
|
||||
// As a result, break it and refresh registers in order to make sure to receive incoming INVITE or MESSAGE
|
||||
if (!linphone_core_is_network_reachable(LC)) {
|
||||
LOGI(@"Notification [%p]: network is down, restarting it.", userInfo);
|
||||
LinphoneManager.instance.connectivity = none; //Force connectivity to be discovered again
|
||||
LOGI(@"Notification [%p] network is down, restarting it.", userInfo);
|
||||
LinphoneManager.instance.connectivity = none; // Force connectivity to be discovered again
|
||||
[LinphoneManager.instance setupNetworkReachabilityCallback];
|
||||
}
|
||||
|
||||
if ([callId isEqualToString:@""]) {
|
||||
//Present apn pusher notifications for info
|
||||
// Present apn pusher notifications for info
|
||||
LOGD(@"Notification [%p] came from flexisip-pusher.", userInfo);
|
||||
if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_9_x_Max) {
|
||||
UNMutableNotificationContent* content = [[UNMutableNotificationContent alloc] init];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue