Remove expiration class method and convert platform to class property

This commit is contained in:
Sergey Abramchuk 2017-04-30 23:51:24 +03:00
parent 7d9f0abe76
commit c05b7215eb
2 changed files with 10 additions and 20 deletions

View File

@ -98,6 +98,11 @@ NS_SWIFT_NAME(handle(logMessage:));
*/ */
@interface OpenVPNAdapter (Public) @interface OpenVPNAdapter (Public)
/**
Returns platform description
*/
@property (class, nonnull, readonly, nonatomic) NSString *platform;
/** /**
<#Description#> <#Description#>
*/ */
@ -124,16 +129,6 @@ NS_SWIFT_NAME(handle(logMessage:));
*/ */
@property (nonnull, readonly, nonatomic) OpenVPNInterfaceStats *interfaceStats; @property (nonnull, readonly, nonatomic) OpenVPNInterfaceStats *interfaceStats;
/**
Returns date/time of app expiration
*/
+ (nonnull NSDate *)expiration;
/**
Returns platform description
*/
+ (nonnull NSString *)platform;
/** /**
<#Description#> <#Description#>

View File

@ -128,6 +128,11 @@ NSString * const OpenVPNAdapterErrorEventKey = @"me.ss-abramchuk.openvpn-adapter
#pragma mark Properties #pragma mark Properties
+ (NSString *)platform {
std::string platform = OpenVPNClient::platform();
return [NSString stringWithUTF8String:platform.c_str()];
}
- (void)setDelegate:(id<OpenVPNAdapterDelegate>)delegate { - (void)setDelegate:(id<OpenVPNAdapterDelegate>)delegate {
_delegate = delegate; _delegate = delegate;
} }
@ -158,16 +163,6 @@ NSString * const OpenVPNAdapterErrorEventKey = @"me.ss-abramchuk.openvpn-adapter
return [[OpenVPNInterfaceStats alloc] initWithInterfaceStats:stats]; return [[OpenVPNInterfaceStats alloc] initWithInterfaceStats:stats];
} }
+ (NSDate *)expiration {
NSNumber *time = [NSNumber numberWithInteger:OpenVPNClient::app_expire()];
return [NSDate dateWithTimeIntervalSince1970:[time doubleValue]];
}
+ (NSString *)platform {
std::string platform = OpenVPNClient::platform();
return [NSString stringWithUTF8String:platform.c_str()];
}
#pragma mark Client Configuration #pragma mark Client Configuration
- (OpenVPNProperties *)applyConfiguration:(nonnull OpenVPNConfiguration *)configuration error:(out NSError * __nullable * __nullable)error { - (OpenVPNProperties *)applyConfiguration:(nonnull OpenVPNConfiguration *)configuration error:(out NSError * __nullable * __nullable)error {