From 1058188291ad594140f93b394e112b9b5fde9fa2 Mon Sep 17 00:00:00 2001 From: VladiMihaylenko Date: Wed, 18 Mar 2015 13:19:26 +0300 Subject: [PATCH] Fixed downloader alert exception --- .../CustomAlert/AlertController/MWMAlertViewController.h | 3 +-- .../CustomAlert/AlertController/MWMAlertViewController.mm | 4 ++-- iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h | 3 +-- iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm | 4 ++-- .../DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.h | 2 +- .../MWMDownloadTransitMapAlert.mm | 8 ++++---- iphone/Maps/Classes/MapViewController.mm | 2 +- iphone/Maps/Classes/MapsAppDelegate.h | 1 - 8 files changed, 12 insertions(+), 15 deletions(-) diff --git a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.h b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.h index 233cd523a4..03bb6e9ab9 100644 --- a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.h +++ b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.h @@ -10,7 +10,6 @@ #import "MWMAlert.h" #include "../../../../../routing/router.hpp" -#include "../../../../../std/vector.hpp" #include "../../../../../storage/storage.hpp" @interface MWMAlertViewController : UIViewController @@ -19,7 +18,7 @@ - (instancetype)initWithViewController:(UIViewController *)viewController; - (void)presentAlert:(routing::IRouter::ResultCode)type; -- (void)presentDownloaderAlertWithCountries:(vector const&)countries; +- (void)presentDownloaderAlertWithCountrieIndex:(const storage::TIndex&)index; - (void)closeAlert; @end diff --git a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm index 3b458eaaf9..d602c4f526 100644 --- a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm +++ b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm @@ -38,8 +38,8 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController #pragma mark - Actions -- (void)presentDownloaderAlertWithCountries:(const vector &)countries { - MWMAlert *alert = [MWMAlert downloaderAlertWithCountries:countries]; +- (void)presentDownloaderAlertWithCountrieIndex:(const storage::TIndex&)index { + MWMAlert *alert = [MWMAlert downloaderAlertWithCountrieIndex:index]; [self displayAlert:alert]; } diff --git a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h index 8039877057..3972328547 100644 --- a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h +++ b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h @@ -9,7 +9,6 @@ #import #include "../../../../../routing/router.hpp" -#include "../../../../../std/vector.hpp" #include "../../../../../storage/storage.hpp" @class MWMAlertViewController; @@ -18,6 +17,6 @@ @property (nonatomic, weak) MWMAlertViewController *alertController; + (MWMAlert *)alert:(routing::IRouter::ResultCode)type; -+ (MWMAlert *)downloaderAlertWithCountries:(vector const&)countries; ++ (MWMAlert *)downloaderAlertWithCountrieIndex:(const storage::TIndex&)index; @end diff --git a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm index ee037b40b4..458c943f3b 100644 --- a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm +++ b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm @@ -15,8 +15,8 @@ extern UIColor * const kActiveDownloaderViewColor = [UIColor colorWithRed:211/25 @implementation MWMAlert -+ (MWMAlert *)downloaderAlertWithCountries:(const vector &)countries { - return [MWMDownloadTransitMapAlert alertWithCountries:countries]; ++ (MWMAlert *)downloaderAlertWithCountrieIndex:(const storage::TIndex&)index { + return [MWMDownloadTransitMapAlert alertWithCountrieIndex:index]; } + (MWMAlert *)alert:(routing::IRouter::ResultCode)type { diff --git a/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.h b/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.h index 10fccaf5b2..b94cc9228a 100644 --- a/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.h +++ b/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.h @@ -13,7 +13,7 @@ @interface MWMDownloadTransitMapAlert : MWMAlert -+ (instancetype)alertWithCountries:(vector const &)countries; ++ (instancetype)alertWithCountrieIndex:(const storage::TIndex)index; @property (nonatomic, weak, readonly) IBOutlet UILabel *titleLabel; @property (nonatomic, weak, readonly) IBOutlet UILabel *messageLabel; diff --git a/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.mm b/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.mm index 79e6e6ec62..a79ce7c259 100644 --- a/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.mm +++ b/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.mm @@ -29,13 +29,13 @@ extern UIColor * const kActiveDownloaderViewColor; @implementation MWMDownloadTransitMapAlert -+ (instancetype)alertWithCountries:(const vector &)countries { ++ (instancetype)alertWithCountrieIndex:(const storage::TIndex)index { MWMDownloadTransitMapAlert *alert = [[[NSBundle mainBundle] loadNibNamed:kDownloadTransitMapAlertNibName owner:self options:nil] firstObject]; ActiveMapsLayout& layout = GetFramework().GetCountryTree().GetActiveMapLayout(); - alert.countryLabel.text = [NSString stringWithUTF8String:layout.GetFormatedCountryName(countries[0]).c_str()]; - alert.sizeLabel.text = [NSString stringWithFormat:@"%@ %@", @(layout.GetCountrySize(countries[0], storage::TMapOptions::EMapWithCarRouting).second/(1024 * 1024)), L(@"mb")]; + alert.countryLabel.text = [NSString stringWithUTF8String:layout.GetFormatedCountryName(index).c_str()]; + alert.sizeLabel.text = [NSString stringWithFormat:@"%@ %@", @(layout.GetCountrySize(index, storage::TMapOptions::EMapWithCarRouting).second/(1024 * 1024)), L(@"mb")]; alert.downloaderBlock = ^{ - layout.DownloadMap(countries[0], storage::TMapOptions::EMapWithCarRouting); + layout.DownloadMap(index, storage::TMapOptions::EMapWithCarRouting); }; [alert configure]; return alert; diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index ddaff5c6e3..79c7edd176 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -813,7 +813,7 @@ - (void)presentDownloaderAlert:(routing::IRouter::ResultCode)type countries:(vector const&)countries { if (countries.size()) { MWMAlertViewController *alert = [[MWMAlertViewController alloc] initWithViewController:self]; - [alert presentDownloaderAlertWithCountries:countries]; + [alert presentDownloaderAlertWithCountrieIndex:countries[0]]; } else { [self presentDefaultAlert:type]; } diff --git a/iphone/Maps/Classes/MapsAppDelegate.h b/iphone/Maps/Classes/MapsAppDelegate.h index 129a7f912d..35b5d27074 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.h +++ b/iphone/Maps/Classes/MapsAppDelegate.h @@ -22,7 +22,6 @@ extern NSString * const MapsStatusChangedNotification; @property (nonatomic, readonly) LocationManager * m_locationManager; + (MapsAppDelegate *)theApp; -- (UIWindow *)window; - (void)disableStandby; - (void)enableStandby;