summaryrefslogtreecommitdiff
path: root/include/mbgl/platform/darwin/reachability.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/mbgl/platform/darwin/reachability.h')
-rw-r--r--include/mbgl/platform/darwin/reachability.h41
1 files changed, 12 insertions, 29 deletions
diff --git a/include/mbgl/platform/darwin/reachability.h b/include/mbgl/platform/darwin/reachability.h
index 1cf7d2ecea..0101b91d48 100644
--- a/include/mbgl/platform/darwin/reachability.h
+++ b/include/mbgl/platform/darwin/reachability.h
@@ -28,24 +28,6 @@
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
-#import <sys/socket.h>
-#import <netinet/in.h>
-#import <netinet6/in6.h>
-#import <arpa/inet.h>
-#import <ifaddrs.h>
-#import <netdb.h>
-
-/**
- * Does ARC support GCD objects?
- * It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
- *
- * @see http://opensource.apple.com/source/libdispatch/libdispatch-228.18/os/object.h
- **/
-#if OS_OBJECT_USE_OBJC
-#define NEEDS_DISPATCH_RETAIN_RELEASE 0
-#else
-#define NEEDS_DISPATCH_RETAIN_RELEASE 1
-#endif
/**
* Create NS_ENUM macro if it does not exist on the targeted version of iOS or OS X.
@@ -65,28 +47,29 @@ typedef NS_ENUM(NSInteger, NetworkStatus) {
ReachableViaWWAN = 1
};
-@class Reachability;
+@class MGLReachability;
+
+typedef void (^NetworkReachable)(MGLReachability * reachability);
+typedef void (^NetworkUnreachable)(MGLReachability * reachability);
-typedef void (^NetworkReachable)(Reachability * reachability);
-typedef void (^NetworkUnreachable)(Reachability * reachability);
-@interface Reachability : NSObject
+@interface MGLReachability : NSObject
@property (nonatomic, copy) NetworkReachable reachableBlock;
@property (nonatomic, copy) NetworkUnreachable unreachableBlock;
-
@property (nonatomic, assign) BOOL reachableOnWWAN;
-+(Reachability*)reachabilityWithHostname:(NSString*)hostname;
+
++(instancetype)reachabilityWithHostname:(NSString*)hostname;
// This is identical to the function above, but is here to maintain
//compatibility with Apples original code. (see .m)
-+(Reachability*)reachabilityWithHostName:(NSString*)hostname;
-+(Reachability*)reachabilityForInternetConnection;
-+(Reachability*)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress;
-+(Reachability*)reachabilityForLocalWiFi;
++(instancetype)reachabilityWithHostName:(NSString*)hostname;
++(instancetype)reachabilityForInternetConnection;
++(instancetype)reachabilityWithAddress:(void *)hostAddress;
++(instancetype)reachabilityForLocalWiFi;
--(Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref;
+-(instancetype)initWithReachabilityRef:(SCNetworkReachabilityRef)ref;
-(BOOL)startNotifier;
-(void)stopNotifier;