|
|
@ -11,7 +11,7 @@ |
|
|
|
|
|
|
|
#include "../../downloadclient/downloadclient.hh" |
|
|
|
|
|
|
|
const double CYCLE = 7200; // 7200 seconds = 2 hours |
|
|
|
const double CYCLE = 7.2; // 7200 seconds = 2 hours |
|
|
|
NSString* CONFIG_PATH = @"/Library/Application Support/pEp/Updater"; |
|
|
|
|
|
|
|
@implementation pEpUpdater |
|
|
@ -27,20 +27,25 @@ NSString* CONFIG_PATH = @"/Library/Application Support/pEp/Updater"; |
|
|
|
|
|
|
|
- (void)scheduleUpdates |
|
|
|
{ |
|
|
|
NSLog(@"schedule updates"); |
|
|
|
|
|
|
|
if (!self.timer) { |
|
|
|
self.timer = [NSTimer scheduledTimerWithTimeInterval:CYCLE target:self |
|
|
|
selector:@selector(updateAll:) |
|
|
|
userInfo:nil repeats:YES]; |
|
|
|
NSLog(@"schedule updates"); |
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{ |
|
|
|
self.timer = [NSTimer scheduledTimerWithTimeInterval:CYCLE |
|
|
|
target:self |
|
|
|
selector:@selector(updateAll:) |
|
|
|
userInfo:nil |
|
|
|
repeats:YES]; |
|
|
|
}); |
|
|
|
} |
|
|
|
else { |
|
|
|
NSLog(@"timer already there"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
- (void)stopUpdates |
|
|
|
{ |
|
|
|
NSLog(@"stop auto updates"); |
|
|
|
|
|
|
|
if (self.timer) { |
|
|
|
NSLog(@"stop auto updates"); |
|
|
|
[self.timer invalidate]; |
|
|
|
self.timer = nil; |
|
|
|
} |
|
|
|