diff --git a/iphone/Maps/Bookmarks/BookmarksRootVC.mm b/iphone/Maps/Bookmarks/BookmarksRootVC.mm index 1a67bd54db..b2600575b4 100644 --- a/iphone/Maps/Bookmarks/BookmarksRootVC.mm +++ b/iphone/Maps/Bookmarks/BookmarksRootVC.mm @@ -95,8 +95,6 @@ [Statistics logEvent:kStatEventName(kStatBookmarks, kStatToggleVisibility) withParameters:@{kStatValue : visible ? kStatVisible : kStatHidden}]; cell.imageView.image = [UIImage imageNamed:(visible ? @"ic_show" : @"ic_hide")]; - if (isIOS7) - [cell.imageView makeImageAlwaysTemplate]; cell.imageView.mwm_coloring = visible ? MWMImageColoringBlue : MWMImageColoringBlack; { BookmarkCategory::Guard guard(*cat); @@ -130,8 +128,6 @@ BOOL const isVisible = cat->IsVisible(); cell.imageView.image = [UIImage imageNamed:(isVisible ? @"ic_show" : @"ic_hide")]; cell.imageView.mwm_coloring = isVisible ? MWMImageColoringBlue : MWMImageColoringBlack; - if (isIOS7) - [cell.imageView makeImageAlwaysTemplate]; cell.detailTextLabel.text = [NSString stringWithFormat:@"%ld", cat->GetUserMarkCount() + cat->GetTracksCount()]; } cell.backgroundColor = [UIColor white]; diff --git a/iphone/Maps/Categories/TimeUtils.mm b/iphone/Maps/Categories/TimeUtils.mm index a1867b9beb..d341accaf9 100644 --- a/iphone/Maps/Categories/TimeUtils.mm +++ b/iphone/Maps/Categories/TimeUtils.mm @@ -5,21 +5,12 @@ + (NSString *)estimatedArrivalTimeWithSeconds:(NSTimeInterval)seconds { - if (isIOS7) - { - NSInteger const minutes = seconds / 60; - NSInteger const hours = minutes / 60; - return [NSString stringWithFormat:@"%ld:%02ld", (long)hours, (long)(minutes % 60)]; - } - else - { - NSDateComponentsFormatter * formatter = [[NSDateComponentsFormatter alloc] init]; - formatter.allowedUnits = NSCalendarUnitMinute | NSCalendarUnitHour | NSCalendarUnitDay; - formatter.maximumUnitCount = 2; - formatter.unitsStyle = NSDateComponentsFormatterUnitsStyleAbbreviated; - formatter.zeroFormattingBehavior = NSDateComponentsFormatterZeroFormattingBehaviorDropAll; - return [formatter stringFromTimeInterval:seconds]; - } + NSDateComponentsFormatter * formatter = [[NSDateComponentsFormatter alloc] init]; + formatter.allowedUnits = NSCalendarUnitMinute | NSCalendarUnitHour | NSCalendarUnitDay; + formatter.maximumUnitCount = 2; + formatter.unitsStyle = NSDateComponentsFormatterUnitsStyleAbbreviated; + formatter.zeroFormattingBehavior = NSDateComponentsFormatterZeroFormattingBehaviorDropAll; + return [formatter stringFromTimeInterval:seconds]; } @end diff --git a/iphone/Maps/Categories/UIKitCategories.h b/iphone/Maps/Categories/UIKitCategories.h index f45fef4b53..5b71b35520 100644 --- a/iphone/Maps/Categories/UIKitCategories.h +++ b/iphone/Maps/Categories/UIKitCategories.h @@ -60,12 +60,6 @@ static inline CGFloat LengthCGPoint(CGPoint point) @end -@interface UIImageView (IOS7Workaround) - -- (void)makeImageAlwaysTemplate; - -@end - @interface UIApplication (URLs) - (void)rateVersionFrom:(NSString *)launchPlaceName; diff --git a/iphone/Maps/Categories/UIKitCategories.mm b/iphone/Maps/Categories/UIKitCategories.mm index 6db448c1eb..cd122c63be 100644 --- a/iphone/Maps/Categories/UIKitCategories.mm +++ b/iphone/Maps/Categories/UIKitCategories.mm @@ -105,12 +105,9 @@ - (void)rateVersionFrom:(NSString *)launchPlaceName { NSString * urlString = - isIOS7 ? [NSString stringWithFormat: - @"itms-apps://itunes.apple.com/app/id510623322?mt=8&at=1l3v7ya&ct=%@", - launchPlaceName] - : @"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/" - @"viewContentsUserReviews?id=510623322&onlyLatestVersion=true&pageNumber=0&" - @"sortOrdering=1&type=Purple+Software"; + @"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/" + @"viewContentsUserReviews?id=510623322&onlyLatestVersion=true&pageNumber=0&" + @"sortOrdering=1&type=Purple+Software"; [self openURL:[NSURL URLWithString:urlString]]; } @@ -271,16 +268,6 @@ @end -@implementation UIImageView (IOS7Workaround) - -- (void)makeImageAlwaysTemplate -{ - if (isIOS7) - self.image = [self.image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; -} - -@end - @implementation SolidTouchImageView - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {} @@ -320,7 +307,7 @@ NSString * scheme = url.scheme; NSAssert(([scheme isEqualToString:@"http"] || [scheme isEqualToString:@"https"]), @"Incorrect url's scheme!"); - if ((isIOS7 || isIOS8)) + if (isIOS8) { UIApplication * app = [UIApplication sharedApplication]; if ([app canOpenURL:url]) diff --git a/iphone/Maps/Classes/Components/MWMButton.mm b/iphone/Maps/Classes/Components/MWMButton.mm index d206fe335f..25cdd3d421 100644 --- a/iphone/Maps/Classes/Components/MWMButton.mm +++ b/iphone/Maps/Classes/Components/MWMButton.mm @@ -26,8 +26,6 @@ namespace - (void)setColoring:(MWMButtonColoring)coloring { _coloring = coloring; - if (isIOS7) - [self.imageView makeImageAlwaysTemplate]; [self setDefaultTintColor]; } @@ -61,8 +59,6 @@ namespace - (void)setHighlighted:(BOOL)highlighted { [super setHighlighted:highlighted]; - if (isIOS7) - [self.imageView makeImageAlwaysTemplate]; if (highlighted) { switch (self.coloring) @@ -96,8 +92,6 @@ namespace - (void)setSelected:(BOOL)selected { [super setSelected:selected]; - if (isIOS7) - [self.imageView makeImageAlwaysTemplate]; if (selected) { switch (self.coloring) diff --git a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm index 3bffc356b7..2b78dc3fb6 100644 --- a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm +++ b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm @@ -208,17 +208,13 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController [self.ownerViewController addChildViewController:self]; self.view.alpha = 0.; alert.alpha = 0.; - if (!isIOS7) - { - CGFloat const scale = 1.1; - alert.transform = CGAffineTransformMakeScale(scale, scale); - } + CGFloat const scale = 1.1; + alert.transform = CGAffineTransformMakeScale(scale, scale); [UIView animateWithDuration:kDefaultAnimationDuration animations:^{ self.view.alpha = 1.; alert.alpha = 1.; - if (!isIOS7) - alert.transform = CGAffineTransformIdentity; + alert.transform = CGAffineTransformIdentity; }]; [MapsAppDelegate.theApp.window endEditing:YES]; } diff --git a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm index 8c7d98110b..7daff6f833 100644 --- a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm +++ b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm @@ -177,13 +177,6 @@ - (void)rotate:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { - if (isIOS7 && [self respondsToSelector:@selector(setTransform:)]) - { - [UIView animateWithDuration:duration - animations:^{ - self.transform = rotation(toInterfaceOrientation); - }]; - } if ([self respondsToSelector:@selector(willRotateToInterfaceOrientation:)]) [self willRotateToInterfaceOrientation:toInterfaceOrientation]; } diff --git a/iphone/Maps/Classes/CustomAlert/LocationAlert/MWMLocationAlert.mm b/iphone/Maps/Classes/CustomAlert/LocationAlert/MWMLocationAlert.mm index addb53571e..039e2bf0bb 100644 --- a/iphone/Maps/Classes/CustomAlert/LocationAlert/MWMLocationAlert.mm +++ b/iphone/Maps/Classes/CustomAlert/LocationAlert/MWMLocationAlert.mm @@ -19,16 +19,13 @@ static NSString * const kStatisticsEvent = @"Location Alert"; [Statistics logEvent:kStatisticsEvent withParameters:@{kStatAction : kStatOpen}]; MWMLocationAlert * alert = [[[NSBundle mainBundle] loadNibNamed:kLocationAlertNibName owner:nil options:nil] firstObject]; [alert setNeedsCloseAlertAfterEnterBackground]; - if (isIOS7) - [alert.rightButton setTitle:L(@"ok") forState:UIControlStateNormal]; return alert; } - (IBAction)settingsTap { [Statistics logEvent:kStatisticsEvent withParameters:@{kStatAction : kStatApply}]; - if (!isIOS7) - [self openSettings]; + [self openSettings]; [self close]; } diff --git a/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.mm b/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.mm index bc9d90e6ad..b95780dd3f 100644 --- a/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.mm +++ b/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.mm @@ -41,12 +41,7 @@ static NSString * const kStatisticsEvent = @"Routing Disclaimer Alert"; }]; [alert.textView sizeToFit]; UIWindow * window = UIApplication.sharedApplication.keyWindow; - CGFloat height; - if (isIOS7) - height = UIInterfaceOrientationIsLandscape(orientation) ? window.width : window.height; - else - height = window.height; - [alert invalidateTextViewHeight:alert.textView.height withHeight:height]; + [alert invalidateTextViewHeight:alert.textView.height withHeight:window.height]; alert.okBlock = block; return alert; } @@ -83,7 +78,7 @@ static NSString * const kStatisticsEvent = @"Routing Disclaimer Alert"; - (CGFloat)bounded:(CGFloat)f withHeight:(CGFloat)h { CGFloat const currentHeight = [self.subviews.firstObject height]; - CGFloat const maximumHeight = h - (isIOS7 ? 4. : 2.) * kMinimumOffset; + CGFloat const maximumHeight = h - 2. * kMinimumOffset; CGFloat const availableHeight = maximumHeight - currentHeight; return MIN(f, availableHeight + self.textViewHeight.constant); } diff --git a/iphone/Maps/Classes/CustomViews/Login/MWMAuthorizationLoginViewController.mm b/iphone/Maps/Classes/CustomViews/Login/MWMAuthorizationLoginViewController.mm index e13906f317..d51c0ad959 100644 --- a/iphone/Maps/Classes/CustomViews/Login/MWMAuthorizationLoginViewController.mm +++ b/iphone/Maps/Classes/CustomViews/Login/MWMAuthorizationLoginViewController.mm @@ -30,7 +30,7 @@ NSString * const kRefresh = L(@"refresh"); using namespace osm; using namespace osm_auth_ios; -@interface MWMAuthorizationLoginViewController () +@interface MWMAuthorizationLoginViewController () @property (weak, nonatomic) IBOutlet UIView * authView; @property (weak, nonatomic) IBOutlet UIView * accountView; @@ -217,41 +217,30 @@ using namespace osm_auth_ios; - (void)showActionSheet { - if (isIOS7) + UIAlertController * alertController = + [UIAlertController alertControllerWithTitle:nil + message:nil + preferredStyle:UIAlertControllerStyleActionSheet]; + [alertController addAction:[UIAlertAction actionWithTitle:kRefresh + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { + [self refresh:YES]; + }]]; + [alertController addAction:[UIAlertAction actionWithTitle:kLogout + style:UIAlertActionStyleDestructive + handler:^(UIAlertAction * action) { + [self logout]; + }]]; + [alertController + addAction:[UIAlertAction actionWithTitle:kCancel style:UIAlertActionStyleCancel handler:nil]]; + + if (IPAD) { - UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:kCancel destructiveButtonTitle:kLogout otherButtonTitles:kRefresh, nil]; - [actionSheet showInView:self.view]; + UIPopoverPresentationController * popPresenter = + [alertController popoverPresentationController]; + popPresenter.barButtonItem = self.navigationItem.rightBarButtonItem; } - else - { - UIAlertController * alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; - [alertController addAction:[UIAlertAction actionWithTitle:kRefresh style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) - { - [self refresh:YES]; - }]]; - [alertController addAction:[UIAlertAction actionWithTitle:kLogout style:UIAlertActionStyleDestructive handler:^(UIAlertAction * action) - { - [self logout]; - }]]; - [alertController addAction:[UIAlertAction actionWithTitle:kCancel style:UIAlertActionStyleCancel handler:nil]]; - - if (IPAD) - { - UIPopoverPresentationController * popPresenter = [alertController popoverPresentationController]; - popPresenter.barButtonItem = self.navigationItem.rightBarButtonItem; - } - [self presentViewController:alertController animated:YES completion:nil]; - } -} - -#pragma mark - UIActionSheetDelegate - -- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex -{ - if (actionSheet.destructiveButtonIndex == buttonIndex) - [self logout]; - else if ([[actionSheet buttonTitleAtIndex:buttonIndex] isEqualToString:kRefresh]) - [self refresh:YES]; + [self presentViewController:alertController animated:YES completion:nil]; } #pragma mark - Segue diff --git a/iphone/Maps/Classes/CustomViews/Login/MWMAuthorizationWebViewLoginViewController.mm b/iphone/Maps/Classes/CustomViews/Login/MWMAuthorizationWebViewLoginViewController.mm index e44faee46d..6a4222f83d 100644 --- a/iphone/Maps/Classes/CustomViews/Login/MWMAuthorizationWebViewLoginViewController.mm +++ b/iphone/Maps/Classes/CustomViews/Login/MWMAuthorizationWebViewLoginViewController.mm @@ -15,18 +15,9 @@ namespace { NSString * const kVerifierKey = @"oauth_verifier"; -BOOL checkURLHasVerifierKey(NSString * urlString) -{ - return isIOS7 ? [urlString rangeOfString:kVerifierKey].location != NSNotFound - : [urlString containsString:kVerifierKey]; -} - BOOL checkURLNeedsReload(NSString * urlString) { - BOOL const hasSlashSuffix = [urlString hasSuffix:@"/"]; - if (!isIOS7) - return hasSlashSuffix || [urlString containsString:@"/welcome"]; - return hasSlashSuffix || ([urlString rangeOfString:@"/welcome"].location != NSNotFound); + return [urlString hasSuffix:@"/"] || [urlString containsString:@"/welcome"]; } NSString * getVerifier(NSString * urlString) @@ -203,7 +194,7 @@ NSString * getVerifier(NSString * urlString) { [self loadAuthorizationPage]; } - else if (checkURLHasVerifierKey(urlString)) + else if ([urlString containsString:kVerifierKey]) { webView.hidden = YES; NSString * verifier = getVerifier(urlString); diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/APIBar/MWMAPIBar.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/APIBar/MWMAPIBar.mm index a6d4e65008..375ff5042a 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/APIBar/MWMAPIBar.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/APIBar/MWMAPIBar.mm @@ -68,7 +68,7 @@ static NSString * const kKeyPath = @"subviews"; - (BOOL)isVisible { - if (isIOS7 || isIOS8) + if (isIOS8) return _isVisible; return NO; } @@ -77,7 +77,7 @@ static NSString * const kKeyPath = @"subviews"; { // Status bar in iOS 9 already provides back button if the app has been launched from another app. // For iOS version less than 9 we just try to mimic the default iOS 9 status bar. - if (!(isIOS7 || isIOS8)) + if (!isIOS8) return; if (_isVisible == isVisible) return; diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuCollectionViewCell.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuCollectionViewCell.mm index 06a2db6f3d..643163977e 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuCollectionViewCell.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuCollectionViewCell.mm @@ -24,8 +24,6 @@ isEnabled:(BOOL)isEnabled { self.icon.image = [UIImage imageNamed:imageName]; - if (isIOS7) - [self.icon makeImageAlwaysTemplate]; self.label.text = label; if (badgeCount > 0) { diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuView.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuView.mm index 1e3b2be005..aa64055a80 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuView.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuView.mm @@ -509,8 +509,6 @@ CGFloat constexpr kTimeWidthRegular = 128; case MWMBottomMenuStateCompact: name = @"ic_menu_left"; break; } UIImage * image = [UIImage imageNamed:name]; - if (isIOS7) - image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; [btn setImage:image forState:UIControlStateNormal]; if (self.state == MWMBottomMenuStateInactive) { @@ -531,7 +529,6 @@ CGFloat constexpr kTimeWidthRegular = 128; - (void)refreshOnOrientationChange { - [self refreshButtonsColor]; if (IPAD || self.state != MWMBottomMenuStateCompact) return; BOOL const isPortrait = self.superview.width < self.superview.height; @@ -543,21 +540,10 @@ CGFloat constexpr kTimeWidthRegular = 128; { self.layoutDuration = kDefaultAnimationDuration; [self setNeedsLayout]; - [self refreshButtonsColor]; if (self.state == MWMBottomMenuStateInactive) [self updateBadge]; } -- (void)refreshButtonsColor -{ - if (!isIOS7) - return; - auto const coloring = self.p2pButton.coloring; - self.p2pButton.coloring = coloring; - self.bookmarksButton.coloring = coloring; - self.searchButton.coloring = self.searchButton.coloring; -} - - (void)updateBadge { if (self.state == MWMBottomMenuStateRouting || self.state == MWMBottomMenuStateRoutingExpanded || diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabButtons/MWMSearchTabButtonsView.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabButtons/MWMSearchTabButtonsView.mm index c30427439e..78e344b69f 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabButtons/MWMSearchTabButtonsView.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabButtons/MWMSearchTabButtonsView.mm @@ -92,8 +92,6 @@ static CGFloat const kIconToLabelSpacing = 4.0; { _iconImage = iconImage; [self.icon setImage:iconImage forState:UIControlStateNormal]; - if (isIOS7) - [self.icon.imageView makeImageAlwaysTemplate]; } - (void)setLocalizedText:(NSString *)localizedText diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/BookmarksTab/MWMSearchBookmarksCell.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/BookmarksTab/MWMSearchBookmarksCell.mm index ff846747dc..54cf32d377 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/BookmarksTab/MWMSearchBookmarksCell.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/BookmarksTab/MWMSearchBookmarksCell.mm @@ -44,17 +44,6 @@ self.titleLabel.text = @(cat->GetName().c_str()); } -- (void)layoutSubviews -{ - [super layoutSubviews]; - if (isIOS7) - { - self.titleLabel.preferredMaxLayoutWidth = floor(self.titleLabel.width); - self.countLabel.preferredMaxLayoutWidth = floor(self.countLabel.width); - [super layoutSubviews]; - } -} - - (IBAction)toggleVisibility { self.isVisible = !self.isVisible; diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/CategoriesTab/MWMSearchCategoryCell.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/CategoriesTab/MWMSearchCategoryCell.mm index ebadf1ffe1..f026c54268 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/CategoriesTab/MWMSearchCategoryCell.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/CategoriesTab/MWMSearchCategoryCell.mm @@ -23,16 +23,6 @@ sl.rasterizationScale = UIScreen.mainScreen.scale; } -- (void)layoutSubviews -{ - [super layoutSubviews]; - if (isIOS7) - { - self.label.preferredMaxLayoutWidth = floor(self.label.width); - [super layoutSubviews]; - } -} - - (void)setCategory:(NSString *)category { self.label.text = L(category); diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/HistoryTab/MWMSearchHistoryRequestCell.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/HistoryTab/MWMSearchHistoryRequestCell.mm index 498139712f..a3b96577d2 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/HistoryTab/MWMSearchHistoryRequestCell.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/HistoryTab/MWMSearchHistoryRequestCell.mm @@ -25,18 +25,6 @@ { self.title.text = title; [self.title sizeToFit]; - if (isIOS7) - [self layoutIfNeeded]; -} - -- (void)layoutSubviews -{ - [super layoutSubviews]; - if (isIOS7) - { - self.title.preferredMaxLayoutWidth = floor(self.title.width); - [super layoutSubviews]; - } } + (CGFloat)defaultCellHeight diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCell.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCell.mm index 502eaea767..9cb13f00d8 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCell.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCell.mm @@ -64,16 +64,6 @@ [self.titleLabel sizeToFit]; } -- (void)layoutSubviews -{ - [super layoutSubviews]; - if (isIOS7) - { - self.titleLabel.preferredMaxLayoutWidth = floor(self.titleLabel.width); - [super layoutSubviews]; - } -} - - (NSDictionary *)selectedTitleAttributes { return nil; diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCommonCell.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCommonCell.mm index 04cb6baf23..86fe0bf081 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCommonCell.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCommonCell.mm @@ -72,21 +72,6 @@ self.distanceLabel.text = @(distanceStr.c_str()); } } - if (isIOS7) - [self layoutIfNeeded]; -} - -- (void)layoutSubviews -{ - [super layoutSubviews]; - if (isIOS7) - { - self.typeLabel.preferredMaxLayoutWidth = floor(self.typeLabel.width); - self.infoLabel.preferredMaxLayoutWidth = floor(self.infoLabel.width); - self.locationLabel.preferredMaxLayoutWidth = floor(self.locationLabel.width); - self.distanceLabel.preferredMaxLayoutWidth = floor(self.distanceLabel.width); - [super layoutSubviews]; - } } - (void)setInfoText:(NSString *)infoText diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationInfoView.mm b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationInfoView.mm index 966ce9f292..852f45466f 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationInfoView.mm +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationInfoView.mm @@ -185,8 +185,6 @@ BOOL defaultOrientation(CGSize const & size) { self.turnsView.hidden = NO; self.nextTurnImageView.image = info.turnImage; - if (isIOS7) - [self.nextTurnImageView makeImageAlwaysTemplate]; self.nextTurnImageView.mwm_coloring = MWMImageColoringWhite; if (info.roundExitNumber == 0) @@ -221,8 +219,6 @@ BOOL defaultOrientation(CGSize const & size) { self.secondTurnView.hidden = NO; self.secondTurnImageView.image = info.nextTurnImage; - if (isIOS7) - [self.secondTurnImageView makeImageAlwaysTemplate]; self.secondTurnImageView.mwm_coloring = MWMImageColoringBlack; } else diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Sound/MWMTextToSpeech.mm b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Sound/MWMTextToSpeech.mm index d67f9bae71..076f8d7381 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Sound/MWMTextToSpeech.mm +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Sound/MWMTextToSpeech.mm @@ -190,7 +190,7 @@ vector> availableLanguages() AVSpeechSynthesisVoice * voice = nil; for (NSString * loc in candidateLocales) { - if (!(isIOS7 || isIOS8) && [loc isEqualToString:@"en-US"]) + if (!isIOS8 && [loc isEqualToString:@"en-US"]) voice = [AVSpeechSynthesisVoice voiceWithLanguage:AVSpeechSynthesisVoiceIdentifierAlex]; if (voice) break; diff --git a/iphone/Maps/Classes/EAGLView.mm b/iphone/Maps/Classes/EAGLView.mm index b00decdafd..69ae54b58c 100644 --- a/iphone/Maps/Classes/EAGLView.mm +++ b/iphone/Maps/Classes/EAGLView.mm @@ -22,17 +22,6 @@ namespace { -// Returns native scale if it's possible. -double correctContentScale() -{ - UIScreen * uiScreen = [UIScreen mainScreen]; - - if (isIOS7) - return [uiScreen respondsToSelector:@selector(scale)] ? [uiScreen scale] : 1.f; - else - return [uiScreen respondsToSelector:@selector(nativeScale)] ? [uiScreen nativeScale] : 1.f; -} - // Returns DPI as exact as possible. It works for iPhone, iPad and iWatch. double getExactDPI(double contentScaleFactor) { @@ -82,7 +71,7 @@ double getExactDPI(double contentScaleFactor) kEAGLDrawablePropertyColorFormat : kEAGLColorFormatRGBA8}; // Correct retina display support in opengl renderbuffer - self.contentScaleFactor = correctContentScale(); + self.contentScaleFactor = [[UIScreen mainScreen] nativeScale]; m_factory = make_unique_dp(new iosOGLContextFactory(eaglLayer)); } diff --git a/iphone/Maps/Classes/MWMPlacePageActionBar.mm b/iphone/Maps/Classes/MWMPlacePageActionBar.mm index cf3184260b..5a85e0a7c3 100644 --- a/iphone/Maps/Classes/MWMPlacePageActionBar.mm +++ b/iphone/Maps/Classes/MWMPlacePageActionBar.mm @@ -19,7 +19,7 @@ NSString * const kPlacePageActionBarNibName = @"PlacePageActionBar"; } // namespace -@interface MWMPlacePageActionBar () +@interface MWMPlacePageActionBar () { vector m_visibleButtons; vector m_additionalButtons; @@ -212,61 +212,33 @@ NSString * const kPlacePageActionBarNibName = @"PlacePageActionBar"; NSAssert(false, @"Title can't be nil!"); } - if (isIOS7) + UIAlertController * alertController = + [UIAlertController alertControllerWithTitle:title + message:subtitle + preferredStyle:UIAlertControllerStyleActionSheet]; + UIAlertAction * cancelAction = + [UIAlertAction actionWithTitle:cancel style:UIAlertActionStyleCancel handler:nil]; + + for (auto i = 0; i < titles.count; i++) { - UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:title - delegate:self - cancelButtonTitle:cancel - destructiveButtonTitle:nil - otherButtonTitles:nil]; - - for (NSString * title in titles) - [actionSheet addButtonWithTitle:title]; - - [actionSheet showInView:vc.view]; + UIAlertAction * commonAction = + [UIAlertAction actionWithTitle:titles[i] + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { + [self tapOnButtonWithType:self->m_additionalButtons[i]]; + }]; + [alertController addAction:commonAction]; } - else + [alertController addAction:cancelAction]; + + if (IPAD) { - UIAlertController * alertController = - [UIAlertController alertControllerWithTitle:title - message:subtitle - preferredStyle:UIAlertControllerStyleActionSheet]; - UIAlertAction * cancelAction = - [UIAlertAction actionWithTitle:cancel style:UIAlertActionStyleCancel handler:nil]; - - for (auto i = 0; i < titles.count; i++) - { - UIAlertAction * commonAction = - [UIAlertAction actionWithTitle:titles[i] - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { - [self tapOnButtonWithType:self->m_additionalButtons[i]]; - }]; - [alertController addAction:commonAction]; - } - [alertController addAction:cancelAction]; - - if (IPAD) - { - UIPopoverPresentationController * popPresenter = - [alertController popoverPresentationController]; - popPresenter.sourceView = self.shareAnchor; - popPresenter.sourceRect = self.shareAnchor.bounds; - } - [vc presentViewController:alertController animated:YES completion:nil]; + UIPopoverPresentationController * popPresenter = + [alertController popoverPresentationController]; + popPresenter.sourceView = self.shareAnchor; + popPresenter.sourceRect = self.shareAnchor.bounds; } -} - -#pragma mark - UIActionSheetDelegate - -- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex -{ - [actionSheet dismissWithClickedButtonIndex:buttonIndex animated:YES]; - - // Using buttonIndex - 1 because there is cancel button at index 0 - // Only iOS7 - if (buttonIndex > 0) - [self tapOnButtonWithType:m_additionalButtons[buttonIndex - 1]]; + [vc presentViewController:alertController animated:YES completion:nil]; } #pragma mark - Layout diff --git a/iphone/Maps/Classes/MWMPlacePageBookmarkCell.mm b/iphone/Maps/Classes/MWMPlacePageBookmarkCell.mm index 6118ac74b4..842528fbee 100644 --- a/iphone/Maps/Classes/MWMPlacePageBookmarkCell.mm +++ b/iphone/Maps/Classes/MWMPlacePageBookmarkCell.mm @@ -14,13 +14,7 @@ CGFloat const kTextViewLeft = 16.; void performRenderingInConcurrentQueue(TMWMVoidBlock block) { - if (!block) - return; - - // We can't render html in the background queue in iOS7. - if (isIOS7) - block(); - else + if (block) dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block); } @@ -189,9 +183,7 @@ void performRenderingInConcurrentQueue(TMWMVoidBlock block) - (void)textViewScrollEnabled:(BOOL)isEnabled { - // Here is hook for iOS7 because if we disable scrol in iOS7 content size will be incorrect. - if (!isIOS7) - self.textView.scrollEnabled = isEnabled; + self.textView.scrollEnabled = isEnabled; } - (IBAction)moreTap { [self.delegate moreTap]; } diff --git a/iphone/Maps/Classes/MWMSegue.mm b/iphone/Maps/Classes/MWMSegue.mm index de7a3276c7..ff60a6405b 100644 --- a/iphone/Maps/Classes/MWMSegue.mm +++ b/iphone/Maps/Classes/MWMSegue.mm @@ -12,17 +12,7 @@ { UINavigationController * nc = self.sourceViewController.navigationController; UIViewController * dvc = self.destinationViewController; - if (isIOS7) - { - if ([dvc isMemberOfClass:[UINavigationController class]]) - [nc presentViewController:dvc animated:YES completion:nil]; - else - [nc pushViewController:dvc animated:YES]; - } - else - { - [nc showViewController:dvc sender:nil]; - } + [nc showViewController:dvc sender:nil]; } @end diff --git a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderLargeCountryTableViewCell.mm b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderLargeCountryTableViewCell.mm index 85a3dc186e..bd2f4272ce 100644 --- a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderLargeCountryTableViewCell.mm +++ b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderLargeCountryTableViewCell.mm @@ -14,16 +14,6 @@ return 62.0; } -- (void)layoutSubviews -{ - [super layoutSubviews]; - if (isIOS7) - { - self.mapsCount.preferredMaxLayoutWidth = self.mapsCount.width; - [super layoutSubviews]; - } -} - #pragma mark - Config - (void)config:(storage::NodeAttrs const &)nodeAttrs diff --git a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderPlaceTableViewCell.mm b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderPlaceTableViewCell.mm index e3bc0a4d6b..225d11a34e 100644 --- a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderPlaceTableViewCell.mm +++ b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderPlaceTableViewCell.mm @@ -22,15 +22,6 @@ @implementation MWMMapDownloaderPlaceTableViewCell + (CGFloat)estimatedHeight { return 62.0; } -- (void)layoutSubviews -{ - [super layoutSubviews]; - if (isIOS7) - { - self.descriptionLabel.preferredMaxLayoutWidth = self.descriptionLabel.width; - [super layoutSubviews]; - } -} #pragma mark - Config diff --git a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderSubplaceTableViewCell.mm b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderSubplaceTableViewCell.mm index 063c743c7e..80cc859d0c 100644 --- a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderSubplaceTableViewCell.mm +++ b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderSubplaceTableViewCell.mm @@ -19,15 +19,6 @@ @implementation MWMMapDownloaderSubplaceTableViewCell + (CGFloat)estimatedHeight { return 82.0; } -- (void)layoutSubviews -{ - [super layoutSubviews]; - if (isIOS7) - { - self.subPlace.preferredMaxLayoutWidth = floor(self.subPlace.width); - [super layoutSubviews]; - } -} - (void)setSubplaceText:(NSString *)text { diff --git a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderTableViewCell.mm b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderTableViewCell.mm index e685999a16..638b27fcae 100644 --- a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderTableViewCell.mm +++ b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderTableViewCell.mm @@ -36,17 +36,6 @@ m_countryId = kInvalidCountryId; } -- (void)layoutSubviews -{ - [super layoutSubviews]; - if (isIOS7) - { - self.title.preferredMaxLayoutWidth = floor(self.title.width); - self.downloadSize.preferredMaxLayoutWidth = floor(self.downloadSize.width); - [super layoutSubviews]; - } -} - #pragma mark - Search matching - (NSAttributedString *)matchedString:(NSString *)str diff --git a/iphone/Maps/Classes/MapDownloader/MWMBaseMapDownloaderViewController.mm b/iphone/Maps/Classes/MapDownloader/MWMBaseMapDownloaderViewController.mm index e28f151896..62e18dc934 100644 --- a/iphone/Maps/Classes/MapDownloader/MWMBaseMapDownloaderViewController.mm +++ b/iphone/Maps/Classes/MapDownloader/MWMBaseMapDownloaderViewController.mm @@ -66,8 +66,8 @@ NSString * const kControllerIdentifier = @"MWMMapDownloaderViewController"; using namespace storage; using namespace mwm; -@interface MWMBaseMapDownloaderViewController () +@interface MWMBaseMapDownloaderViewController () @property (weak, nonatomic) IBOutlet UITableView * tableView; @@ -84,9 +84,6 @@ using namespace mwm; @property (nonatomic) MWMMapDownloaderDataSource * dataSource; @property (nonatomic) MWMMapDownloaderDefaultDataSource * defaultDataSource; -@property(nonatomic) NSMutableDictionary * offscreenCells; -@property (nonatomic) NSMutableDictionary * cellHeightCache; - @property (nonatomic) BOOL skipCountryEventProcessing; @property (nonatomic) BOOL forceFullReload; @@ -176,11 +173,6 @@ using namespace mwm; [super backTap]; } -- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration -{ - [self.cellHeightCache removeAllObjects]; -} - - (void)notifyParentController { NSArray * viewControllers = [self.navigationController viewControllers]; @@ -241,11 +233,6 @@ using namespace mwm; - (void)configTable { self.tableView.separatorColor = [UIColor blackDividers]; - if (isIOS7) - { - self.offscreenCells = [@{} mutableCopy]; - self.cellHeightCache = [@{} mutableCopy]; - } [self registerCellWithIdentifier:kAdsCellIdentifier]; [self registerCellWithIdentifier:kButtonCellIdentifier]; [self registerCellWithIdentifier:kCountryCellIdentifier]; @@ -254,19 +241,6 @@ using namespace mwm; [self registerCellWithIdentifier:kSubplaceCellIdentifier]; } -#pragma mark - Offscreen cells - -- (MWMTableViewCell *)offscreenCellForIdentifier:(NSString *)reuseIdentifier -{ - MWMTableViewCell * cell = self.offscreenCells[reuseIdentifier]; - if (!cell) - { - cell = [[[NSBundle mainBundle] loadNibNamed:reuseIdentifier owner:nil options:nil] firstObject]; - self.offscreenCells[reuseIdentifier] = cell; - } - return cell; -} - #pragma mark - MWMMyTargetDelegate - (void)onAppWallRefresh { [self reloadTable]; } @@ -468,22 +442,7 @@ using namespace mwm; MTRGAppwallBannerAdView * adView = [adDataSource viewForBannerAtIndex:indexPath.row]; return [adView sizeThatFits:{CGRectGetWidth(tableView.bounds), 0}].height + 1; } - if (!isIOS7) - return UITableViewAutomaticDimension; - NSNumber * cacheHeight = self.cellHeightCache[indexPath]; - if (cacheHeight) - return cacheHeight.floatValue; - - MWMMapDownloaderTableViewCell * cell = static_cast( - [self offscreenCellForIdentifier:reuseIdentifier]); - [self.dataSource fillCell:cell atIndexPath:indexPath]; - cell.bounds = {{}, {CGRectGetWidth(tableView.bounds), CGRectGetHeight(cell.bounds)}}; - [cell setNeedsLayout]; - [cell layoutIfNeeded]; - CGSize const size = [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize]; - CGFloat const height = ceil(size.height + 0.5); - self.cellHeightCache[indexPath] = @(height); - return height; + return UITableViewAutomaticDimension; } - (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath @@ -584,45 +543,23 @@ using namespace mwm; NSString * title = @(nodeAttrs.m_nodeLocalName.c_str()); BOOL const isMultiParent = (nodeAttrs.m_parentInfo.size() > 1); NSString * message = (self.dataSource.isParentRoot || isMultiParent) - ? nil - : @(nodeAttrs.m_parentInfo[0].m_localName.c_str()); + ? nil + : @(nodeAttrs.m_parentInfo[0].m_localName.c_str()); - if (isIOS7) - { - UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:title - delegate:self - cancelButtonTitle:nil - destructiveButtonTitle:nil - otherButtonTitles:nil]; - [self addButtons:buttons toActionComponent:actionSheet]; - [actionSheet showFromRect:cell.frame inView:cellSuperView animated:YES]; - } - else - { - UIAlertController * alertController = - [UIAlertController alertControllerWithTitle:title - message:message - preferredStyle:UIAlertControllerStyleActionSheet]; - UITableViewCell * cell = [self.tableView cellForRowAtIndexPath:indexPath]; - alertController.popoverPresentationController.sourceView = cell; - alertController.popoverPresentationController.sourceRect = cell.bounds; - [self addButtons:buttons toActionComponent:alertController]; - [self presentViewController:alertController animated:YES completion:nil]; - } + UIAlertController * alertController = + [UIAlertController alertControllerWithTitle:title + message:message + preferredStyle:UIAlertControllerStyleActionSheet]; + alertController.popoverPresentationController.sourceView = cell; + alertController.popoverPresentationController.sourceRect = cell.bounds; + [self addButtons:buttons toActionComponent:alertController]; + [self presentViewController:alertController animated:YES completion:nil]; } -- (void)addButtons:(ActionButtons)buttons toActionComponent:(id)component +- (void)addButtons:(ActionButtons)buttons toActionComponent:(UIAlertController *)alertController { - UIActionSheet * actionSheet = nil; - UIAlertController * alertController = nil; - if ([component isKindOfClass:[UIActionSheet class]]) - actionSheet = component; - else if ([component isKindOfClass:[UIAlertController class]]) - alertController = component; - if (buttons & ShowOnMapAction) { - [actionSheet addButtonWithTitle:kShowOnMapActionTitle]; UIAlertAction * action = [UIAlertAction actionWithTitle:kShowOnMapActionTitle style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) @@ -638,7 +575,6 @@ using namespace mwm; NSString * prefix = nodeAttrs.m_mwmCounter == 1 ? kDownloadActionTitle : kDownloadAllActionTitle; NSString * title = [NSString stringWithFormat:kAllMapsLabelFormat, prefix, formattedSize(nodeAttrs.m_mwmSize - nodeAttrs.m_localMwmSize)]; - [actionSheet addButtonWithTitle:title]; UIAlertAction * action = [UIAlertAction actionWithTitle:title style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) @@ -652,7 +588,6 @@ using namespace mwm; s.GetUpdateInfo(m_actionSheetId, updateInfo); NSString * title = [NSString stringWithFormat:kAllMapsLabelFormat, kUpdateActionTitle, formattedSize(updateInfo.m_totalUpdateSizeInBytes)]; - [actionSheet addButtonWithTitle:title]; UIAlertAction * action = [UIAlertAction actionWithTitle:title style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) @@ -662,8 +597,6 @@ using namespace mwm; if (buttons & CancelDownloadAction) { - [actionSheet addButtonWithTitle:kCancelDownloadActionTitle]; - actionSheet.destructiveButtonIndex = actionSheet.numberOfButtons - 1; UIAlertAction * action = [UIAlertAction actionWithTitle:kCancelDownloadActionTitle style:UIAlertActionStyleDestructive handler:^(UIAlertAction * action) @@ -673,7 +606,6 @@ using namespace mwm; if (buttons & RetryDownloadAction) { - [actionSheet addButtonWithTitle:kRetryActionTitle]; UIAlertAction * action = [UIAlertAction actionWithTitle:kRetryActionTitle style:UIAlertActionStyleDestructive handler:^(UIAlertAction * action) @@ -683,8 +615,6 @@ using namespace mwm; if (buttons & DeleteAction) { - [actionSheet addButtonWithTitle:kDeleteActionTitle]; - actionSheet.destructiveButtonIndex = actionSheet.numberOfButtons - 1; UIAlertAction * action = [UIAlertAction actionWithTitle:kDeleteActionTitle style:UIAlertActionStyleDestructive handler:^(UIAlertAction * action) @@ -692,43 +622,12 @@ using namespace mwm; [alertController addAction:action]; } - if (!IPAD) - { - [actionSheet addButtonWithTitle:kCancelActionTitle]; - actionSheet.cancelButtonIndex = actionSheet.numberOfButtons - 1; - } UIAlertAction * action = [UIAlertAction actionWithTitle:kCancelActionTitle style:UIAlertActionStyleCancel handler:nil]; [alertController addAction:action]; } -#pragma mark - UIActionSheetDelegate - -- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex -{ - if (actionSheet.numberOfButtons == 0 || buttonIndex >= actionSheet.numberOfButtons || buttonIndex < 0) - { - [actionSheet dismissWithClickedButtonIndex:0 animated:NO]; - return; - } - NSString * btnTitle = [actionSheet buttonTitleAtIndex:buttonIndex]; - if ([btnTitle rangeOfString:kShowOnMapActionTitle].location != NSNotFound) - [self showNode:m_actionSheetId]; - else if ([btnTitle rangeOfString:kDownloadAllActionTitle].location != NSNotFound) - [self downloadNode:m_actionSheetId]; - else if ([btnTitle rangeOfString:kDownloadActionTitle].location != NSNotFound) - [self downloadNode:m_actionSheetId]; - else if ([btnTitle rangeOfString:kUpdateActionTitle].location != NSNotFound) - [self updateNode:m_actionSheetId]; - else if ([btnTitle rangeOfString:kCancelDownloadActionTitle].location != NSNotFound) - [self cancelNode:m_actionSheetId]; - else if ([btnTitle rangeOfString:kRetryActionTitle].location != NSNotFound) - [self retryDownloadNode:m_actionSheetId]; - else if ([btnTitle rangeOfString:kDeleteActionTitle].location != NSNotFound) - [self deleteNode:m_actionSheetId]; -} - #pragma mark - Countries tree(s) navigation - (void)openAvailableMaps @@ -892,8 +791,6 @@ using namespace mwm; - (void)reloadTable { - [self.cellHeightCache removeAllObjects]; - UITableView * tableView = self.tableView; // If these methods are not called, tableView will not call tableView:cellForRowAtIndexPath: [tableView setNeedsLayout]; diff --git a/iphone/Maps/Classes/MapDownloader/NoMaps/MWMNoMapsView.mm b/iphone/Maps/Classes/MapDownloader/NoMaps/MWMNoMapsView.mm index 78e0571cd4..efe8a7b3f3 100644 --- a/iphone/Maps/Classes/MapDownloader/NoMaps/MWMNoMapsView.mm +++ b/iphone/Maps/Classes/MapDownloader/NoMaps/MWMNoMapsView.mm @@ -27,23 +27,12 @@ [super awakeFromNib]; if (!IPAD) { - if (isIOS7) - { - self.containerWidth.priority = UILayoutPriorityFittingSizeLevel; - self.containerHeight.priority = UILayoutPriorityFittingSizeLevel; - } - else - { - self.containerWidth.active = NO; - self.containerHeight.active = NO; - } + self.containerWidth.active = NO; + self.containerHeight.active = NO; } else { - if (isIOS7) - self.containerTopOffset.priority = UILayoutPriorityFittingSizeLevel; - else - self.containerTopOffset.active = NO; + self.containerTopOffset.active = NO; } [MWMKeyboard addObserver:self]; } diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index 1e2d6c1a27..acb07db231 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -206,7 +206,7 @@ BOOL gIsFirstMyPositionMode = YES; - (BOOL)hasForceTouch { - if (isIOS7 || isIOS8) + if (isIOS8) return NO; return self.view.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable; } @@ -298,9 +298,6 @@ BOOL gIsFirstMyPositionMode = YES; - (void)showWelcomeScreenIfNeeded { - if (isIOS7) - return; - Class whatsNewClass = [MWMWhatsNewProfileBookingController class]; BOOL const isFirstSession = [Alohalytics isFirstSession]; Class welcomeClass = @@ -356,15 +353,6 @@ BOOL gIsFirstMyPositionMode = YES; object:nil]; } -- (void)presentViewController:(UIViewController *)viewControllerToPresent - animated:(BOOL)flag - completion:(TMWMVoidBlock)completion -{ - if (isIOS7) - self.controlsManager.menuRestoreState = self.controlsManager.menuState; - [super presentViewController:viewControllerToPresent animated:flag completion:completion]; -} - - (void)orientationChanged:(NSNotification *)notification { [self willRotateToInterfaceOrientation:self.interfaceOrientation duration:0.]; diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm index 3cee6feda8..3433d6050f 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.mm +++ b/iphone/Maps/Classes/MapsAppDelegate.mm @@ -762,9 +762,7 @@ using namespace osm_auth_ios; [navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault]; navigationBar.shadowImage = [UIImage imageWithColor:[UIColor fadeBackground]]; navigationBar.titleTextAttributes = [self navigationBarTextAttributes]; - // Workaround for ios 7 crash. - if (!isIOS7) - navigationBar.translucent = NO; + navigationBar.translucent = NO; } + (void)customizeAppearance @@ -790,7 +788,7 @@ using namespace osm_auth_ios; UISearchBar * searchBar = [UISearchBar appearance]; searchBar.barTintColor = [UIColor primary]; UITextField * textFieldInSearchBar = nil; - if (isIOS7 || isIOS8) + if (isIOS8) textFieldInSearchBar = [UITextField appearanceWhenContainedIn:[UISearchBar class], nil]; else textFieldInSearchBar = @@ -1096,7 +1094,7 @@ using namespace osm_auth_ios; - (MWMMyTarget *)myTarget { - if (!isIOS7 && !_myTarget) + if (!_myTarget) _myTarget = [[MWMMyTarget alloc] init]; return _myTarget; } diff --git a/iphone/Maps/Classes/Migration/MWMMigrationView.mm b/iphone/Maps/Classes/Migration/MWMMigrationView.mm index 22d1b67d4a..adee175ffd 100644 --- a/iphone/Maps/Classes/Migration/MWMMigrationView.mm +++ b/iphone/Maps/Classes/Migration/MWMMigrationView.mm @@ -99,13 +99,6 @@ self.bounds = {{}, {width, height}}; } -- (void)setBounds:(CGRect)bounds -{ - if (isIOS7) - [self updateForSize:bounds.size]; - super.bounds = bounds; -} - #pragma mark - Properties - (void)setState:(MWMMigrationViewState)state diff --git a/iphone/Maps/Classes/Widgets/MWMMapDownloadDialog.mm b/iphone/Maps/Classes/Widgets/MWMMapDownloadDialog.mm index f15d8c55d8..abcf942e0c 100644 --- a/iphone/Maps/Classes/Widgets/MWMMapDownloadDialog.mm +++ b/iphone/Maps/Classes/Widgets/MWMMapDownloadDialog.mm @@ -87,13 +87,6 @@ using namespace storage; [self layoutIfNeeded]; }]; [super layoutSubviews]; - if (isIOS7) - { - self.parentNode.preferredMaxLayoutWidth = floor(self.parentNode.width); - self.node.preferredMaxLayoutWidth = floor(self.node.width); - self.nodeSize.preferredMaxLayoutWidth = floor(self.nodeSize.width); - [super layoutSubviews]; - } } - (void)configDialog diff --git a/iphone/Maps/MWMHelpController.mm b/iphone/Maps/MWMHelpController.mm index 8b48aa4756..c843ea7204 100644 --- a/iphone/Maps/MWMHelpController.mm +++ b/iphone/Maps/MWMHelpController.mm @@ -79,7 +79,7 @@ NSString * const kCancelActionTitle = L(@"cancel"); NSString * const kiOSEmail = @"ios@maps.me"; } -@interface MWMHelpController () +@interface MWMHelpController () @property(nonatomic) WebViewController * aboutViewController; @@ -148,25 +148,6 @@ NSString * const kiOSEmail = @"ios@maps.me"; } - (IBAction)reportBug -{ - if (isIOS7) - [self reportIOS7]; - else - [self reportRegular]; -} - -- (void)reportIOS7 -{ - UIActionSheet * actionSheet = - [[UIActionSheet alloc] initWithTitle:nil - delegate:self - cancelButtonTitle:kCancelActionTitle - destructiveButtonTitle:nil - otherButtonTitles:kCommonReportActionTitle, kBugReportActionTitle, nil]; - [actionSheet showInView:self.view]; -} - -- (void)reportRegular { UIAlertController * alert = [UIAlertController alertControllerWithTitle:L(@"feedback") @@ -270,21 +251,4 @@ NSString * const kiOSEmail = @"ios@maps.me"; [self dismissViewControllerAnimated:YES completion:nil]; } -#pragma mark - UIActionSheetDelegate - -- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex -{ - if (actionSheet.numberOfButtons == 0 || buttonIndex >= actionSheet.numberOfButtons || - buttonIndex < 0) - { - [actionSheet dismissWithClickedButtonIndex:0 animated:NO]; - return; - } - NSString * btnTitle = [actionSheet buttonTitleAtIndex:buttonIndex]; - if ([btnTitle isEqualToString:kCommonReportActionTitle]) - [self commonReportAction]; - else if ([btnTitle isEqualToString:kBugReportActionTitle]) - [self bugReportAction]; -} - @end diff --git a/iphone/Maps/MyTarget/MWMMyTarget.mm b/iphone/Maps/MyTarget/MWMMyTarget.mm index e107808f6a..fbad09f8ef 100644 --- a/iphone/Maps/MyTarget/MWMMyTarget.mm +++ b/iphone/Maps/MyTarget/MWMMyTarget.mm @@ -48,7 +48,7 @@ if (self.bannersCount != 0) return; [self.appWallAd close]; - if (isIOS7 || [MWMSettings adServerForbidden] || [MWMSettings adForbidden]) + if ([MWMSettings adServerForbidden] || [MWMSettings adForbidden]) return; self.appWallAd = [[MTRGNativeAppwallAd alloc] initWithSlotId:MY_TARGET_KEY]; self.appWallAd.closeButtonTitle = L(@"close"); @@ -74,8 +74,6 @@ + (void)startAdServerForbiddenCheckTimer { - if (isIOS7) - return; MWMMyTarget * manager = [self manager]; [manager checkAdServerForbidden]; [manager.checkAdServerForbiddenTimer invalidate]; diff --git a/iphone/Maps/UIFont+MapsMeFonts.mm b/iphone/Maps/UIFont+MapsMeFonts.mm index 9668bf08e5..e2f907229c 100644 --- a/iphone/Maps/UIFont+MapsMeFonts.mm +++ b/iphone/Maps/UIFont+MapsMeFonts.mm @@ -17,123 +17,21 @@ NSString * const kLightFontName = @"HelveticaNeue-Light"; + (UIFont *)regular24 { return [UIFont systemFontOfSize:24]; } + (UIFont *)regular32 { return [UIFont systemFontOfSize:32]; } + (UIFont *)regular52 { return [UIFont systemFontOfSize:52]; } -+ (UIFont *)medium10 -{ - CGFloat const size = 10; - if (isIOS7) - return [UIFont fontWithName:kMediumFontName size:size]; - return [UIFont systemFontOfSize:size weight:UIFontWeightMedium]; -} -+ (UIFont *)medium14 -{ - CGFloat const size = 14; - if (isIOS7) - return [UIFont fontWithName:kMediumFontName size:size]; - return [UIFont systemFontOfSize:size weight:UIFontWeightMedium]; -} -+ (UIFont *)medium16 -{ - CGFloat const size = 16; - if (isIOS7) - return [UIFont fontWithName:kMediumFontName size:size]; - return [UIFont systemFontOfSize:size weight:UIFontWeightMedium]; -} - -+ (UIFont *)medium17 -{ - CGFloat const size = 17; - if (isIOS7) - return [UIFont fontWithName:kMediumFontName size:size]; - return [UIFont systemFontOfSize:size weight:UIFontWeightMedium]; -} -+ (UIFont *)medium18 -{ - CGFloat const size = 18; - if (isIOS7) - return [UIFont fontWithName:kMediumFontName size:size]; - return [UIFont systemFontOfSize:size weight:UIFontWeightMedium]; -} - -+ (UIFont *)medium20 -{ - CGFloat const size = 20; - if (isIOS7) - return [UIFont fontWithName:kMediumFontName size:size]; - return [UIFont systemFontOfSize:size weight:UIFontWeightMedium]; -} - -+ (UIFont *)medium24 -{ - CGFloat const size = 24; - if (isIOS7) - return [UIFont fontWithName:kMediumFontName size:size]; - return [UIFont systemFontOfSize:size weight:UIFontWeightMedium]; -} - -+ (UIFont *)medium28 -{ - CGFloat const size = 28; - if (isIOS7) - return [UIFont fontWithName:kMediumFontName size:size]; - return [UIFont systemFontOfSize:size weight:UIFontWeightMedium]; -} - -+ (UIFont *)medium36 -{ - CGFloat const size = 36; - if (isIOS7) - return [UIFont fontWithName:kMediumFontName size:size]; - return [UIFont systemFontOfSize:size weight:UIFontWeightMedium]; -} - -+ (UIFont *)medium40 -{ - CGFloat const size = 40; - if (isIOS7) - return [UIFont fontWithName:kMediumFontName size:size]; - return [UIFont systemFontOfSize:size weight:UIFontWeightMedium]; -} - -+ (UIFont *)medium44 -{ - CGFloat const size = 44; - if (isIOS7) - return [UIFont fontWithName:kMediumFontName size:size]; - return [UIFont systemFontOfSize:size weight:UIFontWeightMedium]; -} - -+ (UIFont *)light10 -{ - CGFloat const size = 10; - if (isIOS7) - return [UIFont fontWithName:kLightFontName size:size]; - return [UIFont systemFontOfSize:size weight:UIFontWeightLight]; -} - -+ (UIFont *)light12 -{ - CGFloat const size = 12; - if (isIOS7) - return [UIFont fontWithName:kLightFontName size:size]; - return [UIFont systemFontOfSize:size weight:UIFontWeightLight]; -} - -+ (UIFont *)light16 -{ - CGFloat const size = 16; - if (isIOS7) - return [UIFont fontWithName:kLightFontName size:size]; - return [UIFont systemFontOfSize:size weight:UIFontWeightLight]; -} - -+ (UIFont *)light17 -{ - CGFloat const size = 17; - if (isIOS7) - return [UIFont fontWithName:kLightFontName size:size]; - return [UIFont systemFontOfSize:size weight:UIFontWeightLight]; -} - ++ (UIFont *)medium10 { return [UIFont systemFontOfSize:10 weight:UIFontWeightMedium]; } ++ (UIFont *)medium14 { return [UIFont systemFontOfSize:14 weight:UIFontWeightMedium]; } ++ (UIFont *)medium16 { return [UIFont systemFontOfSize:16 weight:UIFontWeightMedium]; } ++ (UIFont *)medium17 { return [UIFont systemFontOfSize:17 weight:UIFontWeightMedium]; } ++ (UIFont *)medium18 { return [UIFont systemFontOfSize:18 weight:UIFontWeightMedium]; } ++ (UIFont *)medium20 { return [UIFont systemFontOfSize:20 weight:UIFontWeightMedium]; } ++ (UIFont *)medium24 { return [UIFont systemFontOfSize:24 weight:UIFontWeightMedium]; } ++ (UIFont *)medium28 { return [UIFont systemFontOfSize:28 weight:UIFontWeightMedium]; } ++ (UIFont *)medium36 { return [UIFont systemFontOfSize:36 weight:UIFontWeightMedium]; } ++ (UIFont *)medium40 { return [UIFont systemFontOfSize:40 weight:UIFontWeightMedium]; } ++ (UIFont *)medium44 { return [UIFont systemFontOfSize:44 weight:UIFontWeightMedium]; } ++ (UIFont *)light10 { return [UIFont systemFontOfSize:10 weight:UIFontWeightLight]; } ++ (UIFont *)light12 { return [UIFont systemFontOfSize:12 weight:UIFontWeightLight]; } ++ (UIFont *)light16 { return [UIFont systemFontOfSize:16 weight:UIFontWeightLight]; } ++ (UIFont *)light17 { return [UIFont systemFontOfSize:17 weight:UIFontWeightLight]; } + (UIFont *)bold12 { return [UIFont boldSystemFontOfSize:12]; } + (UIFont *)bold14 { return [UIFont boldSystemFontOfSize:14]; } + (UIFont *)bold16 { return [UIFont boldSystemFontOfSize:16]; } diff --git a/iphone/Maps/UIImageView+Coloring.mm b/iphone/Maps/UIImageView+Coloring.mm index 2eef300c28..4a20fe97c3 100644 --- a/iphone/Maps/UIImageView+Coloring.mm +++ b/iphone/Maps/UIImageView+Coloring.mm @@ -21,8 +21,6 @@ OBJC_ASSOCIATION_RETAIN_NONATOMIC); if (mwm_coloring == MWMImageColoringOther) return; - if (isIOS7) - [self makeImageAlwaysTemplate]; [self applyColoring]; } @@ -37,8 +35,6 @@ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Warc-performSelector-leaks" self.tintColor = [[UIColor class] performSelector:self.coloringSelector]; - if (isIOS7 && self.mwm_coloring == MWMImageColoringSeparator) - self.backgroundColor = [[UIColor class] performSelector:self.coloringSelector]; #pragma clang diagnostic pop } @@ -52,8 +48,6 @@ [UIColor isNightMode] ? @"dark" : @"light"]]; return; } - if (isIOS7) - [self makeImageAlwaysTemplate]; [self applyColoring]; }