[ios] FileToOld dialog.

This commit is contained in:
v.mikhaylenko 2015-08-06 12:59:36 +03:00 committed by Alex Zolotarev
parent 92c0378721
commit 41f620a777
7 changed files with 46 additions and 41 deletions

View file

@ -20,8 +20,9 @@ typedef void (^CloseAlertCompletion)();
- (nonnull instancetype)initWithViewController:(nonnull UIViewController *)viewController;
- (void)presentAlert:(routing::IRouter::ResultCode)type;
- (void)presentDownloaderAlertWithCountries:(vector<storage::TIndex> const &)countries routes:(vector<storage::TIndex> const &)routes;
- (void)presentCrossCountryAlertWithCountries:(vector<storage::TIndex> const &)countries routes:(vector<storage::TIndex> const &)routes;
- (void)presentDownloaderAlertWithCountries:(vector<storage::TIndex> const &)countries
routes:(vector<storage::TIndex> const &)routes
code:(routing::IRouter::ResultCode)code;
- (void)presentRateAlert;
- (void)presentFacebookAlert;
- (void)presentFeedbackAlertWithStarsCount:(NSUInteger)starsCount;

View file

@ -103,14 +103,11 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController
[self displayAlert:[MWMAlert feedbackAlertWithStarsCount:starsCount]];
}
- (void)presentCrossCountryAlertWithCountries:(vector<storage::TIndex> const &)countries routes:(vector<storage::TIndex> const &)routes
- (void)presentDownloaderAlertWithCountries:(vector<storage::TIndex> const &)countries
routes:(vector<storage::TIndex> const &)routes
code:(routing::IRouter::ResultCode)code
{
[self displayAlert:[MWMAlert crossCountryAlertWithCountries:countries routes:routes]];
}
- (void)presentDownloaderAlertWithCountries:(vector<storage::TIndex> const &)countries routes:(vector<storage::TIndex> const &)routes
{
[self displayAlert:[MWMAlert downloaderAlertWithAbsentCountries:countries routes:routes]];
[self displayAlert:[MWMAlert downloaderAlertWithAbsentCountries:countries routes:routes code:code]];
}
- (void)presentRoutingDisclaimerAlert

View file

@ -19,8 +19,9 @@ typedef void (^RightButtonAction)();
@property (weak, nonatomic) MWMAlertViewController * alertController;
+ (MWMAlert *)alert:(routing::IRouter::ResultCode)type;
+ (MWMAlert *)downloaderAlertWithAbsentCountries:(vector<storage::TIndex> const &)countries routes:(vector<storage::TIndex> const &)routes;
+ (MWMAlert *)crossCountryAlertWithCountries:(vector<storage::TIndex> const &)countries routes:(vector<storage::TIndex> const &)routes;
+ (MWMAlert *)downloaderAlertWithAbsentCountries:(vector<storage::TIndex> const &)countries
routes:(vector<storage::TIndex> const &)routes
code:(routing::IRouter::ResultCode)code;
+ (MWMAlert *)rateAlert;
+ (MWMAlert *)feedbackAlertWithStarsCount:(NSUInteger)starsCount;
+ (MWMAlert *)facebookAlert;

View file

@ -63,14 +63,11 @@
return [MWMFeedbackAlert alertWithStarsCount:starsCount];
}
+ (MWMAlert *)crossCountryAlertWithCountries:(vector<storage::TIndex> const &)countries routes:(vector<storage::TIndex> const &)routes
+ (MWMAlert *)downloaderAlertWithAbsentCountries:(vector<storage::TIndex> const &)countries
routes:(vector<storage::TIndex> const &)routes
code:(routing::IRouter::ResultCode)code
{
return [MWMDownloadTransitMapAlert crossCountryAlertWithMaps:countries routes:routes];
}
+ (MWMAlert *)downloaderAlertWithAbsentCountries:(vector<storage::TIndex> const &)countries routes:(vector<storage::TIndex> const &)routes
{
return [MWMDownloadTransitMapAlert downloaderAlertWithMaps:countries routes:routes];
return [MWMDownloadTransitMapAlert downloaderAlertWithMaps:countries routes:routes code:code];
}
+ (MWMAlert *)alert:(routing::IRouter::ResultCode)type

View file

@ -12,8 +12,10 @@
#include "std/vector.hpp"
@interface MWMDownloadTransitMapAlert : MWMAlert
+ (instancetype)crossCountryAlertWithMaps:(vector<storage::TIndex> const &)maps routes:(vector<storage::TIndex> const &)routes;
+ (instancetype)downloaderAlertWithMaps:(vector<storage::TIndex> const &)maps routes:(vector<storage::TIndex> const &)routes;
+ (instancetype)downloaderAlertWithMaps:(vector<storage::TIndex> const &)maps
routes:(vector<storage::TIndex> const &)routes
code:(routing::IRouter::ResultCode)code;
- (void)showDownloadDetail:(UIButton *)sender;
@end

View file

@ -91,19 +91,31 @@ static CGFloat const kMinimumOffset = 20.;
@implementation MWMDownloadTransitMapAlert
+ (instancetype)crossCountryAlertWithMaps:(vector<storage::TIndex> const &)maps routes:(vector<storage::TIndex> const &)routes
+ (instancetype)downloaderAlertWithMaps:(vector<storage::TIndex> const &)maps
routes:(vector<storage::TIndex> 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<storage::TIndex> const &)maps routes:(vector<storage::TIndex> 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;
}

View file

@ -750,19 +750,14 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView)
#pragma mark - ShowDialog callback
- (void)presentDownloaderAlert:(routing::IRouter::ResultCode)type countries:(vector<storage::TIndex> const &)countries routes:(vector<storage::TIndex> const &)routes
- (void)presentDownloaderAlert:(routing::IRouter::ResultCode)code
countries:(vector<storage::TIndex> const &)countries
routes:(vector<storage::TIndex> 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