scheduler
parent
cc4d4989a3
commit
5c275661ac
|
@ -45,7 +45,7 @@ pEpUpdater* updater = nil;
|
|||
|
||||
// Resuming the connection allows the system to deliver more incoming messages.
|
||||
[newConnection resume];
|
||||
|
||||
|
||||
// Returning YES from this method tells the system that you have accepted this connection. If you want to reject the connection for some reason, call -invalidate on the connection and return NO.
|
||||
NSLog(@"connection accepted");
|
||||
return YES;
|
||||
|
|
|
@ -25,11 +25,6 @@
|
|||
/// initializes the pEpUpdater
|
||||
- (id)init;
|
||||
|
||||
/// initializes the pEpUpdater
|
||||
///
|
||||
/// - parameter subscriber: object fulfilling the `pEpMacOSAdapterSubscriberProtocol`.
|
||||
- (id)initWithSubscriber:(pEpNotification*)subscriber;
|
||||
|
||||
/// schedules updates each 2 hours
|
||||
- (void)scheduleUpdates;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include "../../downloadclient/downloadclient.hh"
|
||||
|
||||
const double CYCLE = 7200.0; // 7200 seconds = 2 hours
|
||||
const double CYCLE = 7200; // 7200 seconds = 2 hours
|
||||
NSString* CONFIG_PATH = @"/Library/Application Support/pEp/Updater";
|
||||
|
||||
@implementation pEpUpdater
|
||||
|
@ -22,19 +22,7 @@ NSString* CONFIG_PATH = @"/Library/Application Support/pEp/Updater";
|
|||
if (self) {
|
||||
self.configPath = CONFIG_PATH;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithSubscriber:(pEpNotification*)subscriber
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.configPath = CONFIG_PATH;
|
||||
self.subscriber = subscriber;
|
||||
if (self.subscriber) {
|
||||
[_subscriber notifyDownload:ready withName:@"" withFilename:@""];
|
||||
}
|
||||
}
|
||||
[self scheduleUpdates];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -42,9 +30,11 @@ NSString* CONFIG_PATH = @"/Library/Application Support/pEp/Updater";
|
|||
{
|
||||
NSLog(@"schedule updates");
|
||||
|
||||
self.timer = [NSTimer scheduledTimerWithTimeInterval:CYCLE target:self
|
||||
selector:@selector(updateAll:)
|
||||
userInfo:nil repeats:YES];
|
||||
if (!self.timer) {
|
||||
self.timer = [NSTimer scheduledTimerWithTimeInterval:CYCLE target:self
|
||||
selector:@selector(updateAll:)
|
||||
userInfo:nil repeats:YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateAll:(NSTimer*)timer
|
||||
|
|
Loading…
Reference in New Issue