forked from organicmaps/organicmaps
[ios] Added routing bicycle disclaimer alert.
This commit is contained in:
parent
dcd00a947d
commit
1c3a70a6f1
7 changed files with 49 additions and 6 deletions
|
@ -19,6 +19,7 @@
|
|||
- (void)presentFacebookAlert;
|
||||
- (void)presentPoint2PointAlertWithOkBlock:(nonnull TMWMVoidBlock)okBlock needToRebuild:(BOOL)needToRebuild;
|
||||
- (void)presentRoutingDisclaimerAlert;
|
||||
- (void)presentBicycleRoutingDisclaimerAlert;
|
||||
- (void)presentDisabledLocationAlert;
|
||||
- (void)presentLocationAlert;
|
||||
- (void)presentLocationServiceNotSupportedAlert;
|
||||
|
|
|
@ -132,6 +132,11 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController
|
|||
[self displayAlert:[MWMAlert routingDisclaimerAlertWithInitialOrientation:self.ownerViewController.interfaceOrientation]];
|
||||
}
|
||||
|
||||
- (void)presentBicycleRoutingDisclaimerAlert
|
||||
{
|
||||
[self displayAlert:[MWMAlert routingBicycleDisclaimerAlert]];
|
||||
}
|
||||
|
||||
- (void)presentDisabledLocationAlert
|
||||
{
|
||||
[self displayAlert:MWMAlert.disabledLocationAlert];
|
||||
|
|
|
@ -19,6 +19,7 @@ using TMWMDownloadBlock = void (^)(storage::TCountriesVec const &, TMWMVoidBlock
|
|||
+ (MWMAlert *)facebookAlert;
|
||||
+ (MWMAlert *)locationAlert;
|
||||
+ (MWMAlert *)routingDisclaimerAlertWithInitialOrientation:(UIInterfaceOrientation)orientation;
|
||||
+ (MWMAlert *)routingBicycleDisclaimerAlert;
|
||||
+ (MWMAlert *)disabledLocationAlert;
|
||||
+ (MWMAlert *)noWiFiAlertWithOkBlock:(TMWMVoidBlock)okBlock;
|
||||
+ (MWMAlert *)noConnectionAlert;
|
||||
|
|
|
@ -39,6 +39,11 @@
|
|||
return [MWMRoutingDisclaimerAlert alertWithInitialOrientation:orientation];
|
||||
}
|
||||
|
||||
+ (MWMAlert *)routingBicycleDisclaimerAlert
|
||||
{
|
||||
return [MWMDefaultAlert routingBicycleDisclaimerAlert];
|
||||
}
|
||||
|
||||
+ (MWMAlert *)disabledLocationAlert
|
||||
{
|
||||
return [MWMDefaultAlert disabledLocationAlert];
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
+ (instancetype)downloaderInternalErrorAlertWithOkBlock:(TMWMVoidBlock)okBlock cancelBlock:(TMWMVoidBlock)cancelBlock;
|
||||
+ (instancetype)downloaderNeedUpdateAlertWithOkBlock:(TMWMVoidBlock)okBlock;
|
||||
+ (instancetype)routingMigrationAlertWithOkBlock:(TMWMVoidBlock)okBlock;
|
||||
+ (instancetype)routingBicycleDisclaimerAlert;
|
||||
+ (instancetype)resetChangesAlertWithBlock:(TMWMVoidBlock)block;
|
||||
+ (instancetype)deleteFeatureAlertWithBlock:(TMWMVoidBlock)block;
|
||||
|
||||
|
|
|
@ -341,6 +341,17 @@ static NSString * const kDefaultAlertNibName = @"MWMDefaultAlert";
|
|||
return alert;
|
||||
}
|
||||
|
||||
+ (instancetype)routingBicycleDisclaimerAlert
|
||||
{
|
||||
kStatisticsEvent = @"Routing Bicycle Disclaimer Alert";
|
||||
MWMDefaultAlert * alert = [self defaultAlertWithTitle:@"whatsnew_cycle_navigation_header"
|
||||
message:@"whatsnew_cycle_navigation_message"
|
||||
rightButtonTitle:@"ok"
|
||||
leftButtonTitle:nil
|
||||
rightButtonAction:nil];
|
||||
return alert;
|
||||
}
|
||||
|
||||
+ (instancetype)resetChangesAlertWithBlock:(TMWMVoidBlock)block
|
||||
{
|
||||
kStatisticsEvent = @"Reset changes alert";
|
||||
|
|
|
@ -627,18 +627,32 @@ BOOL gIsFirstMyPositionMode = YES;
|
|||
{
|
||||
case routing::IRouter::ResultCode::NoError:
|
||||
{
|
||||
GetFramework().DeactivateMapSelection(true);
|
||||
auto & f = GetFramework();
|
||||
f.DeactivateMapSelection(true);
|
||||
if (self.forceRoutingStateChange == ForceRoutingStateChangeStartFollowing)
|
||||
[self.controlsManager routingNavigation];
|
||||
else
|
||||
[self.controlsManager routingReady];
|
||||
[self updateRoutingInfo];
|
||||
bool isDisclaimerApproved = false;
|
||||
(void)settings::Get("IsDisclaimerApproved", isDisclaimerApproved);
|
||||
if (!isDisclaimerApproved)
|
||||
if (f.GetRouter() == routing::RouterType::Bicycle)
|
||||
{
|
||||
[self presentRoutingDisclaimerAlert];
|
||||
settings::Set("IsDisclaimerApproved", true);
|
||||
NSString * bicycleDisclaimer = @"IsBicycleDisclaimerApproved";
|
||||
NSUserDefaults * ud = [NSUserDefaults standardUserDefaults];
|
||||
if ([ud boolForKey:bicycleDisclaimer])
|
||||
return;
|
||||
[self presentBicycleRoutingDisclaimerAlert];
|
||||
[ud setBool:YES forKey:bicycleDisclaimer];
|
||||
[ud synchronize];
|
||||
}
|
||||
else
|
||||
{
|
||||
bool isDisclaimerApproved = false;
|
||||
(void)settings::Get("IsDisclaimerApproved", isDisclaimerApproved);
|
||||
if (!isDisclaimerApproved)
|
||||
{
|
||||
[self presentRoutingDisclaimerAlert];
|
||||
settings::Set("IsDisclaimerApproved", true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -835,6 +849,11 @@ BOOL gIsFirstMyPositionMode = YES;
|
|||
[self.alertController presentRoutingDisclaimerAlert];
|
||||
}
|
||||
|
||||
- (void)presentBicycleRoutingDisclaimerAlert
|
||||
{
|
||||
[self.alertController presentBicycleRoutingDisclaimerAlert];
|
||||
}
|
||||
|
||||
#pragma mark - Private methods
|
||||
|
||||
- (void)setRestoreRouteDestination:(m2::PointD)restoreRouteDestination
|
||||
|
|
Loading…
Add table
Reference in a new issue