From df42d0851e8cac95ff821025cac08f93871a1e93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= Date: Fri, 31 May 2013 13:51:46 +0200 Subject: [PATCH] Remove pre-iOS5 compatibility code and drop the related warnings --- .../Controllers/IASKAppSettingsViewController.m | 169 +++++++++------------ .../Controllers/IASKAppSettingsWebViewController.m | 65 +++----- 2 files changed, 95 insertions(+), 139 deletions(-) diff --git a/InAppSettingsKit/Controllers/IASKAppSettingsViewController.m b/InAppSettingsKit/Controllers/IASKAppSettingsViewController.m index 9a76673..e90d91f 100644 --- a/InAppSettingsKit/Controllers/IASKAppSettingsViewController.m +++ b/InAppSettingsKit/Controllers/IASKAppSettingsViewController.m @@ -6,9 +6,9 @@ // Luc Vandal, Edovia Inc., http://www.edovia.com // Ortwin Gentz, FutureTap GmbH, http://www.futuretap.com // All rights reserved. -// -// It is appreciated but not required that you give credit to Luc Vandal and Ortwin Gentz, -// as the original authors of this code. You can give credit in a blog post, a tweet or on +// +// It is appreciated but not required that you give credit to Luc Vandal and Ortwin Gentz, +// as the original authors of this code. You can give credit in a blog post, a tweet or on // a info page of your app. Also, the original authors appreciate letting them know if you use this code. // // This code is licensed under the BSD license that is available at: http://www.opensource.org/licenses/bsd-license.php @@ -86,11 +86,11 @@ CGRect IASKCGRectSwap(CGRect rect); - (void)setFile:(NSString *)file { if (file != _file) { - + [_file release]; _file = [file copy]; } - + self.tableView.contentOffset = CGPointMake(0, 0); self.settingsReader = nil; // automatically initializes itself [_hiddenKeys release], _hiddenKeys = nil; @@ -149,7 +149,7 @@ CGRect IASKCGRectSwap(CGRect rect); if ([self isPad]) { self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLineEtched; } - UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTapToEndEdit:)]; + UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTapToEndEdit:)]; tapGesture.cancelsTouchesInView = NO; [self.tableView addGestureRecognizer:tapGesture]; [tapGesture release]; @@ -169,24 +169,24 @@ CGRect IASKCGRectSwap(CGRect rect); // so reload that row NSIndexPath *selectedIndexPath = [self.tableView indexPathForSelectedRow]; if(selectedIndexPath) { - [self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:selectedIndexPath] + [self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:selectedIndexPath] withRowAnimation:UITableViewRowAnimationNone]; // and reselect it, so we get the nice default deselect animation from UITableViewController [self.tableView selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone]; } - + self.navigationItem.rightBarButtonItem = nil; if (_showDoneButton) { - UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone - target:self + UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone + target:self action:@selector(dismiss:)]; self.navigationItem.rightBarButtonItem = buttonItem; [buttonItem release]; - } + } if (!self.title) { self.title = NSLocalizedString(@"Settings", @""); } - + if ([self.settingsStore isKindOfClass:[IASKSettingsStoreUserDefaults class]]) { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userDefaultsDidChange) @@ -220,7 +220,7 @@ CGRect IASKCGRectSwap(CGRect rect); // hide the keyboard [self.currentFirstResponder resignFirstResponder]; - + [super viewDidDisappear:animated]; } @@ -231,7 +231,7 @@ CGRect IASKCGRectSwap(CGRect rect); - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; - + // Release any cached data, images, etc that aren't in use. } @@ -244,16 +244,16 @@ CGRect IASKCGRectSwap(CGRect rect); if (_hiddenKeys != theHiddenKeys) { NSSet *oldHiddenKeys = _hiddenKeys; _hiddenKeys = [theHiddenKeys retain]; - - if (animated) { + + if (animated) { [self.tableView beginUpdates]; - + NSMutableSet *showKeys = [NSMutableSet setWithSet:oldHiddenKeys]; [showKeys minusSet:theHiddenKeys]; - + NSMutableSet *hideKeys = [NSMutableSet setWithSet:theHiddenKeys]; [hideKeys minusSet:oldHiddenKeys]; - + // calculate rows to be deleted NSMutableArray *hideIndexPaths = [NSMutableArray array]; for (NSString *key in hideKeys) { @@ -262,7 +262,7 @@ CGRect IASKCGRectSwap(CGRect rect); [hideIndexPaths addObject:indexPath]; } } - + // calculate sections to be deleted NSMutableIndexSet *hideSections = [NSMutableIndexSet indexSet]; for (NSInteger section = 0; section < [self numberOfSectionsInTableView:self.tableView ]; section++) { @@ -276,11 +276,11 @@ CGRect IASKCGRectSwap(CGRect rect); [hideSections addIndex:section]; } } - + // set the datasource self.settingsReader.hiddenKeys = theHiddenKeys; - - + + // calculate rows to be inserted NSMutableArray *showIndexPaths = [NSMutableArray array]; for (NSString *key in showKeys) { @@ -289,7 +289,7 @@ CGRect IASKCGRectSwap(CGRect rect); [showIndexPaths addObject:indexPath]; } } - + // calculate sections to be inserted NSMutableIndexSet *showSections = [NSMutableIndexSet indexSet]; for (NSInteger section = 0; section < [self.settingsReader numberOfSections]; section++) { @@ -303,7 +303,7 @@ CGRect IASKCGRectSwap(CGRect rect); [showSections addIndex:section]; } } - + UITableViewRowAnimation animation = animated ? UITableViewRowAnimationTop : UITableViewRowAnimationNone; [self.tableView deleteSections:hideSections withRowAnimation:animation]; [self.tableView deleteRowsAtIndexPaths:hideIndexPaths withRowAnimation:animation]; @@ -332,7 +332,7 @@ CGRect IASKCGRectSwap(CGRect rect); [_settingsReader release], _settingsReader = nil; [_settingsStore release], _settingsStore = nil; [_hiddenKeys release], _hiddenKeys = nil; - + _delegate = nil; [super dealloc]; @@ -344,7 +344,7 @@ CGRect IASKCGRectSwap(CGRect rect); - (void)dismiss:(id)sender { [self.settingsStore synchronize]; - + if (self.delegate && [self.delegate conformsToProtocol:@protocol(IASKSettingsDelegate)]) { [self.delegate settingsViewControllerDidEnd:self]; } @@ -353,13 +353,13 @@ CGRect IASKCGRectSwap(CGRect rect); - (void)toggledValue:(id)sender { IASKSwitch *toggle = [[(IASKSwitch*)sender retain] autorelease]; IASKSpecifier *spec = [_settingsReader specifierForKey:[toggle key]]; - + if ([toggle isOn]) { if ([spec trueValue] != nil) { [self.settingsStore setObject:[spec trueValue] forKey:[toggle key]]; } else { - [self.settingsStore setBool:YES forKey:[toggle key]]; + [self.settingsStore setBool:YES forKey:[toggle key]]; } } else { @@ -367,7 +367,7 @@ CGRect IASKCGRectSwap(CGRect rect); [self.settingsStore setObject:[spec falseValue] forKey:[toggle key]]; } else { - [self.settingsStore setBool:NO forKey:[toggle key]]; + [self.settingsStore setBool:NO forKey:[toggle key]]; } } [[NSNotificationCenter defaultCenter] postNotificationName:kIASKAppSettingChanged @@ -431,11 +431,11 @@ CGRect IASKCGRectSwap(CGRect rect); if ((result = [self.delegate settingsViewController:self tableView:tableView heightForHeaderForSection:section])) { return result; } - + } NSString *title; if ((title = [self tableView:tableView titleForHeaderInSection:section])) { - CGSize size = [title sizeWithFont:[UIFont boldSystemFontOfSize:[UIFont labelFontSize]] + CGSize size = [title sizeWithFont:[UIFont boldSystemFontOfSize:[UIFont labelFontSize]] constrainedToSize:CGSizeMake(tableView.frame.size.width - 2*kIASKHorizontalPaddingGroupTitles, INFINITY) lineBreakMode:NSLineBreakByWordWrapping]; return size.height+kIASKVerticalPaddingGroupTitles; @@ -502,15 +502,15 @@ CGRect IASKCGRectSwap(CGRect rect); assert(nil != cell && "delegate must return a UITableViewCell for custom cell types"); return cell; } - + UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:specifier.type]; if(nil == cell) { cell = [[self newCellForIdentifier:specifier.type] autorelease]; } - + if ([specifier.type isEqualToString:kIASKPSToggleSwitchSpecifier]) { cell.textLabel.text = specifier.title; - + id currentValue = [self.settingsStore objectForKey:specifier.key]; BOOL toggleState; if (currentValue) { @@ -530,26 +530,26 @@ CGRect IASKCGRectSwap(CGRect rect); } else if ([specifier.type isEqualToString:kIASKPSMultiValueSpecifier]) { cell.textLabel.text = specifier.title; - cell.detailTextLabel.text = [[specifier titleForCurrentValue:[self.settingsStore objectForKey:specifier.key] != nil ? + cell.detailTextLabel.text = [[specifier titleForCurrentValue:[self.settingsStore objectForKey:specifier.key] != nil ? [self.settingsStore objectForKey:specifier.key] : specifier.defaultValue] description]; } else if ([specifier.type isEqualToString:kIASKPSTitleValueSpecifier]) { cell.textLabel.text = specifier.title; id value = [self.settingsStore objectForKey:specifier.key] ? : specifier.defaultValue; - + NSString *stringValue; if (specifier.multipleValues || specifier.multipleTitles) { stringValue = [specifier titleForCurrentValue:value]; } else { stringValue = [value description]; } - + cell.detailTextLabel.text = stringValue; cell.userInteractionEnabled = NO; } else if ([specifier.type isEqualToString:kIASKPSTextFieldSpecifier]) { cell.textLabel.text = specifier.title; - + NSString *textValue = [self.settingsStore objectForKey:specifier.key] != nil ? [self.settingsStore objectForKey:specifier.key] : specifier.defaultStringValue; if (textValue && ![textValue isMemberOfClass:[NSString class]]) { textValue = [NSString stringWithFormat:@"%@", textValue]; @@ -573,11 +573,11 @@ CGRect IASKCGRectSwap(CGRect rect); if (specifier.minimumValueImage.length > 0) { ((IASKPSSliderSpecifierViewCell*)cell).minImage.image = [UIImage imageWithContentsOfFile:[_settingsReader pathForImageNamed:specifier.minimumValueImage]]; } - + if (specifier.maximumValueImage.length > 0) { ((IASKPSSliderSpecifierViewCell*)cell).maxImage.image = [UIImage imageWithContentsOfFile:[_settingsReader pathForImageNamed:specifier.maximumValueImage]]; } - + IASKSlider *slider = ((IASKPSSliderSpecifierViewCell*)cell).slider; slider.minimumValue = specifier.minimumValue; slider.maximumValue = specifier.maximumValue; @@ -597,10 +597,10 @@ CGRect IASKCGRectSwap(CGRect rect); } else { cell.textLabel.text = specifier.title; } - + cell.imageView.image = specifier.cellImage; cell.imageView.highlightedImage = specifier.highlightedCellImage; - + if (![specifier.type isEqualToString:kIASKPSMultiValueSpecifier] && ![specifier.type isEqualToString:kIASKPSTitleValueSpecifier] && ![specifier.type isEqualToString:kIASKPSTextFieldSpecifier]) { cell.textLabel.textAlignment = specifier.textAlignment; } @@ -616,7 +616,7 @@ CGRect IASKCGRectSwap(CGRect rect); if(nil == noSelectionTypes) { noSelectionTypes = [[NSSet setWithObjects:kIASKPSToggleSwitchSpecifier, kIASKPSSliderSpecifier, nil] retain]; } - + IASKSpecifier *specifier = [self.settingsReader specifierForIndexPath:indexPath]; if([noSelectionTypes containsObject:specifier.type]) { return nil; @@ -627,26 +627,26 @@ CGRect IASKCGRectSwap(CGRect rect); - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { IASKSpecifier *specifier = [self.settingsReader specifierForIndexPath:indexPath]; - + //switches and sliders can't be selected (should be captured by tableView:willSelectRowAtIndexPath: delegate method) assert(![[specifier type] isEqualToString:kIASKPSToggleSwitchSpecifier]); assert(![[specifier type] isEqualToString:kIASKPSSliderSpecifier]); if ([[specifier type] isEqualToString:kIASKPSMultiValueSpecifier]) { IASKSpecifierValuesViewController *targetViewController = [[self.viewList objectAtIndex:kIASKSpecifierValuesViewControllerIndex] objectForKey:@"viewController"]; - + if (targetViewController == nil) { // the view controller has not been created yet, create it and set it to our viewList array // create a new dictionary with the new view controller NSMutableDictionary *newItemDict = [NSMutableDictionary dictionaryWithCapacity:3]; [newItemDict addEntriesFromDictionary: [self.viewList objectAtIndex:kIASKSpecifierValuesViewControllerIndex]]; // copy the title and explain strings - + targetViewController = [[IASKSpecifierValuesViewController alloc] init]; // add the new view controller to the dictionary and then to the 'viewList' array [newItemDict setObject:targetViewController forKey:@"viewController"]; [self.viewList replaceObjectAtIndex:kIASKSpecifierValuesViewControllerIndex withObject:newItemDict]; [targetViewController release]; - + // load the view controll back in to push it targetViewController = [[self.viewList objectAtIndex:kIASKSpecifierValuesViewControllerIndex] objectForKey:@"viewController"]; } @@ -661,7 +661,7 @@ CGRect IASKCGRectSwap(CGRect rect); } else if ([[specifier type] isEqualToString:kIASKPSChildPaneSpecifier]) { - + Class vcClass = [specifier viewControllerClass]; if (vcClass) { SEL initSelector = [specifier viewControllerSelector]; @@ -680,30 +680,30 @@ CGRect IASKCGRectSwap(CGRect rect); [vc performSelector:@selector(release)]; return; } - + if (nil == [specifier file]) { [tableView deselectRowAtIndexPath:indexPath animated:YES]; return; - } - + } + IASKAppSettingsViewController *targetViewController = [[self.viewList objectAtIndex:kIASKSpecifierChildViewControllerIndex] objectForKey:@"viewController"]; - + if (targetViewController == nil) { // the view controller has not been created yet, create it and set it to our viewList array // create a new dictionary with the new view controller NSMutableDictionary *newItemDict = [NSMutableDictionary dictionaryWithCapacity:3]; [newItemDict addEntriesFromDictionary: [self.viewList objectAtIndex:kIASKSpecifierChildViewControllerIndex]]; // copy the title and explain strings - + targetViewController = [[[self class] alloc] init]; targetViewController.showDoneButton = NO; - targetViewController.settingsStore = self.settingsStore; + targetViewController.settingsStore = self.settingsStore; targetViewController.delegate = self.delegate; // add the new view controller to the dictionary and then to the 'viewList' array [newItemDict setObject:targetViewController forKey:@"viewController"]; [self.viewList replaceObjectAtIndex:kIASKSpecifierChildViewControllerIndex withObject:newItemDict]; [targetViewController release]; - + // load the view controll back in to push it targetViewController = [[self.viewList objectAtIndex:kIASKSpecifierChildViewControllerIndex] objectForKey:@"viewController"]; } @@ -714,7 +714,7 @@ CGRect IASKCGRectSwap(CGRect rect); [[self navigationController] pushViewController:targetViewController animated:YES]; } else if ([[specifier type] isEqualToString:kIASKOpenURLSpecifier]) { [tableView deselectRowAtIndexPath:indexPath animated:YES]; - [[UIApplication sharedApplication] openURL:[NSURL URLWithString:specifier.file]]; + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:specifier.file]]; } else if ([[specifier type] isEqualToString:kIASKButtonSpecifier]) { [tableView deselectRowAtIndexPath:indexPath animated:YES]; if ([self.delegate respondsToSelector:@selector(settingsViewController:buttonTappedForSpecifier:)]) { @@ -739,7 +739,7 @@ CGRect IASKCGRectSwap(CGRect rect); MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init]; mailViewController.navigationBar.barStyle = self.navigationController.navigationBar.barStyle; mailViewController.navigationBar.tintColor = self.navigationController.navigationBar.tintColor; - + if ([specifier localizedObjectForKey:kIASKMailComposeSubject]) { [mailViewController setSubject:[specifier localizedObjectForKey:kIASKMailComposeSubject]]; } @@ -757,7 +757,7 @@ CGRect IASKCGRectSwap(CGRect rect); if ([[specifier specifierDict] objectForKey:kIASKMailComposeBodyIsHTML]) { isHTML = [[[specifier specifierDict] objectForKey:kIASKMailComposeBodyIsHTML] boolValue]; } - + if ([self.delegate respondsToSelector:@selector(settingsViewController:mailComposeBodyForSpecifier:)]) { [mailViewController setMessageBody:[self.delegate settingsViewController:self mailComposeBodyForSpecifier:specifier] isHTML:isHTML]; @@ -768,29 +768,19 @@ CGRect IASKCGRectSwap(CGRect rect); } UIViewController *vc = nil; - + if ([self.delegate respondsToSelector:@selector(settingsViewController:viewControllerForMailComposeViewForSpecifier:)]) { vc = [self.delegate settingsViewController:self viewControllerForMailComposeViewForSpecifier:specifier]; } - + if (vc == nil) { vc = self; } - + mailViewController.mailComposeDelegate = vc; -#if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 50000) -#pragma message "Now that we're iOS5 and up, remove this workaround" -#endif - if([vc respondsToSelector:@selector(presentViewController:animated:completion:)]) { - [vc presentViewController:mailViewController - animated:YES - completion:nil]; - } else { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [vc presentModalViewController:mailViewController animated:YES]; -#pragma clang diagnostic pop - } + [vc presentViewController:mailViewController + animated:YES + completion:nil]; [mailViewController release]; } else { UIAlertView *alert = [[UIAlertView alloc] @@ -815,28 +805,17 @@ CGRect IASKCGRectSwap(CGRect rect); #pragma mark MFMailComposeViewControllerDelegate Function -(void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error { - + // Forward the mail compose delegate if ([self.delegate respondsToSelector:@selector(settingsViewController:mailComposeController:didFinishWithResult:error:)]) { - [self.delegate settingsViewController:self - mailComposeController:controller - didFinishWithResult:result + [self.delegate settingsViewController:self + mailComposeController:controller + didFinishWithResult:result error:error]; } - -#if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 50000) -#pragma message "Now that we're iOS5 and up, remove this workaround" -#endif - if([self respondsToSelector:@selector(dismissViewControllerAnimated:completion:)]) { - [self dismissViewControllerAnimated:YES - completion:nil]; - } else { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [self dismissModalViewControllerAnimated:YES]; -#pragma clang diagnostic pop - - } + + [self dismissViewControllerAnimated:YES + completion:nil]; } #pragma mark - @@ -885,8 +864,8 @@ static NSDictionary *oldUserDefaults = nil; } } [oldUserDefaults release], oldUserDefaults = [currentDict retain]; - - + + for (UITableViewCell *cell in self.tableView.visibleCells) { if ([cell isKindOfClass:[IASKPSTextFieldSpecifierViewCell class]] && [((IASKPSTextFieldSpecifierViewCell*)cell).textField isFirstResponder]) { [indexPathsToUpdate removeObject:[self.tableView indexPathForCell:cell]]; diff --git a/InAppSettingsKit/Controllers/IASKAppSettingsWebViewController.m b/InAppSettingsKit/Controllers/IASKAppSettingsWebViewController.m index d99da5c..4769b04 100644 --- a/InAppSettingsKit/Controllers/IASKAppSettingsWebViewController.m +++ b/InAppSettingsKit/Controllers/IASKAppSettingsWebViewController.m @@ -6,9 +6,9 @@ // Luc Vandal, Edovia Inc., http://www.edovia.com // Ortwin Gentz, FutureTap GmbH, http://www.futuretap.com // All rights reserved. -// -// It is appreciated but not required that you give credit to Luc Vandal and Ortwin Gentz, -// as the original authors of this code. You can give credit in a blog post, a tweet or on +// +// It is appreciated but not required that you give credit to Luc Vandal and Ortwin Gentz, +// as the original authors of this code. You can give credit in a blog post, a tweet or on // a info page of your app. Also, the original authors appreciate letting them know if you use this code. // // This code is licensed under the BSD license that is available at: http://www.opensource.org/licenses/bsd-license.php @@ -42,18 +42,18 @@ webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; webView.delegate = self; - + self.view = webView; } - (void)dealloc { [webView release], webView = nil; [url release], url = nil; - + [super dealloc]; } -- (void)viewWillAppear:(BOOL)animated { +- (void)viewWillAppear:(BOOL)animated { [webView loadRequest:[NSURLRequest requestWithURL:self.url]]; } @@ -72,7 +72,7 @@ - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { NSURL *newURL = [request URL]; - + // intercept mailto URL and send it to an in-app Mail compose view instead if ([[newURL scheme] isEqualToString:@"mailto"]) { @@ -80,7 +80,7 @@ if (rawURLparts.count > 2) { return NO; // invalid URL } - + MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init]; mailViewController.mailComposeDelegate = self; @@ -89,10 +89,10 @@ if (defaultRecipient.length) { [toRecipients addObject:defaultRecipient]; } - + if (rawURLparts.count == 2) { NSString *queryString = [rawURLparts objectAtIndex:1]; - + NSArray *params = [queryString componentsSeparatedByString:@"&"]; for (NSString *param in params) { NSArray *keyValue = [param componentsSeparatedByString:@"="]; @@ -101,56 +101,46 @@ } NSString *key = [[keyValue objectAtIndex:0] lowercaseString]; NSString *value = [keyValue objectAtIndex:1]; - + value = (NSString *)CFURLCreateStringByReplacingPercentEscapesUsingEncoding(kCFAllocatorDefault, (CFStringRef)value, CFSTR(""), kCFStringEncodingUTF8); [value autorelease]; - + if ([key isEqualToString:@"subject"]) { [mailViewController setSubject:value]; } - + if ([key isEqualToString:@"body"]) { [mailViewController setMessageBody:value isHTML:NO]; } - + if ([key isEqualToString:@"to"]) { [toRecipients addObjectsFromArray:[value componentsSeparatedByString:@","]]; } - + if ([key isEqualToString:@"cc"]) { NSArray *recipients = [value componentsSeparatedByString:@","]; [mailViewController setCcRecipients:recipients]; } - + if ([key isEqualToString:@"bcc"]) { NSArray *recipients = [value componentsSeparatedByString:@","]; [mailViewController setBccRecipients:recipients]; } } } - + [mailViewController setToRecipients:toRecipients]; - -#if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 50000) -#pragma message "Now that we're iOS5 and up, remove this workaround" -#endif - if([self respondsToSelector:@selector(presentViewController:animated:completion:)]) { + [self presentViewController:mailViewController animated:YES completion:nil]; - } else { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [self presentModalViewController:mailViewController animated:YES]; -#pragma clang diagnostic pop - } [mailViewController release]; return NO; } - + // open inline if host is the same, otherwise, pass to the system if (![newURL host] || [[newURL host] isEqualToString:[self.url host]]) { return YES; @@ -160,21 +150,8 @@ } - (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error { -#if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 50000) -#pragma message "Now that we're iOS5 and up, remove this workaround" -#endif - if([self respondsToSelector:@selector(dismissViewControllerAnimated:completion:)]) { - [self dismissViewControllerAnimated:YES - completion:nil]; - } else { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [self dismissModalViewControllerAnimated:YES]; -#pragma clang diagnostic pop - - } + [self dismissViewControllerAnimated:YES + completion:nil]; } - - @end -- 1.7.12.4 (Apple Git-37)