/* }}} */
#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]);
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) {
}
- (NSNumber *) isReachable:(NSString *)name {
- return [NSNumber numberWithBool:IsReachable([name UTF8String])];
+ return [NSNumber numberWithBool:CyteIsReachable([name UTF8String])];
}
- (void) installPackages:(NSArray *)packages {
}
- (bool) requestUpdate {
- if (IsReachable("cydia.saurik.com")) {
+ if (CyteIsReachable("cydia.saurik.com")) {
[self beginUpdate];
return true;
} else {
// - 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;
}
if (interval <= -(15*60)) {
- if (IsReachable("cydia.saurik.com")) {
+ if (CyteIsReachable("cydia.saurik.com")) {
[tabbar_ beginUpdate];
[appcache_ reloadURLWithCache:YES];
}