forked from organicmaps/organicmaps
[ios] Added routing migration alert.
This commit is contained in:
parent
9e14415d1e
commit
7ffbe211cf
8 changed files with 57 additions and 25 deletions
|
@ -10,6 +10,7 @@
|
|||
|
||||
- (nonnull instancetype)initWithViewController:(nonnull UIViewController *)viewController;
|
||||
- (void)presentAlert:(routing::IRouter::ResultCode)type;
|
||||
- (void)presentRoutingMigrationAlertWithOkBlock:(nonnull TMWMVoidBlock)okBlock;
|
||||
- (void)presentDownloaderAlertWithCountries:(storage::TCountriesVec const &)countries
|
||||
code:(routing::IRouter::ResultCode)code
|
||||
okBlock:(nonnull TMWMVoidBlock)okBlock;
|
||||
|
|
|
@ -111,6 +111,11 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController
|
|||
[self displayAlert:[MWMAlert invalidUserNameOrPasswordAlert]];
|
||||
}
|
||||
|
||||
- (void)presentRoutingMigrationAlertWithOkBlock:(TMWMVoidBlock)okBlock
|
||||
{
|
||||
[self displayAlert:[MWMAlert routingMigrationAlertWithOkBlock:okBlock]];
|
||||
}
|
||||
|
||||
- (void)presentDownloaderAlertWithCountries:(storage::TCountriesVec const &)countries
|
||||
code:(routing::IRouter::ResultCode)code
|
||||
okBlock:(TMWMVoidBlock)okBlock
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
@property (weak, nonatomic) MWMAlertViewController * alertController;
|
||||
|
||||
+ (MWMAlert *)alert:(routing::IRouter::ResultCode)type;
|
||||
+ (MWMAlert *)routingMigrationAlertWithOkBlock:(TMWMVoidBlock)okBlock;
|
||||
+ (MWMAlert *)downloaderAlertWithAbsentCountries:(storage::TCountriesVec const &)countries
|
||||
code:(routing::IRouter::ResultCode)code
|
||||
okBlock:(TMWMVoidBlock)okBlock;
|
||||
|
|
|
@ -62,6 +62,11 @@
|
|||
return [MWMDefaultAlert locationServiceNotSupportedAlert];
|
||||
}
|
||||
|
||||
+ (MWMAlert *)routingMigrationAlertWithOkBlock:(TMWMVoidBlock)okBlock
|
||||
{
|
||||
return [MWMDefaultAlert routingMigrationAlertWithOkBlock:okBlock];
|
||||
}
|
||||
|
||||
+ (MWMAlert *)downloaderAlertWithAbsentCountries:(storage::TCountriesVec const &)countries
|
||||
code:(routing::IRouter::ResultCode)code
|
||||
okBlock:(TMWMVoidBlock)okBlock
|
||||
|
|
|
@ -23,5 +23,6 @@
|
|||
+ (instancetype)downloaderNotEnoughSpaceAlert;
|
||||
+ (instancetype)downloaderInternalErrorAlertWithOkBlock:(TMWMVoidBlock)okBlock;
|
||||
+ (instancetype)downloaderNeedUpdateAlertWithOkBlock:(TMWMVoidBlock)okBlock;
|
||||
+ (instancetype)routingMigrationAlertWithOkBlock:(TMWMVoidBlock)okBlock;
|
||||
|
||||
@end
|
||||
|
|
|
@ -282,6 +282,17 @@ static NSString * const kDefaultAlertNibName = @"MWMDefaultAlert";
|
|||
return alert;
|
||||
}
|
||||
|
||||
+ (instancetype)routingMigrationAlertWithOkBlock:(TMWMVoidBlock)okBlock
|
||||
{
|
||||
kStatisticsEvent = @"Routing Need Migration Alert";
|
||||
MWMDefaultAlert * alert = [self defaultAlertWithTitle:@"downloader_update_maps"
|
||||
message:@"downloader_mwm_migration_dialog"
|
||||
rightButtonTitle:@"ok"
|
||||
leftButtonTitle:@"cancel"
|
||||
rightButtonAction:okBlock];
|
||||
return alert;
|
||||
}
|
||||
|
||||
+ (instancetype)defaultAlertWithTitle:(nonnull NSString *)title
|
||||
message:(nullable NSString *)message
|
||||
rightButtonTitle:(nonnull NSString *)rightButtonTitle
|
||||
|
|
|
@ -614,21 +614,23 @@ NSString * const kReportSegue = @"Map2ReportSegue";
|
|||
case routing::IRouter::FileTooOld:
|
||||
case routing::IRouter::RouteNotFound:
|
||||
{
|
||||
[self presentDownloaderAlert:code countries:absentCountries okBlock:[=]
|
||||
if (platform::migrate::NeedMigrate())
|
||||
{
|
||||
auto & s = GetFramework().Storage();
|
||||
for (auto const & countryId : absentCountries)
|
||||
s.DownloadNode(countryId);
|
||||
if (platform::migrate::NeedMigrate())
|
||||
[self presentRoutingMigrationAlertWithOkBlock:^
|
||||
{
|
||||
[Statistics logEvent:kStatDownloaderMigrationDialogue withParameters:@{kStatFrom : kStatMap}];
|
||||
[Statistics logEvent:kStatDownloaderMigrationDialogue withParameters:@{kStatFrom : kStatRouting}];
|
||||
[self openMigration];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self openMapsDownloader];
|
||||
}
|
||||
}];
|
||||
}];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self presentDownloaderAlert:code countries:absentCountries okBlock:^
|
||||
{
|
||||
auto & s = GetFramework().Storage();
|
||||
for (auto const & countryId : absentCountries)
|
||||
s.DownloadNode(countryId);
|
||||
}];
|
||||
}
|
||||
break;
|
||||
}
|
||||
case routing::IRouter::Cancelled:
|
||||
|
@ -762,6 +764,11 @@ NSString * const kReportSegue = @"Map2ReportSegue";
|
|||
|
||||
#pragma mark - ShowDialog callback
|
||||
|
||||
- (void)presentRoutingMigrationAlertWithOkBlock:(TMWMVoidBlock)okBlock
|
||||
{
|
||||
[self.alertController presentRoutingMigrationAlertWithOkBlock:okBlock];
|
||||
}
|
||||
|
||||
- (void)presentDownloaderAlert:(routing::IRouter::ResultCode)code
|
||||
countries:(storage::TCountriesVec const &)countries
|
||||
okBlock:(TMWMVoidBlock)okBlock
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
static NSString * const kStat3D = @"3D";
|
||||
static NSString * const kStat3DBuildings= @"3D buildings";
|
||||
static NSString * const kStatAPI = @"API";
|
||||
static NSString * const kStatAbout = @"About";
|
||||
static NSString * const kStatAction = @"action";
|
||||
static NSString * const kStatActionSheet = @"Action sheet";
|
||||
static NSString * const kStatAd = @"Ad";
|
||||
static NSString * const kStatAdTitle = @"Ad title";
|
||||
static NSString * const kStatAdd = @"Add";
|
||||
static NSString * const kStatAddPlace = @"Add place";
|
||||
static NSString * const kStatAdTitle = @"Ad title";
|
||||
static NSString * const kStatAlert = @"Alert";
|
||||
static NSString * const kStatAllMaps = @"all_maps";
|
||||
static NSString * const kStatAPI = @"API";
|
||||
static NSString * const kStatApplication = @"Application";
|
||||
static NSString * const kStatApply = @"Apply";
|
||||
static NSString * const kStatAuthorization = @"Authorization";
|
||||
|
@ -50,6 +50,10 @@ static NSString * const kStatDeviceInfo = @"Device info";
|
|||
static NSString * const kStatDeviceType = @"Device type";
|
||||
static NSString * const kStatDownload = @"download";
|
||||
static NSString * const kStatDownloadGroup = @"download_group";
|
||||
static NSString * const kStatDownloadMap = @"Download map";
|
||||
static NSString * const kStatDownloadMaps = @"Download maps";
|
||||
static NSString * const kStatDownloadRequest = @"Download request";
|
||||
static NSString * const kStatDownloadRoute = @"Download route";
|
||||
static NSString * const kStatDownloader = @"downloader";
|
||||
static NSString * const kStatDownloaderDialog = @"Downloader dialog";
|
||||
static NSString * const kStatDownloaderDownloadCancel = @"Downloader_Download_cancel";
|
||||
|
@ -59,10 +63,6 @@ static NSString * const kStatDownloaderMigrationCompleted = @"Downloader_Migrati
|
|||
static NSString * const kStatDownloaderMigrationDialogue = @"Downloader_Migration_dialogue";
|
||||
static NSString * const kStatDownloaderMigrationError = @"Downloader_Migration_error";
|
||||
static NSString * const kStatDownloaderMigrationStarted = @"Downloader_Migration_started";
|
||||
static NSString * const kStatDownloadMap = @"Download map";
|
||||
static NSString * const kStatDownloadMaps = @"Download maps";
|
||||
static NSString * const kStatDownloadRequest = @"Download request";
|
||||
static NSString * const kStatDownloadRoute = @"Download route";
|
||||
static NSString * const kStatEdit = @"Edit";
|
||||
static NSString * const kStatEditTime = @"Edit time";
|
||||
static NSString * const kStatError = @"Error";
|
||||
|
@ -82,8 +82,8 @@ static NSString * const kStatHistory = @"History";
|
|||
static NSString * const kStatImport = @"Import";
|
||||
static NSString * const kStatIn = @"In";
|
||||
static NSString * const kStatIsAuto = @"is_auto";
|
||||
static NSString * const kStatKilometers = @"Kilometers";
|
||||
static NSString * const kStatKML = @"KML";
|
||||
static NSString * const kStatKilometers = @"Kilometers";
|
||||
static NSString * const kStatLandscape = @"Landscape";
|
||||
static NSString * const kStatLanguage = @"Language";
|
||||
static NSString * const kStatLocation = @"Location";
|
||||
|
@ -105,13 +105,13 @@ static NSString * const kStatNightMode = @"NightMode";
|
|||
static NSString * const kStatNo = @"No";
|
||||
static NSString * const kStatNoConnection = @"no_connection";
|
||||
static NSString * const kStatNoSpace = @"no_space";
|
||||
static NSString * const kStatOSM = @"OSM";
|
||||
static NSString * const kStatOff = @"Off";
|
||||
static NSString * const kStatOn = @"On";
|
||||
static NSString * const kStatOpen = @"Open";
|
||||
static NSString * const kStatOpenActionSheet = @"Open action sheet";
|
||||
static NSString * const kStatOpenSite = @"Open site";
|
||||
static NSString * const kStatOrientation = @"Orientation";
|
||||
static NSString * const kStatOSM = @"OSM";
|
||||
static NSString * const kStatOther = @"Other";
|
||||
static NSString * const kStatOut = @"Out";
|
||||
static NSString * const kStatPedestrian = @"Pedestrian";
|
||||
|
@ -120,8 +120,6 @@ static NSString * const kStatPointToPoint = @"Point to point";
|
|||
static NSString * const kStatPortrait = @"Portrait";
|
||||
static NSString * const kStatProgress = @"Progress";
|
||||
static NSString * const kStatPushReceived = @"Push received";
|
||||
static NSString * const kStatiPad = @"iPad";
|
||||
static NSString * const kStatiPhone = @"iPhone";
|
||||
static NSString * const kStatRate = @"Rate";
|
||||
static NSString * const kStatRecentTrack = @"Recent track";
|
||||
static NSString * const kStatRegular = @"Regular";
|
||||
|
@ -129,6 +127,7 @@ static NSString * const kStatRemove = @"Remove";
|
|||
static NSString * const kStatRename = @"Rename";
|
||||
static NSString * const kStatReport = @"Report";
|
||||
static NSString * const kStatRetry = @"retry";
|
||||
static NSString * const kStatRouting = @"routing";
|
||||
static NSString * const kStatSave = @"Save";
|
||||
static NSString * const kStatScenario = @"scenario";
|
||||
static NSString * const kStatScreen = @"Screen";
|
||||
|
@ -148,7 +147,10 @@ static NSString * const kStatSocial = @"Social";
|
|||
static NSString * const kStatSource = @"Source";
|
||||
static NSString * const kStatStart = @"Start";
|
||||
static NSString * const kStatSwapRoutingPoints = @"Swap routing points";
|
||||
static NSString * const kStatTTS = @"TTS";
|
||||
static NSString * const kStatTTSSettings = @"TTS settings";
|
||||
static NSString * const kStatTable = @"Table";
|
||||
static NSString * const kStatToMyPosition = @"To my position";
|
||||
static NSString * const kStatToggleBookmark = @"Toggle bookmark";
|
||||
static NSString * const kStatToggleCompassCalibration = @"Toggle compass calibration";
|
||||
static NSString * const kStatToggleCoordinates = @"Toggle coordinates";
|
||||
|
@ -157,9 +159,6 @@ static NSString * const kStatToggleSection = @"Toggle section";
|
|||
static NSString * const kStatToggleStatistics = @"Toggle statistics";
|
||||
static NSString * const kStatToggleVisibility = @"Toggle visibility";
|
||||
static NSString * const kStatToggleZoomButtonsVisibility = @"Toggle zoom buttons visibility";
|
||||
static NSString * const kStatToMyPosition = @"To my position";
|
||||
static NSString * const kStatTTS = @"TTS";
|
||||
static NSString * const kStatTTSSettings = @"TTS settings";
|
||||
static NSString * const kStatType = @"type";
|
||||
static NSString * const kStatUnknownError = @"unknown_error";
|
||||
static NSString * const kStatUpdate = @"update";
|
||||
|
@ -170,6 +169,8 @@ static NSString * const kStatVisible = @"Visible";
|
|||
static NSString * const kStatWhatsNew = @"What's New";
|
||||
static NSString * const kStatYes = @"Yes";
|
||||
static NSString * const kStatZoom = @"Zoom";
|
||||
static NSString * const kStatiPad = @"iPad";
|
||||
static NSString * const kStatiPhone = @"iPhone";
|
||||
|
||||
static inline NSString * const kStatEventName(NSString * component, NSString * action)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue