Add callback argument to start tracking method and hide reachability status changed block

This commit is contained in:
Sergey Abramchuk
2017-08-22 09:52:43 +03:00
parent cf678a5f24
commit eea832c876
2 changed files with 5 additions and 3 deletions

View File

@@ -13,11 +13,10 @@
@property (readonly, nonatomic) BOOL isTracking;
@property (readonly, nonatomic) OpenVPNReachabilityStatus reachabilityStatus;
@property (copy, nonatomic) void (^ _Nullable reachabilityStatusChangedBlock)(OpenVPNReachabilityStatus reachabilityStatus);
- (nonnull instancetype)init;
- (void)startTracking;
- (void)startTrackingWithCallback:(nullable void (^)(OpenVPNReachabilityStatus))callback;
- (void)stopTracking;
@end

View File

@@ -15,6 +15,7 @@
}
@property (assign, nonatomic) OpenVPNReachabilityTracker *reachabilityTracker;
@property (copy, nonatomic) void (^ reachabilityStatusChangedBlock)(OpenVPNReachabilityStatus);
@end
@@ -50,7 +51,9 @@
return self;
}
- (void)startTracking {
- (void)startTrackingWithCallback:(void (^)(OpenVPNReachabilityStatus))callback {
self.reachabilityStatusChangedBlock = callback;
dispatch_queue_t main = dispatch_get_main_queue();
dispatch_async(main, ^{
self.reachabilityTracker->reachability_tracker_schedule();