Browse Source

scheduler

works_for_me
Volker Birk 2 years ago
parent
commit
5c275661ac
3 changed files with 8 additions and 23 deletions
  1. +1
    -1
      pEpMacOSAdapter/main.m
  2. +0
    -5
      pEpMacOSAdapter/pEpUpdater.h
  3. +7
    -17
      pEpMacOSAdapter/pEpUpdater.mm

+ 1
- 1
pEpMacOSAdapter/main.m View File

@ -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;


+ 0
- 5
pEpMacOSAdapter/pEpUpdater.h View File

@ -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;


+ 7
- 17
pEpMacOSAdapter/pEpUpdater.mm View File

@ -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…
Cancel
Save