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