better fix of background task remain time

This commit is contained in:
Benjamin Reis 2018-03-02 13:46:55 +01:00
parent b97ecd8f7c
commit f3c381b56b
2 changed files with 6 additions and 4 deletions

View file

@ -2208,8 +2208,8 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
[[UIApplication sharedApplication] endBackgroundTask:pushBgTaskCall];
pushBgTaskCall = 0;
}];
LOGI(@"Call long running task started for call-id [%@], remaining [%g s] because a push has been received",
callId, [[UIApplication sharedApplication] backgroundTimeRemaining]);
LOGI(@"Call long running task started for call-id [%@], remaining [%@ s] because a push has been received",
callId, [LinphoneUtils intervalToString:[[UIApplication sharedApplication] backgroundTimeRemaining]]);
} else if ([loc_key isEqualToString:@"IC_SIL"]) {
[[UIApplication sharedApplication] endBackgroundTask:pushBgTaskRefer];
pushBgTaskRefer = 0;
@ -2225,8 +2225,8 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
[[UIApplication sharedApplication] endBackgroundTask:pushBgTaskRefer];
pushBgTaskRefer = 0;
}];
LOGI(@"Refer long running task started for call-id [%@], remaining [%g s] because a push has been received",
callId, [[UIApplication sharedApplication] backgroundTimeRemaining]);
LOGI(@"Refer long running task started for call-id [%@], remaining [%@ s] because a push has been received",
callId, [LinphoneUtils intervalToString:[[UIApplication sharedApplication] backgroundTimeRemaining]]);
}
}

View file

@ -76,6 +76,8 @@
+ (NSString *) intervalToString:(NSTimeInterval)interval {
NSDateComponentsFormatter *formatter = [[NSDateComponentsFormatter alloc] init];
formatter.allowedUnits = NSCalendarUnitSecond;
formatter.unitsStyle = NSDateComponentsFormatterUnitsStyleAbbreviated;
formatter.zeroFormattingBehavior = NSDateComponentsFormatterZeroFormattingBehaviorDropAll;
return [formatter stringFromTimeInterval:interval];
}