C++ bridge
parent
027deb1e65
commit
15e0b1216d
@ -1,31 +0,0 @@
|
||||
//
|
||||
// pEpUpdater.m
|
||||
// pEpMacOSAdapter
|
||||
//
|
||||
// Created by Volker Birk on 26.05.20.
|
||||
// Copyright © 2020 p≡p foundation. All rights reserved.
|
||||
//
|
||||
|
||||
#import "pEpUpdater.h"
|
||||
|
||||
@implementation pEpUpdater
|
||||
|
||||
const double CYCLE = 7200.0;
|
||||
|
||||
-(id)init
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
if (self) {
|
||||
[NSTimer scheduledTimerWithTimeInterval:CYCLE target:self selector:@selector(updateAll:) userInfo:nil repeats:YES];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)updateAll:(NSTimer*)timer
|
||||
{
|
||||
// update all registered products
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,54 @@
|
||||
//
|
||||
// pEpUpdater.m
|
||||
// pEpMacOSAdapter
|
||||
//
|
||||
// Created by Volker Birk on 26.05.20.
|
||||
// Copyright © 2020 p≡p foundation. All rights reserved.
|
||||
//
|
||||
|
||||
#import "pEpUpdater.h"
|
||||
#include "../../downloadclient/downloadclient.hh"
|
||||
|
||||
@implementation pEpUpdater
|
||||
|
||||
const double CYCLE = 7200.0; // 7200 seconds = 2 hours
|
||||
NSString* configPath = @"/Library/Application Support/pEp/Updater";
|
||||
|
||||
-(id)init
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
if (self) {
|
||||
[NSTimer scheduledTimerWithTimeInterval:CYCLE target:self selector:@selector(updateAll:) userInfo:nil repeats:YES];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)updateAll:(NSTimer*)timer
|
||||
{
|
||||
// update all registered products
|
||||
|
||||
NSFileManager *localFileManager=[[NSFileManager alloc] init];
|
||||
NSDirectoryEnumerator *dirEnum = [localFileManager enumeratorAtPath:configPath];
|
||||
|
||||
NSString *configFile;
|
||||
while (dirEnum && (configFile = [dirEnum nextObject])) {
|
||||
if ([[configFile pathExtension] isEqualToString: @"plist"]) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-(void)update:(NSString*)name usingUrl:(NSString*)url
|
||||
{
|
||||
pEp::UpdateClient::product p = { name.UTF8String, url.UTF8String };
|
||||
std::string keyfile = name.UTF8String;
|
||||
keyfile += ".der";
|
||||
try {
|
||||
pEp::UpdateClient::update(p, keyfile);
|
||||
}
|
||||
catch (std::exception&) { }
|
||||
}
|
||||
|
||||
@end
|
Loading…
Reference in New Issue