]> git.saurik.com Git - cydia.git/commitdiff
Rename IsReachable to CyteIsReachable, in CyteKit.
authorJay Freeman (saurik) <saurik@saurik.com>
Sun, 5 Mar 2017 05:06:59 +0000 (21:06 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Sun, 5 Mar 2017 05:06:59 +0000 (21:06 -0800)
CyteKit/extern.h
CyteKit/extern.mm
MobileCydia.mm

index c7bc270a7300f4c0235c5edae7b3faccf53ef714..12d043844883a4a59adfed4f0e3d3bdab73c6434 100644 (file)
@@ -27,4 +27,6 @@
 extern bool IsWildcat_;
 extern CGFloat ScreenScale_;
 
+bool CyteIsReachable(const char *name);
+
 #endif//CyteKit_extern_H
index c1dc806ac07c92c6a7902778624ba2cc20c72bb3..cb8927a25807b0d475e6c7028c2f78b57c54c7e6 100644 (file)
 /* }}} */
 
 #include <CyteKit/extern.h>
+
+#include <SystemConfiguration/SystemConfiguration.h>
 #include <UIKit/UIKit.h>
 
 bool IsWildcat_;
 CGFloat ScreenScale_;
 
+bool CyteIsReachable(const char *name) {
+    SCNetworkReachabilityFlags flags; {
+        SCNetworkReachabilityRef reachability(SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, name));
+        SCNetworkReachabilityGetFlags(reachability, &flags);
+        CFRelease(reachability);
+    }
+
+    // XXX: this elaborate mess is what Apple is using to determine this? :(
+    // XXX: do we care if the user has to intervene? maybe that's ok?
+    return
+        (flags & kSCNetworkReachabilityFlagsReachable) != 0 && (
+            (flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0 || (
+                (flags & kSCNetworkReachabilityFlagsConnectionOnDemand) != 0 ||
+                (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0
+            ) && (flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0 ||
+            (flags & kSCNetworkReachabilityFlagsIsWWAN) != 0
+        )
+    ;
+}
+
 __attribute__((__constructor__))
 void CyteKit_extern() {
     UIScreen *screen([UIScreen mainScreen]);
index a661436d678da059a7f011b261fef5a026ec8b50..9c2b524e9ed7ec153f7a459671d6f6c164a0dec2 100644 (file)
@@ -258,26 +258,6 @@ static NSString *UniqueIdentifier(UIDevice *device = nil) {
         return [(id)$MGCopyAnswer(CFSTR("UniqueDeviceID")) autorelease];
 }
 
-static bool IsReachable(const char *name) {
-    SCNetworkReachabilityFlags flags; {
-        SCNetworkReachabilityRef reachability(SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, name));
-        SCNetworkReachabilityGetFlags(reachability, &flags);
-        CFRelease(reachability);
-    }
-
-    // XXX: this elaborate mess is what Apple is using to determine this? :(
-    // XXX: do we care if the user has to intervene? maybe that's ok?
-    return
-        (flags & kSCNetworkReachabilityFlagsReachable) != 0 && (
-            (flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0 || (
-                (flags & kSCNetworkReachabilityFlagsConnectionOnDemand) != 0 ||
-                (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0
-            ) && (flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0 ||
-            (flags & kSCNetworkReachabilityFlagsIsWWAN) != 0
-        )
-    ;
-}
-
 static const NSUInteger UIViewAutoresizingFlexibleBoth(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
 
 static _finline NSString *CydiaURL(NSString *path) {
@@ -4766,7 +4746,7 @@ class CydiaLogCleaner :
 }
 
 - (NSNumber *) isReachable:(NSString *)name {
-    return [NSNumber numberWithBool:IsReachable([name UTF8String])];
+    return [NSNumber numberWithBool:CyteIsReachable([name UTF8String])];
 }
 
 - (void) installPackages:(NSArray *)packages {
@@ -8800,7 +8780,7 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi
 }
 
 - (bool) requestUpdate {
-    if (IsReachable("cydia.saurik.com")) {
+    if (CyteIsReachable("cydia.saurik.com")) {
         [self beginUpdate];
         return true;
     } else {
@@ -8913,7 +8893,7 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi
     //  - We already auto-refreshed this launch.
     //  - Auto-refresh is disabled.
     //  - Cydia's server is not reachable
-    if (recently || loaded_ || ManualRefresh || !IsReachable("cydia.saurik.com")) {
+    if (recently || loaded_ || ManualRefresh || !CyteIsReachable("cydia.saurik.com")) {
         // If we are cancelling, we need to make sure it knows it's already loaded.
         loaded_ = true;
 
@@ -9540,7 +9520,7 @@ _end
     }
 
     if (interval <= -(15*60)) {
-        if (IsReachable("cydia.saurik.com")) {
+        if (CyteIsReachable("cydia.saurik.com")) {
             [tabbar_ beginUpdate];
             [appcache_ reloadURLWithCache:YES];
         }