]> git.saurik.com Git - cydia.git/commitdiff
Merge branch 'master' of git.saurik.com:cydia
authorJay Freeman (saurik) <saurik@saurik.com>
Sun, 5 Feb 2012 05:04:24 +0000 (21:04 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Sun, 5 Feb 2012 05:04:24 +0000 (21:04 -0800)
1  2 
MobileCydia.mm

diff --combined MobileCydia.mm
index 8b8a406d94cd87dbfb48ba92f4a41567d51df16b,df2b98899a6841afd2f923d6166696a2b565fc6f..cdce7c5be6ef44383f44814c09582482510e09c7
@@@ -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 {
          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_];
  }
  
  - (void) viewWillAppear:(BOOL)animated {
      [super viewWillAppear:animated];
 +    [self resizeSegmentedControl];
 +}
  
 +- (void) viewDidAppear:(BOOL)animated {
 +    [super viewDidAppear:animated];
 +    [segment_ setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin)];
      [self resizeSegmentedControl];
  }
  
  
  @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];
  }
              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
      //  - 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;
  
          // 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];
  
  - (void) confirmWithNavigationController:(UINavigationController *)navigation {
      Queuing_ = false;
 -    ++locked_;
 +    [self lockSuspend];
      [self detachNewProgressSelector:@selector(perform_) toTarget:self forController:navigation title:@"RUNNING"];
 -    --locked_;
 +    [self unlockSuspend];
  }
  
  - (void) showSettings {
  
      [hud showInView:[target view]];
  
 -    ++locked_;
 +    [self lockSuspend];
      return hud;
  }
  
  - (void) removeProgressHUD:(UIProgressHUD *)hud {
 -    --locked_;
 +    [self unlockSuspend];
      [hud hide];
      [hud removeFromSuperview];
      [window_ setUserInteractionEnabled:YES];
  }
  
  - (void) addStashController {
 -    ++locked_;
 +    [self lockSuspend];
      stash_ = [[[StashController alloc] init] autorelease];
      [window_ addSubview:[stash_ view]];
  }
  - (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_;*/
  
      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();
      //UIKeyboardDisableAutomaticAppearance();
      /* }}} */
  
 +    $SBSSetInterceptsMenuButtonForever = reinterpret_cast<void (*)(bool)>(dlsym(RTLD_DEFAULT, "SBSSetInterceptsMenuButtonForever"));
 +
      BOOL (*GSSystemHasCapability)(CFStringRef) = reinterpret_cast<BOOL (*)(CFStringRef)>(dlsym(RTLD_DEFAULT, "GSSystemHasCapability"));
      bool fast = GSSystemHasCapability != NULL && GSSystemHasCapability(CFSTR("armv7"));