From: Jay Freeman (saurik) Date: Sun, 5 Feb 2012 05:04:24 +0000 (-0800) Subject: Merge branch 'master' of git.saurik.com:cydia X-Git-Tag: v1.1.5~10 X-Git-Url: https://git.saurik.com/cydia.git/commitdiff_plain/1ad8f469df0494b7b2071fb889d30f232b9a34e3?hp=-c Merge branch 'master' of git.saurik.com:cydia --- 1ad8f469df0494b7b2071fb889d30f232b9a34e3 diff --combined MobileCydia.mm index 8b8a406d,df2b9889..cdce7c5b --- a/MobileCydia.mm +++ b/MobileCydia.mm @@@ -262,8 -262,6 +262,8 @@@ static NSString *Warning_ static bool AprilFools_; +static void (*$SBSSetInterceptsMenuButtonForever)(bool); + static bool IsReachable(const char *name) { SCNetworkReachabilityFlags flags; { SCNetworkReachabilityRef reachability(SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, name)); @@@ -7522,7 -7520,7 +7522,7 @@@ static void HomeControllerReachabilityC Section *section = nil; int index = [indexPath row]; if (![self isEditing]) { - index -= 1; + index -= 1; if (index >= 0) section = [filtered_ objectAtIndex:index]; } else { @@@ -9037,6 -9035,7 +9037,6 @@@ UCLocalize("DEVELOPER"), nil]; segment_ = [[[UISegmentedControl alloc] initWithItems:items] autorelease]; - [segment_ setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin)]; container_ = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, [[self view] frame].size.width, 44.0f)] autorelease]; [container_ addSubview:segment_]; } @@@ -9081,12 -9080,7 +9081,12 @@@ - (void) viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; + [self resizeSegmentedControl]; +} +- (void) viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + [segment_ setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin)]; [self resizeSegmentedControl]; } @@@ -9346,20 -9340,6 +9346,20 @@@ @implementation Cydia +- (void) lockSuspend { + if (locked_++ == 0) { + if ($SBSSetInterceptsMenuButtonForever != NULL) + (*$SBSSetInterceptsMenuButtonForever)(true); + } +} + +- (void) unlockSuspend { + if (--locked_ == 0) { + if ($SBSSetInterceptsMenuButtonForever != NULL) + (*$SBSSetInterceptsMenuButtonForever)(false); + } +} + - (void) beginUpdate { [tabbar_ beginUpdate]; } @@@ -9376,7 -9356,7 +9376,7 @@@ initWithTitle:(count == 1 ? UCLocalize("HALFINSTALLED_PACKAGE") : [NSString stringWithFormat:UCLocalize("HALFINSTALLED_PACKAGES"), count]) message:UCLocalize("HALFINSTALLED_PACKAGE_EX") delegate:self - cancelButtonTitle:UCLocalize("FORCIBLY_CLEAR") + cancelButtonTitle:[NSString stringWithFormat:UCLocalize("PARENTHETICAL"), UCLocalize("FORCIBLY_CLEAR"), UCLocalize("UNSAFE")] otherButtonTitles: UCLocalize("TEMPORARY_IGNORE"), nil @@@ -9472,8 -9452,7 +9472,8 @@@ // - We already refreshed recently. // - We already auto-refreshed this launch. // - Auto-refresh is disabled. - if (recently || loaded_ || ManualRefresh) { + // - Cydia's server is not reachable + if (recently || loaded_ || ManualRefresh || !IsReachable("cydia.saurik.com")) { // If we are cancelling, we need to make sure it knows it's already loaded. loaded_ = true; @@@ -9482,7 -9461,9 +9482,7 @@@ // We are going to load, so remember that. loaded_ = true; - // If we can reach the server, auto-refresh! - if (IsReachable("cydia.saurik.com")) - [tabbar_ performSelectorOnMainThread:@selector(setUpdate:) withObject:update waitUntilDone:NO]; + [tabbar_ performSelectorOnMainThread:@selector(setUpdate:) withObject:update waitUntilDone:NO]; } [pool release]; @@@ -9729,9 -9710,9 +9729,9 @@@ - (void) confirmWithNavigationController:(UINavigationController *)navigation { Queuing_ = false; - ++locked_; + [self lockSuspend]; [self detachNewProgressSelector:@selector(perform_) toTarget:self forController:navigation title:@"RUNNING"]; - --locked_; + [self unlockSuspend]; } - (void) showSettings { @@@ -9896,12 -9877,12 +9896,12 @@@ [hud showInView:[target view]]; - ++locked_; + [self lockSuspend]; return hud; } - (void) removeProgressHUD:(UIProgressHUD *)hud { - --locked_; + [self unlockSuspend]; [hud hide]; [hud removeFromSuperview]; [window_ setUserInteractionEnabled:YES]; @@@ -10087,7 -10068,7 +10087,7 @@@ } - (void) addStashController { - ++locked_; + [self lockSuspend]; stash_ = [[[StashController alloc] init] autorelease]; [window_ addSubview:[stash_ view]]; } @@@ -10095,7 -10076,7 +10095,7 @@@ - (void) removeStashController { [[stash_ view] removeFromSuperview]; stash_ = nil; - --locked_; + [self unlockSuspend]; } - (void) stash { @@@ -10630,8 -10611,6 +10630,8 @@@ int main(int argc, char *argv[]) setuid(0); setgid(0); + system("mkdir -p /var/root/Library/Keyboard; cp -af /var/mobile/Library/Keyboard/UserDictionary.sqlite /var/root/Library/Keyboard/"); + /*Method alloc = class_getClassMethod([NSObject class], @selector(alloc)); alloc_ = alloc->method_imp; alloc->method_imp = (IMP) &Alloc_;*/ @@@ -10786,7 -10765,7 +10786,7 @@@ int version([[NSString stringWithContentsOfFile:@"/var/lib/cydia/firmware.ver"] intValue]); - if (access("/User", F_OK) != 0 || version != 5) { + if (access("/User", F_OK) != 0 || version != 6) { _trace(); system("/usr/libexec/cydia/firmware.sh"); _trace(); @@@ -10843,8 -10822,6 +10843,8 @@@ //UIKeyboardDisableAutomaticAppearance(); /* }}} */ + $SBSSetInterceptsMenuButtonForever = reinterpret_cast(dlsym(RTLD_DEFAULT, "SBSSetInterceptsMenuButtonForever")); + BOOL (*GSSystemHasCapability)(CFStringRef) = reinterpret_cast(dlsym(RTLD_DEFAULT, "GSSystemHasCapability")); bool fast = GSSystemHasCapability != NULL && GSSystemHasCapability(CFSTR("armv7"));