From 2594ad7f3130ca66804e7ef5d753f8579de1d0d7 Mon Sep 17 00:00:00 2001 From: Ilya Grechuhin Date: Fri, 22 Jan 2016 14:53:23 +0300 Subject: [PATCH] [old-map-downloader][ios] Removed obsolete downloader actions. --- iphone/Maps/ActiveMapsVC.mm | 4 --- iphone/Maps/CountryTreeVC.mm | 6 +---- iphone/Maps/DownloaderParentVC.h | 4 --- iphone/Maps/DownloaderParentVC.mm | 41 ++++--------------------------- 4 files changed, 6 insertions(+), 49 deletions(-) diff --git a/iphone/Maps/ActiveMapsVC.mm b/iphone/Maps/ActiveMapsVC.mm index f61bdb0ce7..40b61c9de2 100644 --- a/iphone/Maps/ActiveMapsVC.mm +++ b/iphone/Maps/ActiveMapsVC.mm @@ -153,16 +153,12 @@ extern NSString * const MapsStatusChangedNotification; { switch (action) { - case DownloaderActionDownloadAll: case DownloaderActionDownloadMap: - case DownloaderActionDownloadCarRouting: if (check == NO || [self canDownloadSelectedMap]) self.mapsLayout.DownloadMap(self.selectedGroup, self.selectedPosition, self.selectedInActionSheetOptions); break; - case DownloaderActionDeleteAll: case DownloaderActionDeleteMap: - case DownloaderActionDeleteCarRouting: self.mapsLayout.DeleteMap(self.selectedGroup, self.selectedPosition, self.selectedInActionSheetOptions); break; diff --git a/iphone/Maps/CountryTreeVC.mm b/iphone/Maps/CountryTreeVC.mm index 2cce8afa64..b24dafb8dd 100644 --- a/iphone/Maps/CountryTreeVC.mm +++ b/iphone/Maps/CountryTreeVC.mm @@ -119,7 +119,7 @@ extern NSString * const MapsStatusChangedNotification; if (status == TStatus::ENotDownloaded) { LocalAndRemoteSizeT const size = self.tree.GetRemoteLeafSizes(position); - cell.sizeLabel.text = [NSString stringWithFormat:@"%@ / %@", formattedSize(size.first), formattedSize(size.second)]; + cell.sizeLabel.text = formattedSize(size.first); } else if (status == TStatus::EOnDisk || status == TStatus::EOnDiskOutOfDate) cell.sizeLabel.text = formattedSize(self.tree.GetLeafSize(position, options).second); @@ -159,16 +159,12 @@ extern NSString * const MapsStatusChangedNotification; { switch (action) { - case DownloaderActionDownloadAll: case DownloaderActionDownloadMap: - case DownloaderActionDownloadCarRouting: if (check == NO || [self canDownloadSelectedMap]) self.tree.DownloadCountry(self.selectedPosition, self.selectedInActionSheetOptions); break; - case DownloaderActionDeleteAll: case DownloaderActionDeleteMap: - case DownloaderActionDeleteCarRouting: self.tree.DeleteCountry(self.selectedPosition, self.selectedInActionSheetOptions); break; diff --git a/iphone/Maps/DownloaderParentVC.h b/iphone/Maps/DownloaderParentVC.h index 2b3a7084b4..b101bfa5cd 100644 --- a/iphone/Maps/DownloaderParentVC.h +++ b/iphone/Maps/DownloaderParentVC.h @@ -9,12 +9,8 @@ typedef NS_ENUM(NSUInteger, DownloaderAction) { - DownloaderActionDownloadAll, DownloaderActionDownloadMap, - DownloaderActionDownloadCarRouting, - DownloaderActionDeleteAll, DownloaderActionDeleteMap, - DownloaderActionDeleteCarRouting, DownloaderActionCancelDownloading, DownloaderActionZoomToCountry }; diff --git a/iphone/Maps/DownloaderParentVC.mm b/iphone/Maps/DownloaderParentVC.mm index 722d7e731f..d13b09d591 100644 --- a/iphone/Maps/DownloaderParentVC.mm +++ b/iphone/Maps/DownloaderParentVC.mm @@ -31,24 +31,13 @@ - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { if (buttonIndex != alertView.cancelButtonIndex) - { - if (self.selectedInActionSheetOptions == MapOptions::Map) - [self performAction:DownloaderActionDownloadMap withSizeCheck:NO]; - else if (self.selectedInActionSheetOptions == MapOptions::CarRouting) - [self performAction:DownloaderActionDownloadCarRouting withSizeCheck:NO]; - else if (self.selectedInActionSheetOptions == MapOptions::MapWithCarRouting) - [self performAction:DownloaderActionDownloadAll withSizeCheck:NO]; - } + [self download]; } - (void)download { - if (self.selectedInActionSheetOptions == MapOptions::Map) + if (self.selectedInActionSheetOptions == MapOptions::MapWithCarRouting) [self performAction:DownloaderActionDownloadMap withSizeCheck:NO]; - else if (self.selectedInActionSheetOptions == MapOptions::CarRouting) - [self performAction:DownloaderActionDownloadCarRouting withSizeCheck:NO]; - else if (self.selectedInActionSheetOptions == MapOptions::MapWithCarRouting) - [self performAction:DownloaderActionDownloadAll withSizeCheck:NO]; } #pragma mark - Virtual methods @@ -102,14 +91,14 @@ break; case TStatus::EOnDiskOutOfDate: [self addButtonWithTitle:L(@"zoom_to_country") action:DownloaderActionZoomToCountry toActionSheet:actionSheet]; - [self addButtonWithTitle:[NSString stringWithFormat:@"%@, %@", L(@"downloader_update_map"), fullSize] action:DownloaderActionDownloadAll toActionSheet:actionSheet]; + [self addButtonWithTitle:[NSString stringWithFormat:@"%@, %@", L(@"downloader_update_map"), fullSize] action:DownloaderActionDownloadMap toActionSheet:actionSheet]; [self addButtonWithTitle:L(@"downloader_delete_map") action:DownloaderActionDeleteMap toActionSheet:actionSheet]; actionSheet.destructiveButtonIndex = actionSheet.numberOfButtons - 1; break; case TStatus::ENotDownloaded: case TStatus::EDownloadFailed: case TStatus::EOutOfMemFailed: - [self addButtonWithTitle:[NSString stringWithFormat:@"%@, %@", L(@"downloader_download_map"), fullSize] action:DownloaderActionDownloadAll toActionSheet:actionSheet]; + [self addButtonWithTitle:[NSString stringWithFormat:@"%@, %@", L(@"downloader_download_map"), fullSize] action:DownloaderActionDownloadMap toActionSheet:actionSheet]; break; case TStatus::EDownloading: case TStatus::EInQueue: @@ -159,27 +148,7 @@ if (buttonIndex != actionSheet.cancelButtonIndex) { DownloaderAction const action = (DownloaderAction)[self.actionSheetActions[@(buttonIndex)] integerValue]; - switch (action) - { - case DownloaderActionDownloadAll: - case DownloaderActionDeleteAll: - self.selectedInActionSheetOptions = MapOptions::MapWithCarRouting; - break; - - case DownloaderActionDownloadMap: - case DownloaderActionDeleteMap: - self.selectedInActionSheetOptions = MapOptions::Map; - break; - - case DownloaderActionDownloadCarRouting: - case DownloaderActionDeleteCarRouting: - self.selectedInActionSheetOptions = MapOptions::CarRouting; - break; - - default: - break; - } - + self.selectedInActionSheetOptions = MapOptions::MapWithCarRouting; [self performAction:action withSizeCheck:YES]; } }