mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
-fix issue with « ghost » long running task.
-Remove user notification of missed called on call push notification as no relevant information can be displayed.
This commit is contained in:
parent
62d80ce36c
commit
721f724a74
2 changed files with 7 additions and 25 deletions
|
|
@ -441,7 +441,7 @@
|
|||
}
|
||||
|
||||
NSString *callId = [aps objectForKey:@"call-id"] ?: @"";
|
||||
if ([self addLongTaskIDforCallID:callId] && [UIApplication sharedApplication].applicationState != UIApplicationStateActive)
|
||||
if ([UIApplication sharedApplication].applicationState != UIApplicationStateActive && [self addLongTaskIDforCallID:callId])
|
||||
[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.
|
||||
|
|
|
|||
|
|
@ -2300,30 +2300,12 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
|
|||
[[UIApplication sharedApplication] endBackgroundTask:pushBgTaskCall];
|
||||
pushBgTaskCall = 0;
|
||||
pushBgTaskCall = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
|
||||
if ([UIApplication sharedApplication].applicationState != UIApplicationStateActive) {
|
||||
LOGW(@"Incomming call with call-id [%@] couldn't be received", callId);
|
||||
UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init];
|
||||
content.title = NSLocalizedString(@"Missed call", nil);
|
||||
content.body = NSLocalizedString(@"You have missed a call.", nil);
|
||||
content.categoryIdentifier = @"push_call";
|
||||
|
||||
UNNotificationRequest *req =
|
||||
[UNNotificationRequest requestWithIdentifier:@"push_call" content:content trigger:NULL];
|
||||
[[UNUserNotificationCenter currentNotificationCenter]
|
||||
addNotificationRequest:req
|
||||
withCompletionHandler:^(NSError *_Nullable error) {
|
||||
// Enable or disable features based on authorization.
|
||||
if (error) {
|
||||
LOGD(@"Error while adding notification request :");
|
||||
LOGD(error.description);
|
||||
}
|
||||
}];
|
||||
}
|
||||
for (NSString *key in [LinphoneManager.instance.pushDict allKeys]) {
|
||||
[LinphoneManager.instance.pushDict setValue:[NSNumber numberWithInt:0] forKey:key];
|
||||
}
|
||||
[[UIApplication sharedApplication] endBackgroundTask:pushBgTaskCall];
|
||||
pushBgTaskCall = 0;
|
||||
//does not make sens to notify user as we have no information on this missed called
|
||||
for (NSString *key in [LinphoneManager.instance.pushDict allKeys]) {
|
||||
[LinphoneManager.instance.pushDict setValue:[NSNumber numberWithInt:0] forKey:key];
|
||||
}
|
||||
[[UIApplication sharedApplication] endBackgroundTask:pushBgTaskCall];
|
||||
pushBgTaskCall = 0;
|
||||
}];
|
||||
LOGI(@"Call long running task started for call-id [%@], remaining [%@] because a push has been received",
|
||||
callId, [LinphoneUtils intervalToString:[[UIApplication sharedApplication] backgroundTimeRemaining]]);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue