X-Git-Url: https://git.saurik.com/cydia.git/blobdiff_plain/982de8f1982682fd25dba3df23a8c07cb4f664dc..d7a235a65e829223521738d675148c64a7de577e:/Cydia.mm diff --git a/Cydia.mm b/Cydia.mm index 8c5d8b8d..090823dd 100644 --- a/Cydia.mm +++ b/Cydia.mm @@ -59,6 +59,8 @@ #include #include +#include + #include #include "iPhonePrivate.h" @@ -119,12 +121,8 @@ extern "C" { #include #include "UICaboodle/BrowserView.h" -#include "UICaboodle/ResetView.h" #include "substrate.h" - -// Apple's sample Reachability code, ASPL licensed. -#include "Reachability.h" /* }}} */ /* Profiler {{{ */ @@ -1215,7 +1213,7 @@ bool isSectionVisible(NSString *section) { - (void) showSettings; - (UIProgressHUD *) addProgressHUD; - (void) removeProgressHUD:(UIProgressHUD *)hud; -- (UCViewController *) pageForPackage:(NSString *)name; +- (CYViewController *) pageForPackage:(NSString *)name; - (PackageController *) packageController; - (void) showActionSheet:(UIActionSheet *)sheet fromItem:(UIBarButtonItem *)item; @end @@ -3864,14 +3862,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { @end /* }}} */ -/* Cydia View Controller {{{ */ -@interface CYViewController : UCViewController { } -@end - -@implementation CYViewController -@end -/* }}} */ - +/* Cydia Browser Controller {{{ */ @interface CYBrowserController : BrowserController { CydiaObject *cydia_; } @@ -3961,7 +3952,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { } @end +/* }}} */ +/* Confirmation {{{ */ @protocol ConfirmationControllerDelegate - (void) cancelAndClear:(bool)clear; - (void) confirmWithNavigationController:(UINavigationController *)navigation; @@ -7652,8 +7645,7 @@ freeing the view controllers on tab change */ } - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation { - // XXX: this should be a compile-time flag - return YES; + return IsWildcat_; } - (void) setTabBarController:(UITabBarController *)controller { @@ -7879,8 +7871,8 @@ typedef enum { bool loaded_; } -- (UCViewController *) _pageForURL:(NSURL *)url withClass:(Class)_class; -- (void) setPage:(UCViewController *)page; +- (CYViewController *) _pageForURL:(NSURL *)url withClass:(Class)_class; +- (void) setPage:(CYViewController *)page; - (void) loadData; @end @@ -7979,10 +7971,25 @@ static _finline void _setHomePage(Cydia *self) { - (void) _refreshIfPossible { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - Reachability* reachability = [Reachability reachabilityWithHostName:@"cydia.saurik.com"]; - NetworkStatus remoteHostStatus = [reachability currentReachabilityStatus]; + SCNetworkReachabilityFlags flags; { + SCNetworkReachabilityRef reachability(SCNetworkReachabilityCreateWithName(NULL, "cydia.saurik.com")); + 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? + bool reachable( + (flags & kSCNetworkReachabilityFlagsReachable) != 0 && ( + (flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0 || ( + (flags & kSCNetworkReachabilityFlagsConnectionOnDemand) != 0 || + (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0 + ) && (flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0 || + (flags & kSCNetworkReachabilityFlagsIsWWAN) != 0 + ) + ); - if (loaded_ || ManualRefresh || remoteHostStatus == NotReachable) loaded: + if (loaded_ || ManualRefresh || !reachable) loaded: [self performSelectorOnMainThread:@selector(_loaded) withObject:nil waitUntilDone:NO]; else { loaded_ = true; @@ -8203,7 +8210,7 @@ static _finline void _setHomePage(Cydia *self) { [self complete]; } -- (void) setPage:(UCViewController *)page { +- (void) setPage:(CYViewController *)page { [page setDelegate:self]; CYNavigationController *navController = (CYNavigationController *) [tabbar_ selectedViewController]; @@ -8213,7 +8220,7 @@ static _finline void _setHomePage(Cydia *self) { } } -- (UCViewController *) _pageForURL:(NSURL *)url withClass:(Class)_class { +- (CYViewController *) _pageForURL:(NSURL *)url withClass:(Class)_class { CYBrowserController *browser = [[[_class alloc] init] autorelease]; [browser loadURL:url]; return browser; @@ -8442,7 +8449,7 @@ static _finline void _setHomePage(Cydia *self) { [window_ setUserInteractionEnabled:YES]; } -- (UCViewController *) pageForPackage:(NSString *)name { +- (CYViewController *) pageForPackage:(NSString *)name { if (Package *package = [database_ packageWithName:name]) { PackageController *view([self packageController]); [view setPackage:package]; @@ -8454,7 +8461,7 @@ static _finline void _setHomePage(Cydia *self) { } } -- (UCViewController *) pageForURL:(NSURL *)url hasTag:(int *)tag { +- (CYViewController *) pageForURL:(NSURL *)url hasTag:(int *)tag { if (tag != NULL) *tag = -1; @@ -8506,7 +8513,7 @@ static _finline void _setHomePage(Cydia *self) { - (void) applicationOpenURL:(NSURL *)url { [super applicationOpenURL:url]; int tag; - if (UCViewController *page = [self pageForURL:url hasTag:&tag]) { + if (CYViewController *page = [self pageForURL:url hasTag:&tag]) { [self setPage:page]; tag_ = tag; [tabbar_ setSelectedViewController:(tag_ == -1 ? nil : [[tabbar_ viewControllers] objectAtIndex:tag_])];