|
|
@ -15,21 +15,15 @@ static const double CYCLE = 7200.0; // 7200 seconds = 2 hours |
|
|
|
|
|
|
|
@implementation pEpUpdater |
|
|
|
|
|
|
|
pEpNotification* _subscriber = nil; |
|
|
|
|
|
|
|
- (id)initWithSubscriber:(pEpNotification*)subscriber |
|
|
|
{ |
|
|
|
self = [super init]; |
|
|
|
self.configPath = @"/Library/Application Support/pEp/Updater"; |
|
|
|
_subscriber = subscriber; |
|
|
|
self.subscriber = subscriber; |
|
|
|
[_subscriber notifyDownload:ready withName:@"" withFilename:@""]; |
|
|
|
return self; |
|
|
|
} |
|
|
|
|
|
|
|
- (void)setNewSubscriber:(pEpNotification*)subscriber |
|
|
|
{ |
|
|
|
_subscriber = subscriber; |
|
|
|
} |
|
|
|
|
|
|
|
- (void)scheduleUpdates |
|
|
|
{ |
|
|
|
NSLog(@"schedule updates"); |
|
|
@ -101,9 +95,10 @@ pEpNotification* _subscriber = nil; |
|
|
|
std::string _filename; |
|
|
|
|
|
|
|
pEp::notifyRead_t notifyRead = [=]()->void{ |
|
|
|
if (_subscriber) { |
|
|
|
[_subscriber notifyDownload:downloading withName:name withFilename:nil]; |
|
|
|
} |
|
|
|
NSLog(@"downloading: %@", name); |
|
|
|
// if (_subscriber) { |
|
|
|
// [_subscriber notifyDownload:(int)downloading withName:name withFilename:@""]; |
|
|
|
// } |
|
|
|
}; |
|
|
|
|
|
|
|
try { |
|
|
@ -115,14 +110,14 @@ pEpNotification* _subscriber = nil; |
|
|
|
[localFileManager changeCurrentDirectoryPath:cwd]; |
|
|
|
|
|
|
|
NSLog(@"download arrived %@", download); |
|
|
|
|
|
|
|
if (_subscriber) { |
|
|
|
[_subscriber notifyDownload:downloadArrived withName:name withFilename:download]; |
|
|
|
[_subscriber notifyDownload:(int)downloadArrived withName:name withFilename:download]; |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
NSLog(@"no download available for %@", name); |
|
|
|
if (_subscriber) { |
|
|
|
[_subscriber notifyDownload:noDownloadAvailable withName:name withFilename:nil]; |
|
|
|
[_subscriber notifyDownload:(int)noDownloadAvailable withName:name withFilename:@""]; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|