From 0fe9a7e80efcdd1d938e16a0bd7d55a83f573d51 Mon Sep 17 00:00:00 2001 From: Grant Paul Date: Tue, 10 Aug 2010 17:39:04 +0000 Subject: [PATCH] Commit (chpwn): good-bye-uiactionsheet.patch --- Cydia.mm | 89 ++++++++++++++++++++++++++------------------------------ 1 file changed, 42 insertions(+), 47 deletions(-) diff --git a/Cydia.mm b/Cydia.mm index 86ddb4a8..f7922001 100644 --- a/Cydia.mm +++ b/Cydia.mm @@ -5879,47 +5879,41 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { if (NSString *warning = [self yieldToSelector:@selector(getWarning)]) { defer = true; - UIActionSheet *sheet = [[[UIActionSheet alloc] + UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:UCLocalize("SOURCE_WARNING") - buttons:[NSArray arrayWithObjects:UCLocalize("ADD_ANYWAY"), UCLocalize("CANCEL"), nil] - defaultButtonIndex:0 - delegate:self - context:@"warning" + message:warning + delegate:self + cancelButtonTitle:UCLocalize("CANCEL") + otherButtonTitles:UCLocalize("ADD_ANYWAY"), nil ] autorelease]; - [sheet setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)]; - - [sheet setNumberOfRows:1]; - [sheet setBodyText:warning]; - [sheet popupAlertAnimated:YES]; + [alert setContext:@"warning"]; + [alert setNumberOfRows:1]; + [alert show]; } else [self complete]; } else if (error_ != nil) { - UIActionSheet *sheet = [[[UIActionSheet alloc] + UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:UCLocalize("VERIFICATION_ERROR") - buttons:[NSArray arrayWithObjects:UCLocalize("OK"), nil] - defaultButtonIndex:0 - delegate:self - context:@"urlerror" + message:[error_ localizedDescription] + delegate:self + cancelButtonTitle:UCLocalize("OK") + otherButtonTitles:nil ] autorelease]; - [sheet setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)]; - - [sheet setBodyText:[error_ localizedDescription]]; - [sheet popupAlertAnimated:YES]; + [alert setContext:@"urlerror"]; + [alert show]; } else { - UIActionSheet *sheet = [[[UIActionSheet alloc] + UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:UCLocalize("NOT_REPOSITORY") - buttons:[NSArray arrayWithObjects:UCLocalize("OK"), nil] - defaultButtonIndex:0 - delegate:self - context:@"trivial" + message:UCLocalize("NOT_REPOSITORY_EX") + delegate:self + cancelButtonTitle:UCLocalize("OK") + otherButtonTitles:nil ] autorelease]; - [sheet setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)]; - - [sheet setBodyText:UCLocalize("NOT_REPOSITORY_EX")]; - [sheet popupAlertAnimated:YES]; + [alert setContext:@"trivial"]; + [alert show]; } [delegate_ setStatusBarShowsProgress:NO]; @@ -5977,13 +5971,13 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { return [[[NSURLConnection alloc] initWithRequest:request delegate:self] autorelease]; } -- (void) alertSheet:(UIActionSheet *)sheet buttonClicked:(int)button { - NSString *context([sheet context]); +- (void)alertView:(UIAlertView *)alert clickedButtonAtIndex:(NSInteger)button { + NSString *context([alert context]); if ([context isEqualToString:@"source"]) { switch (button) { case 1: { - NSString *href = [[sheet textField] text]; + NSString *href = [[alert textField] text]; //installer_ = [[self _requestHRef:href method:@"GET"] retain]; @@ -6004,24 +5998,24 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { [hud_ setText:UCLocalize("VERIFYING_URL")]; } break; - case 2: + case 0: break; _nodefault } - [sheet dismiss]; + [alert dismissWithClickedButtonIndex:-1 animated:YES]; } else if ([context isEqualToString:@"trivial"]) - [sheet dismiss]; + [alert dismissWithClickedButtonIndex:-1 animated:YES]; else if ([context isEqualToString:@"urlerror"]) - [sheet dismiss]; + [alert dismissWithClickedButtonIndex:-1 animated:YES]; else if ([context isEqualToString:@"warning"]) { switch (button) { case 1: [self complete]; break; - case 2: + case 0: break; _nodefault @@ -6030,7 +6024,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { [href_ release]; href_ = nil; - [sheet dismiss]; + [alert dismissWithClickedButtonIndex:-1 animated:YES]; } } @@ -6095,27 +6089,28 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { database:database_ ] autorelease]];*/ - UIActionSheet *sheet = [[[UIActionSheet alloc] + UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:UCLocalize("ENTER_APT_URL") - buttons:[NSArray arrayWithObjects:UCLocalize("ADD_SOURCE"), UCLocalize("CANCEL"), nil] - defaultButtonIndex:0 - delegate:self - context:@"source" + message:nil + delegate:self + cancelButtonTitle:UCLocalize("CANCEL") + otherButtonTitles:UCLocalize("ADD_SOURCE"), nil ] autorelease]; - [sheet setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)]; + [alert setContext:@"source"]; + [alert setTransform:CGAffineTransformTranslate([alert transform], 0.0, 100.0)]; - [sheet setNumberOfRows:1]; - [sheet addTextFieldWithValue:@"http://" label:@""]; + [alert setNumberOfRows:1]; + [alert addTextFieldWithValue:@"http://" label:@""]; - UITextInputTraits *traits = [[sheet textField] textInputTraits]; + UITextInputTraits *traits = [[alert textField] textInputTraits]; [traits setAutocapitalizationType:UITextAutocapitalizationTypeNone]; [traits setAutocorrectionType:UITextAutocorrectionTypeNo]; [traits setKeyboardType:UIKeyboardTypeURL]; // XXX: UIReturnKeyDone [traits setReturnKeyType:UIReturnKeyNext]; - [sheet popupAlertAnimated:YES]; + [alert show]; } - (void) _rightButtonClicked { -- 2.45.2