Skip to content

Commit

Permalink
Remove ios 17 special handling for bg tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
tmolitor-stud-tu committed Nov 19, 2023
1 parent 118b0bd commit 970a411
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions Monal/Classes/HelperTools.m
Original file line number Diff line number Diff line change
Expand Up @@ -1264,17 +1264,14 @@ +(void) scheduleBackgroundTask:(BOOL) force
}
else
{
if(@available(iOS 17.0, macCatalyst 17.0, *))
{
//cancel existing task (if any)
[BGTaskScheduler.sharedScheduler cancelTaskRequestWithIdentifier:kBackgroundRefreshingTask];
}
//cancel existing task (if any)
[BGTaskScheduler.sharedScheduler cancelTaskRequestWithIdentifier:kBackgroundRefreshingTask];
//new task
BGAppRefreshTaskRequest* refreshingRequest = [[BGAppRefreshTaskRequest alloc] initWithIdentifier:kBackgroundRefreshingTask];
//on ios<17 do the same like the corona warn app from germany which leads to this hint: https://developer.apple.com/forums/thread/134031
if(@available(iOS 17.0, macCatalyst 17.0, *))
refreshingRequest.earliestBeginDate = [NSDate dateWithTimeIntervalSinceNow:BGFETCH_DEFAULT_INTERVAL];
else
// if(@available(iOS 17.0, macCatalyst 17.0, *))
// refreshingRequest.earliestBeginDate = [NSDate dateWithTimeIntervalSinceNow:BGFETCH_DEFAULT_INTERVAL];
// else
refreshingRequest.earliestBeginDate = nil;
if(![[BGTaskScheduler sharedScheduler] submitTaskRequest:refreshingRequest error:&error])
{
Expand Down

0 comments on commit 970a411

Please sign in to comment.