diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2011-03-22 22:24:37 -0700 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2011-03-22 22:24:37 -0700 |
commit | 0e15b67c86be0229b730885e19600f4768be2569 (patch) | |
tree | 7bd16679c320e2542d870bc4d6bcb51424031b92 /MobileCydia.mm | |
parent | 4a4dcb685803b71e7771dd12441c3fed19a09fce (diff) |
Add reachability to Refresh button.
Diffstat (limited to 'MobileCydia.mm')
-rw-r--r-- | MobileCydia.mm | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm index 8eeb857..a85c12e 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -7690,9 +7690,29 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi return path; } +- (void) alertView:(UIAlertView *)alert clickedButtonAtIndex:(NSInteger)button { + NSString *context([alert context]); + + if ([context isEqualToString:@"norefresh"]) + [alert dismissWithClickedButtonIndex:-1 animated:YES]; +} + - (void) refreshButtonClicked { - [delegate_ beginUpdate]; - [[self navigationItem] setLeftBarButtonItem:nil animated:YES]; + if (IsReachable("cydia.saurik.com")) { + [delegate_ beginUpdate]; + [[self navigationItem] setLeftBarButtonItem:nil animated:YES]; + } else { + UIAlertView *alert = [[[UIAlertView alloc] + initWithTitle:[NSString stringWithFormat:Colon_, Error_, UCLocalize("REFRESH")] + message:@"Host Unreachable" // XXX: Localize + delegate:self + cancelButtonTitle:UCLocalize("OK") + otherButtonTitles:nil + ] autorelease]; + + [alert setContext:@"norefresh"]; + [alert show]; + } } - (void) upgradeButtonClicked { |