diff --git a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.h b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.h index 7923215910..2f4ef7a94e 100644 --- a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.h +++ b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.h @@ -20,8 +20,9 @@ typedef void (^CloseAlertCompletion)(); - (nonnull instancetype)initWithViewController:(nonnull UIViewController *)viewController; - (void)presentAlert:(routing::IRouter::ResultCode)type; -- (void)presentDownloaderAlertWithCountries:(vector const &)countries routes:(vector const &)routes; -- (void)presentCrossCountryAlertWithCountries:(vector const &)countries routes:(vector const &)routes; +- (void)presentDownloaderAlertWithCountries:(vector const &)countries + routes:(vector const &)routes + code:(routing::IRouter::ResultCode)code; - (void)presentRateAlert; - (void)presentFacebookAlert; - (void)presentFeedbackAlertWithStarsCount:(NSUInteger)starsCount; diff --git a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm index debe681673..f0df31c4e5 100644 --- a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm +++ b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm @@ -103,14 +103,11 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController [self displayAlert:[MWMAlert feedbackAlertWithStarsCount:starsCount]]; } -- (void)presentCrossCountryAlertWithCountries:(vector const &)countries routes:(vector const &)routes +- (void)presentDownloaderAlertWithCountries:(vector const &)countries + routes:(vector const &)routes + code:(routing::IRouter::ResultCode)code { - [self displayAlert:[MWMAlert crossCountryAlertWithCountries:countries routes:routes]]; -} - -- (void)presentDownloaderAlertWithCountries:(vector const &)countries routes:(vector const &)routes -{ - [self displayAlert:[MWMAlert downloaderAlertWithAbsentCountries:countries routes:routes]]; + [self displayAlert:[MWMAlert downloaderAlertWithAbsentCountries:countries routes:routes code:code]]; } - (void)presentRoutingDisclaimerAlert diff --git a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h index 58a2d0486b..7fa8490de0 100644 --- a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h +++ b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h @@ -19,8 +19,9 @@ typedef void (^RightButtonAction)(); @property (weak, nonatomic) MWMAlertViewController * alertController; + (MWMAlert *)alert:(routing::IRouter::ResultCode)type; -+ (MWMAlert *)downloaderAlertWithAbsentCountries:(vector const &)countries routes:(vector const &)routes; -+ (MWMAlert *)crossCountryAlertWithCountries:(vector const &)countries routes:(vector const &)routes; ++ (MWMAlert *)downloaderAlertWithAbsentCountries:(vector const &)countries + routes:(vector const &)routes + code:(routing::IRouter::ResultCode)code; + (MWMAlert *)rateAlert; + (MWMAlert *)feedbackAlertWithStarsCount:(NSUInteger)starsCount; + (MWMAlert *)facebookAlert; diff --git a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm index 6a22079826..0c1f27f99c 100644 --- a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm +++ b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm @@ -63,14 +63,11 @@ return [MWMFeedbackAlert alertWithStarsCount:starsCount]; } -+ (MWMAlert *)crossCountryAlertWithCountries:(vector const &)countries routes:(vector const &)routes ++ (MWMAlert *)downloaderAlertWithAbsentCountries:(vector const &)countries + routes:(vector const &)routes + code:(routing::IRouter::ResultCode)code { - return [MWMDownloadTransitMapAlert crossCountryAlertWithMaps:countries routes:routes]; -} - -+ (MWMAlert *)downloaderAlertWithAbsentCountries:(vector const &)countries routes:(vector const &)routes -{ - return [MWMDownloadTransitMapAlert downloaderAlertWithMaps:countries routes:routes]; + return [MWMDownloadTransitMapAlert downloaderAlertWithMaps:countries routes:routes code:code]; } + (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 e5c7e7b501..c4f6237e06 100644 --- a/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.h +++ b/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.h @@ -12,8 +12,10 @@ #include "std/vector.hpp" @interface MWMDownloadTransitMapAlert : MWMAlert -+ (instancetype)crossCountryAlertWithMaps:(vector const &)maps routes:(vector const &)routes; -+ (instancetype)downloaderAlertWithMaps:(vector const &)maps routes:(vector const &)routes; + ++ (instancetype)downloaderAlertWithMaps:(vector const &)maps + routes:(vector const &)routes + code:(routing::IRouter::ResultCode)code; - (void)showDownloadDetail:(UIButton *)sender; @end diff --git a/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.mm b/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.mm index 09625d9bd9..97357d696d 100644 --- a/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.mm +++ b/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.mm @@ -91,19 +91,31 @@ static CGFloat const kMinimumOffset = 20.; @implementation MWMDownloadTransitMapAlert -+ (instancetype)crossCountryAlertWithMaps:(vector const &)maps routes:(vector const &)routes ++ (instancetype)downloaderAlertWithMaps:(vector const &)maps + routes:(vector const &)routes + code:(routing::IRouter::ResultCode)code { MWMDownloadTransitMapAlert * alert = [self alertWithMaps:maps routes:routes]; - alert.titleLabel.localizedText = @"dialog_routing_download_and_build_cross_route"; - alert.messageLabel.localizedText = @"dialog_routing_download_cross_route"; - return alert; -} - -+ (instancetype)downloaderAlertWithMaps:(vector const &)maps routes:(vector const &)routes -{ - MWMDownloadTransitMapAlert * alert = [self alertWithMaps:maps routes:routes]; - alert.titleLabel.localizedText = @"dialog_routing_download_files"; - alert.messageLabel.localizedText = @"dialog_routing_download_and_update_all"; + switch (code) + { + case routing::IRouter::InconsistentMWMandRoute: + case routing::IRouter::RouteNotFound: + case routing::IRouter::RouteFileNotExist: + alert.titleLabel.localizedText = @"dialog_routing_download_files"; + alert.messageLabel.localizedText = @"dialog_routing_download_and_update_all"; + break; + case routing::IRouter::FileTooOld: + alert.titleLabel.localizedText = @"dialog_routing_download_files"; + alert.messageLabel.localizedText = @"dialog_routing_download_and_update_maps"; + break; + case routing::IRouter::NeedMoreMaps: + alert.titleLabel.localizedText = @"dialog_routing_download_and_build_cross_route"; + alert.messageLabel.localizedText = @"dialog_routing_download_cross_route"; + break; + default: + NSAssert(false, @"Incorrect code!"); + break; + } return alert; } diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index a04415ad6b..763fac1e0c 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -750,19 +750,14 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView) #pragma mark - ShowDialog callback -- (void)presentDownloaderAlert:(routing::IRouter::ResultCode)type countries:(vector const &)countries routes:(vector const &)routes +- (void)presentDownloaderAlert:(routing::IRouter::ResultCode)code + countries:(vector const &)countries + routes:(vector const &)routes { if (countries.size() || routes.size()) - { - if (type == routing::IRouter::NeedMoreMaps) - [self.alertController presentCrossCountryAlertWithCountries:countries routes:routes]; - else - [self.alertController presentDownloaderAlertWithCountries:countries routes:routes]; - } + [self.alertController presentDownloaderAlertWithCountries:countries routes:routes code:code]; else - { - [self presentDefaultAlert:type]; - } + [self presentDefaultAlert:code]; } - (void)presentDisabledLocationAlert