mirror of
https://github.com/deneraraujo/OpenVPNAdapter.git
synced 2026-04-06 00:00:03 +08:00
Add isTracking property
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
@interface OpenVPNReachability : NSObject
|
@interface OpenVPNReachability : NSObject
|
||||||
|
|
||||||
|
@property (readonly, nonatomic) BOOL isTracking;
|
||||||
@property (readonly, nonatomic) OpenVPNReachabilityStatus reachabilityStatus;
|
@property (readonly, nonatomic) OpenVPNReachabilityStatus reachabilityStatus;
|
||||||
@property (copy, nonatomic) void (^ _Nullable reachabilityStatusChangedBlock)(OpenVPNReachabilityStatus reachabilityStatus);
|
@property (copy, nonatomic) void (^ _Nullable reachabilityStatusChangedBlock)(OpenVPNReachabilityStatus reachabilityStatus);
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#import "OpenVPNReachability+Internal.h"
|
#import "OpenVPNReachability+Internal.h"
|
||||||
|
|
||||||
@interface OpenVPNReachability () {
|
@interface OpenVPNReachability () {
|
||||||
|
BOOL _isTracking;
|
||||||
OpenVPNReachabilityStatus _reachabilityStatus;
|
OpenVPNReachabilityStatus _reachabilityStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,6 +31,10 @@
|
|||||||
|
|
||||||
@implementation OpenVPNReachability
|
@implementation OpenVPNReachability
|
||||||
|
|
||||||
|
- (BOOL)isTracking {
|
||||||
|
return _isTracking;
|
||||||
|
}
|
||||||
|
|
||||||
- (OpenVPNReachabilityStatus)reachabilityStatus {
|
- (OpenVPNReachabilityStatus)reachabilityStatus {
|
||||||
return _reachabilityStatus;
|
return _reachabilityStatus;
|
||||||
}
|
}
|
||||||
@@ -37,6 +42,9 @@
|
|||||||
- (nonnull instancetype)init {
|
- (nonnull instancetype)init {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
|
_isTracking = NO;
|
||||||
|
_reachabilityStatus = OpenVPNReachabilityStatusNotReachable;
|
||||||
|
|
||||||
self.reachabilityTracker = new OpenVPNReachabilityTracker(true, false, (__bridge void *)self);
|
self.reachabilityTracker = new OpenVPNReachabilityTracker(true, false, (__bridge void *)self);
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
@@ -47,6 +55,7 @@
|
|||||||
dispatch_sync(main, ^{
|
dispatch_sync(main, ^{
|
||||||
self.reachabilityTracker->reachability_tracker_schedule();
|
self.reachabilityTracker->reachability_tracker_schedule();
|
||||||
});
|
});
|
||||||
|
_isTracking = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)stopTracking {
|
- (void)stopTracking {
|
||||||
@@ -54,6 +63,7 @@
|
|||||||
dispatch_sync(main, ^{
|
dispatch_sync(main, ^{
|
||||||
self.reachabilityTracker->reachability_tracker_cancel();
|
self.reachabilityTracker->reachability_tracker_cancel();
|
||||||
});
|
});
|
||||||
|
_isTracking = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
|
|||||||
Reference in New Issue
Block a user