From 3379af2253a7c54cc45492b7c9e0e8febaf8e8b1 Mon Sep 17 00:00:00 2001 From: Ilya Grechuhin Date: Wed, 20 Apr 2016 17:35:01 +0300 Subject: Review fixes. --- .../BottomMenu/MWMBottomMenuViewController.h | 2 +- .../BottomMenu/MWMBottomMenuViewController.mm | 2 +- .../MapViewControls/MWMMapViewControlsManager.mm | 2 +- .../MapViewControls/Search/MWMSearchManager.h | 2 +- .../MapViewControls/Search/MWMSearchManager.mm | 2 +- .../Cells/MWMMapDownloaderTableViewCell.h | 2 +- .../Cells/MWMMapDownloaderTableViewCell.mm | 9 +++-- .../DataSources/MWMMapDownloaderDataSource.h | 4 +- .../DataSources/MWMMapDownloaderDataSource.mm | 2 +- .../MWMMapDownloaderDefaultDataSource.h | 2 +- .../MWMMapDownloaderDefaultDataSource.mm | 7 ++-- .../MWMMapDownloaderExtendedDataSource.mm | 2 +- .../MWMMapDownloaderSearchDataSource.mm | 2 +- .../MWMBaseMapDownloaderViewController.h | 2 +- .../MWMBaseMapDownloaderViewController.mm | 42 +++++++++++++-------- .../Classes/MapDownloader/MWMMapDownloaderTypes.h | 5 ++- .../MWMMapDownloaderViewController.mm | 6 +-- iphone/Maps/Classes/MapViewController.h | 2 +- iphone/Maps/Classes/MapViewController.mm | 4 +- .../Migration/MWMMigrationViewController.mm | 2 +- iphone/Maps/Classes/UIViewController+Navigation.h | 3 +- iphone/Maps/Classes/UIViewController+Navigation.mm | 9 +---- .../ic_nav_bar_add_press.imageset/Contents.json | 23 ----------- .../ic_nav_bar_add_press.png | Bin 134 -> 0 bytes .../ic_nav_bar_add_press@2x.png | Bin 414 -> 0 bytes .../ic_nav_bar_add_press@3x.png | Bin 695 -> 0 bytes .../ic_nav_bar_back_press.imageset/Contents.json | 23 ----------- .../ic_nav_bar_back_press.png | Bin 139 -> 0 bytes .../ic_nav_bar_back_press@2x.png | Bin 195 -> 0 bytes .../ic_nav_bar_back_press@3x.png | Bin 241 -> 0 bytes 30 files changed, 62 insertions(+), 99 deletions(-) delete mode 100644 iphone/Maps/Images.xcassets/Downloader/ic_nav_bar_add_press.imageset/Contents.json delete mode 100644 iphone/Maps/Images.xcassets/Downloader/ic_nav_bar_add_press.imageset/ic_nav_bar_add_press.png delete mode 100644 iphone/Maps/Images.xcassets/Downloader/ic_nav_bar_add_press.imageset/ic_nav_bar_add_press@2x.png delete mode 100644 iphone/Maps/Images.xcassets/Downloader/ic_nav_bar_add_press.imageset/ic_nav_bar_add_press@3x.png delete mode 100644 iphone/Maps/Images.xcassets/Navigation Bar/ic_nav_bar_back_press.imageset/Contents.json delete mode 100644 iphone/Maps/Images.xcassets/Navigation Bar/ic_nav_bar_back_press.imageset/ic_nav_bar_back_press.png delete mode 100644 iphone/Maps/Images.xcassets/Navigation Bar/ic_nav_bar_back_press.imageset/ic_nav_bar_back_press@2x.png delete mode 100644 iphone/Maps/Images.xcassets/Navigation Bar/ic_nav_bar_back_press.imageset/ic_nav_bar_back_press@3x.png diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.h b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.h index 4a6d81070b..af66ba8c48 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.h +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.h @@ -7,7 +7,7 @@ @protocol MWMBottomMenuControllerProtocol -- (void)actionDownloadMaps:(TMWMMapDownloaderMode)mode; +- (void)actionDownloadMaps:(mwm::DownloaderMode)mode; - (void)closeInfoScreens; - (void)addPlace; - (void)didFinishAddingPlace; diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm index dcc976fc60..22081c793f 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm @@ -358,7 +358,7 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell) { [Statistics logEvent:kStatMenu withParameters:@{kStatButton : kStatDownloadMaps}]; self.state = self.restoreState; - [self.delegate actionDownloadMaps:TMWMMapDownloaderMode::Downloaded]; + [self.delegate actionDownloadMaps:mwm::DownloaderMode::Downloaded]; } - (void)menuActionOpenSettings diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm index ace8542bee..89db371326 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm @@ -255,7 +255,7 @@ extern NSString * const kAlohalyticsTapEventKey; #pragma mark - MWMSearchManagerProtocol & MWMBottomMenuControllerProtocol -- (void)actionDownloadMaps:(TMWMMapDownloaderMode)mode +- (void)actionDownloadMaps:(mwm::DownloaderMode)mode { if (platform::migrate::NeedMigrate()) { diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/MWMSearchManager.h b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/MWMSearchManager.h index 5187144c50..8a16eb8ddd 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/MWMSearchManager.h +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/MWMSearchManager.h @@ -16,7 +16,7 @@ typedef NS_ENUM(NSUInteger, MWMSearchManagerState) @property (nonnull, nonatomic, readonly) MWMAlertViewController * alertController; - (void)searchViewDidEnterState:(MWMSearchManagerState)state; -- (void)actionDownloadMaps:(TMWMMapDownloaderMode)mode; +- (void)actionDownloadMaps:(mwm::DownloaderMode)mode; @end diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/MWMSearchManager.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/MWMSearchManager.mm index 40229a7f0a..bee828d13a 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/MWMSearchManager.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/MWMSearchManager.mm @@ -220,7 +220,7 @@ extern NSString * const kSearchStateKey = @"SearchStateKey"; - (void)handleDownloadMapsAction { - [self.delegate actionDownloadMaps:TMWMMapDownloaderMode::Available]; + [self.delegate actionDownloadMaps:mwm::DownloaderMode::Available]; } #pragma mark - State changes diff --git a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderTableViewCell.h b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderTableViewCell.h index 9dbd3855ff..e523a73cee 100644 --- a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderTableViewCell.h +++ b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderTableViewCell.h @@ -10,7 +10,7 @@ @property (nonatomic) BOOL isHeightCell; @property (weak, nonatomic) id delegate; -@property (nonatomic) TMWMMapDownloaderMode mode; +@property (nonatomic) mwm::DownloaderMode mode; - (void)config:(storage::NodeAttrs const &)nodeAttrs; - (void)setCountryId:(NSString *)countryId searchQuery:(NSString *)query; diff --git a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderTableViewCell.mm b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderTableViewCell.mm index 80a615c410..14cdb5de97 100644 --- a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderTableViewCell.mm +++ b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderTableViewCell.mm @@ -85,7 +85,7 @@ namespace - (void)configProgress:(storage::NodeAttrs const &)nodeAttrs { MWMCircularProgress * progress = self.progress; - MWMButtonColoring const coloring = self.mode == TMWMMapDownloaderMode::Downloaded + MWMButtonColoring const coloring = self.mode == mwm::DownloaderMode::Downloaded ? MWMButtonColoringBlack : MWMButtonColoringBlue; switch (nodeAttrs.m_status) @@ -93,8 +93,8 @@ namespace case NodeStatus::NotDownloaded: case NodeStatus::Partly: { - auto const affectedStates = {MWMCircularProgressStateNormal, - MWMCircularProgressStateSelected}; + MWMCircularProgressStateVec const affectedStates = {MWMCircularProgressStateNormal, + MWMCircularProgressStateSelected}; UIImage * image = [self isKindOfClass:[MWMMapDownloaderLargeCountryTableViewCell class]] ? [UIImage imageNamed:@"ic_folder"] : [UIImage imageNamed:@"ic_download"]; @@ -121,7 +121,8 @@ namespace break; case NodeStatus::OnDiskOutOfDate: { - auto const affectedStates = {MWMCircularProgressStateNormal, MWMCircularProgressStateSelected}; + MWMCircularProgressStateVec const affectedStates = {MWMCircularProgressStateNormal, + MWMCircularProgressStateSelected}; [progress setImage:[UIImage imageNamed:@"ic_update"] forStates:affectedStates]; [progress setColoring:MWMButtonColoringOther forStates:affectedStates]; progress.state = MWMCircularProgressStateNormal; diff --git a/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderDataSource.h b/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderDataSource.h index 5672375770..0b1e897fa7 100644 --- a/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderDataSource.h +++ b/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderDataSource.h @@ -8,10 +8,10 @@ @interface MWMMapDownloaderDataSource : NSObject @property (nonatomic, readonly) BOOL isParentRoot; -@property (nonatomic, readonly) TMWMMapDownloaderMode mode; +@property (nonatomic, readonly) mwm::DownloaderMode mode; @property (weak, nonatomic, readonly) id delegate; -- (instancetype)initWithDelegate:(id)delegate mode:(TMWMMapDownloaderMode)mode; +- (instancetype)initWithDelegate:(id)delegate mode:(mwm::DownloaderMode)mode; - (NSString *)parentCountryId; - (NSString *)countryIdForIndexPath:(NSIndexPath *)indexPath; - (NSString *)cellIdentifierForIndexPath:(NSIndexPath *)indexPath; diff --git a/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderDataSource.mm b/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderDataSource.mm index cafe47424a..89f13644b4 100644 --- a/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderDataSource.mm +++ b/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderDataSource.mm @@ -11,7 +11,7 @@ using namespace storage; @implementation MWMMapDownloaderDataSource -- (instancetype)initWithDelegate:(id)delegate mode:(TMWMMapDownloaderMode)mode +- (instancetype)initWithDelegate:(id)delegate mode:(mwm::DownloaderMode)mode { self = [super init]; if (self) diff --git a/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderDefaultDataSource.h b/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderDefaultDataSource.h index c54e88f0db..67dff52d54 100644 --- a/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderDefaultDataSource.h +++ b/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderDefaultDataSource.h @@ -2,7 +2,7 @@ @interface MWMMapDownloaderDefaultDataSource : MWMMapDownloaderDataSource -- (instancetype)initForRootCountryId:(NSString *)countryId delegate:(id)delegate mode:(TMWMMapDownloaderMode)mode; +- (instancetype)initForRootCountryId:(NSString *)countryId delegate:(id)delegate mode:(mwm::DownloaderMode)mode; - (void)load; @end diff --git a/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderDefaultDataSource.mm b/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderDefaultDataSource.mm index 9e8212486c..0258966fd7 100644 --- a/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderDefaultDataSource.mm +++ b/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderDefaultDataSource.mm @@ -29,6 +29,7 @@ auto compareLocalNames = ^NSComparisonResult(NSString * s1, NSString * s2) } // namespace using namespace storage; +using namespace mwm; @interface MWMMapDownloaderDefaultDataSource () @@ -45,7 +46,7 @@ using namespace storage; @synthesize isParentRoot = _isParentRoot; -- (instancetype)initForRootCountryId:(NSString *)countryId delegate:(id)delegate mode:(TMWMMapDownloaderMode)mode +- (instancetype)initForRootCountryId:(NSString *)countryId delegate:(id)delegate mode:(DownloaderMode)mode { self = [super initWithDelegate:delegate mode:mode]; if (self) @@ -62,8 +63,8 @@ using namespace storage; auto const & s = GetFramework().Storage(); TCountriesVec downloadedChildren; TCountriesVec availableChildren; - s.GetChildrenInGroups(m_parentId, downloadedChildren, availableChildren, true); - if (self.mode == TMWMMapDownloaderMode::Available) + s.GetChildrenInGroups(m_parentId, downloadedChildren, availableChildren, true /* keepAvailableChildren */); + if (self.mode == DownloaderMode::Available) { self.downloadedCountries = nil; [self configAvailableSections:availableChildren]; diff --git a/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderExtendedDataSource.mm b/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderExtendedDataSource.mm index 71f8770b1e..3a54d00787 100644 --- a/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderExtendedDataSource.mm +++ b/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderExtendedDataSource.mm @@ -25,7 +25,7 @@ using namespace storage; - (void)load { [super load]; - if (self.mode == TMWMMapDownloaderMode::Available) + if (self.mode == mwm::DownloaderMode::Available) [self configNearMeSection]; } diff --git a/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderSearchDataSource.mm b/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderSearchDataSource.mm index 28dfda0044..b36c58eb2c 100644 --- a/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderSearchDataSource.mm +++ b/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderSearchDataSource.mm @@ -21,7 +21,7 @@ extern NSString * const kLargeCountryCellIdentifier; - (instancetype)initWithSearchResults:(DownloaderSearchResults const &)results delegate:(id)delegate { - self = [super initWithDelegate:delegate mode:TMWMMapDownloaderMode::Available]; + self = [super initWithDelegate:delegate mode:mwm::DownloaderMode::Available]; if (self) { NSMutableOrderedSet * nsSearchCountryIds = diff --git a/iphone/Maps/Classes/MapDownloader/MWMBaseMapDownloaderViewController.h b/iphone/Maps/Classes/MapDownloader/MWMBaseMapDownloaderViewController.h index 5239c31769..c2bb32f970 100644 --- a/iphone/Maps/Classes/MapDownloader/MWMBaseMapDownloaderViewController.h +++ b/iphone/Maps/Classes/MapDownloader/MWMBaseMapDownloaderViewController.h @@ -8,6 +8,6 @@ - (void)configTable; - (void)configAllMapsView; -- (void)setParentCountryId:(NSString *)parentId mode:(TMWMMapDownloaderMode)mode; +- (void)setParentCountryId:(NSString *)parentId mode:(mwm::DownloaderMode)mode; @end diff --git a/iphone/Maps/Classes/MapDownloader/MWMBaseMapDownloaderViewController.mm b/iphone/Maps/Classes/MapDownloader/MWMBaseMapDownloaderViewController.mm index c97c0994cc..b5e2fb2dd6 100644 --- a/iphone/Maps/Classes/MapDownloader/MWMBaseMapDownloaderViewController.mm +++ b/iphone/Maps/Classes/MapDownloader/MWMBaseMapDownloaderViewController.mm @@ -57,6 +57,9 @@ NSString * const kBaseControllerIdentifier = @"MWMBaseMapDownloaderViewControlle NSString * const kControllerIdentifier = @"MWMMapDownloaderViewController"; } // namespace +using namespace storage; +using namespace mwm; + @interface MWMBaseMapDownloaderViewController () @property (weak, nonatomic) IBOutlet UITableView * tableView; @@ -81,14 +84,12 @@ NSString * const kControllerIdentifier = @"MWMMapDownloaderViewController"; @property (nonatomic) BOOL forceFullReload; @property (nonatomic, readonly) NSString * parentCountryId; -@property (nonatomic, readonly) TMWMMapDownloaderMode mode; +@property (nonatomic, readonly) DownloaderMode mode; @property (nonatomic) BOOL showAllMapsButtons; @end -using namespace storage; - @implementation MWMBaseMapDownloaderViewController { TCountryId m_actionSheetId; @@ -132,7 +133,7 @@ using namespace storage; - (void)configNavBar { - BOOL const downloaded = self.mode == TMWMMapDownloaderMode::Downloaded; + BOOL const downloaded = self.mode == DownloaderMode::Downloaded; if (self.dataSource.isParentRoot) { self.title = downloaded ? L(@"downloader_my_maps_title") : L(@"download_maps"); @@ -146,10 +147,8 @@ using namespace storage; if (downloaded) { - UIBarButtonItem * addButton = - [self navBarButtonWithImage:[UIImage imageNamed:@"ic_nav_bar_add"] - highlightedImage:[UIImage imageNamed:@"ic_nav_bar_add_press"] - action:@selector(openAvailableMaps)]; + UIBarButtonItem * addButton = [self buttonWithImage:[UIImage imageNamed:@"ic_nav_bar_add"] + action:@selector(openAvailableMaps)]; self.navigationItem.rightBarButtonItems = [self alignedNavBarButtonItems:@[ addButton ]]; } } @@ -266,7 +265,7 @@ using namespace storage; { auto const & s = GetFramework().Storage(); TCountryId const parentCountryId = self.parentCountryId.UTF8String; - if (self.mode == TMWMMapDownloaderMode::Downloaded) + if (self.mode == DownloaderMode::Downloaded) { Storage::UpdateInfo updateInfo{}; s.GetUpdateInfo(parentCountryId, updateInfo); @@ -361,7 +360,7 @@ using namespace storage; { self.skipCountryEventProcessing = YES; TCountryId const parentCountryId = self.parentCountryId.UTF8String; - if (self.mode == TMWMMapDownloaderMode::Downloaded) + if (self.mode == DownloaderMode::Downloaded) { [Statistics logEvent:kStatDownloaderMapAction withParameters:@{ @@ -412,9 +411,16 @@ using namespace storage; [tableView deselectRowAtIndexPath:indexPath animated:YES]; NSString * identifier = [self.dataSource cellIdentifierForIndexPath:indexPath]; if ([identifier isEqualToString:kLargeCountryCellIdentifier]) - [self openNodeSubtree:[self.dataSource countryIdForIndexPath:indexPath].UTF8String]; + { + NSAssert(self.dataSource != nil, @"Datasource is nil."); + NSString * countyId = [self.dataSource countryIdForIndexPath:indexPath]; + NSAssert(countyId != nil, @"CountryId is nil."); + [self openNodeSubtree:countyId.UTF8String]; + } else + { [self showActionSheetForRowAtIndexPath:indexPath]; + } } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath @@ -473,7 +479,10 @@ using namespace storage; { auto const & s = GetFramework().Storage(); NodeAttrs nodeAttrs; - m_actionSheetId = [self.dataSource countryIdForIndexPath:indexPath].UTF8String; + NSAssert(self.dataSource != nil, @"Datasource is nil."); + NSString * countyId = [self.dataSource countryIdForIndexPath:indexPath]; + NSAssert(countyId != nil, @"CountryId is nil."); + m_actionSheetId = countyId.UTF8String; s.GetNodeAttrs(m_actionSheetId, nodeAttrs); ActionButtons buttons = NoAction; @@ -592,7 +601,8 @@ using namespace storage; { NodeAttrs nodeAttrs; s.GetNodeAttrs(countryId, nodeAttrs); - updateSize += nodeAttrs.m_mwmSize; + if (nodeAttrs.m_status == NodeStatus::OnDiskOutOfDate) + updateSize += nodeAttrs.m_mwmSize; } NSString * title = [NSString stringWithFormat:kAllMapsLabelFormat, kUpdateActionTitle, formattedSize(updateSize)]; @@ -680,7 +690,7 @@ using namespace storage; BOOL const isParentRoot = [self.parentCountryId isEqualToString:@(GetFramework().Storage().GetRootId().c_str())]; NSString * identifier = isParentRoot ? kControllerIdentifier : kBaseControllerIdentifier; MWMBaseMapDownloaderViewController * vc = [self.storyboard instantiateViewControllerWithIdentifier:identifier]; - [vc setParentCountryId:self.parentCountryId mode:TMWMMapDownloaderMode::Available]; + [vc setParentCountryId:self.parentCountryId mode:DownloaderMode::Available]; [MWMSegue segueFrom:self to:vc]; } @@ -782,7 +792,7 @@ using namespace storage; #pragma mark - Configuration -- (void)setParentCountryId:(NSString *)parentId mode:(TMWMMapDownloaderMode)mode +- (void)setParentCountryId:(NSString *)parentId mode:(DownloaderMode)mode { self.defaultDataSource = [[MWMMapDownloaderDefaultDataSource alloc] initForRootCountryId:parentId delegate:self @@ -809,7 +819,7 @@ using namespace storage; return self.dataSource.parentCountryId; } -- (TMWMMapDownloaderMode)mode +- (DownloaderMode)mode { return self.dataSource.mode; } diff --git a/iphone/Maps/Classes/MapDownloader/MWMMapDownloaderTypes.h b/iphone/Maps/Classes/MapDownloader/MWMMapDownloaderTypes.h index 8135253335..ecb40d1a9d 100644 --- a/iphone/Maps/Classes/MapDownloader/MWMMapDownloaderTypes.h +++ b/iphone/Maps/Classes/MapDownloader/MWMMapDownloaderTypes.h @@ -1,5 +1,8 @@ -enum class TMWMMapDownloaderMode +namespace mwm +{ +enum class DownloaderMode { Downloaded, Available }; +} // namespace mwm diff --git a/iphone/Maps/Classes/MapDownloader/MWMMapDownloaderViewController.mm b/iphone/Maps/Classes/MapDownloader/MWMMapDownloaderViewController.mm index 2a683da771..60996cce55 100644 --- a/iphone/Maps/Classes/MapDownloader/MWMMapDownloaderViewController.mm +++ b/iphone/Maps/Classes/MapDownloader/MWMMapDownloaderViewController.mm @@ -25,7 +25,7 @@ using namespace storage; @property (nonatomic) MWMMapDownloaderDataSource * defaultDataSource; @property (nonatomic, readonly) NSString * parentCountryId; -@property (nonatomic, readonly) TMWMMapDownloaderMode mode; +@property (nonatomic, readonly) mwm::DownloaderMode mode; @property (nonatomic) BOOL showAllMapsButtons; @@ -91,7 +91,7 @@ using namespace storage; auto const & s = GetFramework().Storage(); if (![self.parentCountryId isEqualToString:@(s.GetRootId().c_str())]) return; - if (self.mode == TMWMMapDownloaderMode::Available || s.HaveDownloadedCountries()) + if (self.mode == mwm::DownloaderMode::Available || s.HaveDownloadedCountries()) { [self configAllMapsView]; self.tableView.hidden = NO; @@ -203,7 +203,7 @@ using namespace storage; #pragma mark - Configuration -- (void)setParentCountryId:(NSString *)parentId mode:(TMWMMapDownloaderMode)mode +- (void)setParentCountryId:(NSString *)parentId mode:(mwm::DownloaderMode)mode { self.defaultDataSource = [[MWMMapDownloaderExtendedDataSource alloc] initForRootCountryId:parentId delegate:self diff --git a/iphone/Maps/Classes/MapViewController.h b/iphone/Maps/Classes/MapViewController.h index 5be02b68ff..87d4c341ef 100644 --- a/iphone/Maps/Classes/MapViewController.h +++ b/iphone/Maps/Classes/MapViewController.h @@ -34,7 +34,7 @@ namespace search { struct AddressInfo; } - (void)openMigration; - (void)openBookmarks; -- (void)openMapsDownloader:(TMWMMapDownloaderMode)mode; +- (void)openMapsDownloader:(mwm::DownloaderMode)mode; - (void)openEditor; - (void)refreshAd; diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index aa5312f849..492750c321 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -548,7 +548,7 @@ NSString * const kUDViralAlertWasShown = @"ViralAlertWasShown"; [self.navigationController pushViewController:vc animated:YES]; } -- (void)openMapsDownloader:(TMWMMapDownloaderMode)mode +- (void)openMapsDownloader:(mwm::DownloaderMode)mode { [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"downloader"]; [self performSegueWithIdentifier:kDownloaderSegue sender:@(static_cast(mode))]; @@ -845,7 +845,7 @@ NSString * const kUDViralAlertWasShown = @"ViralAlertWasShown"; { MWMMapDownloaderViewController * dvc = segue.destinationViewController; NSNumber * mode = sender; - [dvc setParentCountryId:@(GetFramework().Storage().GetRootId().c_str()) mode:static_cast(mode.integerValue)]; + [dvc setParentCountryId:@(GetFramework().Storage().GetRootId().c_str()) mode:static_cast(mode.integerValue)]; } else if ([segue.identifier isEqualToString:kMap2FBLoginSegue]) { diff --git a/iphone/Maps/Classes/Migration/MWMMigrationViewController.mm b/iphone/Maps/Classes/Migration/MWMMigrationViewController.mm index f84da0ab51..5c3075ed02 100644 --- a/iphone/Maps/Classes/Migration/MWMMigrationViewController.mm +++ b/iphone/Maps/Classes/Migration/MWMMigrationViewController.mm @@ -179,7 +179,7 @@ using namespace storage; if ([segue.identifier isEqualToString:kDownloaderSegue]) { MWMMapDownloaderViewController * dvc = segue.destinationViewController; - [dvc setParentCountryId:@(GetFramework().Storage().GetRootId().c_str()) mode:TMWMMapDownloaderMode::Downloaded]; + [dvc setParentCountryId:@(GetFramework().Storage().GetRootId().c_str()) mode:mwm::DownloaderMode::Downloaded]; } } diff --git a/iphone/Maps/Classes/UIViewController+Navigation.h b/iphone/Maps/Classes/UIViewController+Navigation.h index 7a1ea79704..3de32fad18 100644 --- a/iphone/Maps/Classes/UIViewController+Navigation.h +++ b/iphone/Maps/Classes/UIViewController+Navigation.h @@ -3,10 +3,9 @@ - (void)showBackButton; - (void)backTap; -- (UIBarButtonItem *)navBarButtonWithImage:(UIImage *)image highlightedImage:(UIImage *)highlightedImage action:(SEL)action; +- (UIBarButtonItem *)buttonWithImage:(UIImage *)image action:(SEL)action; - (NSArray *)alignedNavBarButtonItems:(NSArray *)items; - @property (nonatomic, readonly) UIStoryboard * mainStoryboard; @end diff --git a/iphone/Maps/Classes/UIViewController+Navigation.mm b/iphone/Maps/Classes/UIViewController+Navigation.mm index 76741d2014..da20f374e9 100644 --- a/iphone/Maps/Classes/UIViewController+Navigation.mm +++ b/iphone/Maps/Classes/UIViewController+Navigation.mm @@ -18,14 +18,11 @@ CGFloat constexpr kButtonExtraWidth = 16.0; return spacer; } -- (UIBarButtonItem *)navBarButtonWithImage:(UIImage *)image - highlightedImage:(UIImage *)highlightedImage - action:(SEL)action +- (UIBarButtonItem *)buttonWithImage:(UIImage *)image action:(SEL)action { CGSize const buttonSize = {image.size.width + kButtonExtraWidth, image.size.height}; UIButton * button = [[UIButton alloc] initWithFrame:{{}, buttonSize}]; [button setImage:image forState:UIControlStateNormal]; - [button setImage:highlightedImage forState:UIControlStateHighlighted]; [button addTarget:self action:action forControlEvents:UIControlEventTouchUpInside]; return [[UIBarButtonItem alloc] initWithCustomView:button]; } @@ -37,9 +34,7 @@ CGFloat constexpr kButtonExtraWidth = 16.0; - (UIBarButtonItem *)backButton { - return [self navBarButtonWithImage:[UIImage imageNamed:@"ic_nav_bar_back"] - highlightedImage:[UIImage imageNamed:@"ic_nav_bar_back_press"] - action:@selector(backTap)]; + return [self buttonWithImage:[UIImage imageNamed:@"ic_nav_bar_back"] action:@selector(backTap)]; } - (void)showBackButton diff --git a/iphone/Maps/Images.xcassets/Downloader/ic_nav_bar_add_press.imageset/Contents.json b/iphone/Maps/Images.xcassets/Downloader/ic_nav_bar_add_press.imageset/Contents.json deleted file mode 100644 index 579f77249c..0000000000 --- a/iphone/Maps/Images.xcassets/Downloader/ic_nav_bar_add_press.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "ic_nav_bar_add_press.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "ic_nav_bar_add_press@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "ic_nav_bar_add_press@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/iphone/Maps/Images.xcassets/Downloader/ic_nav_bar_add_press.imageset/ic_nav_bar_add_press.png b/iphone/Maps/Images.xcassets/Downloader/ic_nav_bar_add_press.imageset/ic_nav_bar_add_press.png deleted file mode 100644 index fffa16ba0c..0000000000 Binary files a/iphone/Maps/Images.xcassets/Downloader/ic_nav_bar_add_press.imageset/ic_nav_bar_add_press.png and /dev/null differ diff --git a/iphone/Maps/Images.xcassets/Downloader/ic_nav_bar_add_press.imageset/ic_nav_bar_add_press@2x.png b/iphone/Maps/Images.xcassets/Downloader/ic_nav_bar_add_press.imageset/ic_nav_bar_add_press@2x.png deleted file mode 100644 index 73dfa2d078..0000000000 Binary files a/iphone/Maps/Images.xcassets/Downloader/ic_nav_bar_add_press.imageset/ic_nav_bar_add_press@2x.png and /dev/null differ diff --git a/iphone/Maps/Images.xcassets/Downloader/ic_nav_bar_add_press.imageset/ic_nav_bar_add_press@3x.png b/iphone/Maps/Images.xcassets/Downloader/ic_nav_bar_add_press.imageset/ic_nav_bar_add_press@3x.png deleted file mode 100644 index 77390ca1b2..0000000000 Binary files a/iphone/Maps/Images.xcassets/Downloader/ic_nav_bar_add_press.imageset/ic_nav_bar_add_press@3x.png and /dev/null differ diff --git a/iphone/Maps/Images.xcassets/Navigation Bar/ic_nav_bar_back_press.imageset/Contents.json b/iphone/Maps/Images.xcassets/Navigation Bar/ic_nav_bar_back_press.imageset/Contents.json deleted file mode 100644 index 3c3b3eff2f..0000000000 --- a/iphone/Maps/Images.xcassets/Navigation Bar/ic_nav_bar_back_press.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "ic_nav_bar_back_press.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "ic_nav_bar_back_press@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "ic_nav_bar_back_press@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/iphone/Maps/Images.xcassets/Navigation Bar/ic_nav_bar_back_press.imageset/ic_nav_bar_back_press.png b/iphone/Maps/Images.xcassets/Navigation Bar/ic_nav_bar_back_press.imageset/ic_nav_bar_back_press.png deleted file mode 100644 index 7b9dafd839..0000000000 Binary files a/iphone/Maps/Images.xcassets/Navigation Bar/ic_nav_bar_back_press.imageset/ic_nav_bar_back_press.png and /dev/null differ diff --git a/iphone/Maps/Images.xcassets/Navigation Bar/ic_nav_bar_back_press.imageset/ic_nav_bar_back_press@2x.png b/iphone/Maps/Images.xcassets/Navigation Bar/ic_nav_bar_back_press.imageset/ic_nav_bar_back_press@2x.png deleted file mode 100644 index dc0707e8b7..0000000000 Binary files a/iphone/Maps/Images.xcassets/Navigation Bar/ic_nav_bar_back_press.imageset/ic_nav_bar_back_press@2x.png and /dev/null differ diff --git a/iphone/Maps/Images.xcassets/Navigation Bar/ic_nav_bar_back_press.imageset/ic_nav_bar_back_press@3x.png b/iphone/Maps/Images.xcassets/Navigation Bar/ic_nav_bar_back_press.imageset/ic_nav_bar_back_press@3x.png deleted file mode 100644 index b452a522b3..0000000000 Binary files a/iphone/Maps/Images.xcassets/Navigation Bar/ic_nav_bar_back_press.imageset/ic_nav_bar_back_press@3x.png and /dev/null differ -- cgit v1.2.3