forked from organicmaps/organicmaps
Merge pull request #3862 from VladiMihaylenko/master
[ios] Track warning alert.
This commit is contained in:
commit
c6fe78e051
7 changed files with 43 additions and 0 deletions
|
@ -46,6 +46,7 @@
|
|||
- (void)presentEditorViralAlert;
|
||||
- (void)presentOsmAuthAlert;
|
||||
- (void)presentPersonalInfoWarningAlertWithBlock:(nonnull TMWMVoidBlock)block;
|
||||
- (void)presentTrackWarningAlertWithCancelBlock:(nonnull TMWMVoidBlock)block;
|
||||
- (void)closeAlert;
|
||||
|
||||
- (nonnull instancetype)init __attribute__((unavailable("call -initWithViewController: instead!")));
|
||||
|
|
|
@ -175,6 +175,11 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController
|
|||
[self displayAlert:[MWMAlert personalInfoWarningAlertWithBlock:block]];
|
||||
}
|
||||
|
||||
- (void)presentTrackWarningAlertWithCancelBlock:(nonnull TMWMVoidBlock)block
|
||||
{
|
||||
[self displayAlert:[MWMAlert trackWarningAlertWithCancelBlock:block]];
|
||||
}
|
||||
|
||||
- (void)presentEditorViralAlert { [self displayAlert:[MWMAlert editorViralAlert]]; }
|
||||
- (void)presentOsmAuthAlert { [self displayAlert:[MWMAlert osmAuthAlert]]; }
|
||||
- (void)displayAlert:(MWMAlert *)alert
|
||||
|
|
|
@ -44,6 +44,7 @@ using TMWMDownloadBlock = void (^)(storage::TCountriesVec const &, TMWMVoidBlock
|
|||
+ (MWMAlert *)editorViralAlert;
|
||||
+ (MWMAlert *)osmAuthAlert;
|
||||
+ (MWMAlert *)personalInfoWarningAlertWithBlock:(TMWMVoidBlock)block;
|
||||
+ (MWMAlert *)trackWarningAlertWithCancelBlock:(TMWMVoidBlock)block;
|
||||
- (void)close;
|
||||
|
||||
- (void)setNeedsCloseAlertAfterEnterBackground;
|
||||
|
|
|
@ -203,6 +203,11 @@
|
|||
return [MWMDefaultAlert personalInfoWarningAlertWithBlock:block];
|
||||
}
|
||||
|
||||
+ (MWMAlert *)trackWarningAlertWithCancelBlock:(TMWMVoidBlock)block
|
||||
{
|
||||
return [MWMDefaultAlert trackWarningAlertWithCancelBlock:block];
|
||||
}
|
||||
|
||||
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation
|
||||
{
|
||||
// Should override this method if you want custom relayout after rotation.
|
||||
|
|
|
@ -32,5 +32,6 @@
|
|||
+ (instancetype)resetChangesAlertWithBlock:(TMWMVoidBlock)block;
|
||||
+ (instancetype)deleteFeatureAlertWithBlock:(TMWMVoidBlock)block;
|
||||
+ (instancetype)personalInfoWarningAlertWithBlock:(TMWMVoidBlock)block;
|
||||
+ (instancetype)trackWarningAlertWithCancelBlock:(TMWMVoidBlock)block;
|
||||
|
||||
@end
|
||||
|
|
|
@ -385,6 +385,17 @@ static NSString * const kDefaultAlertNibName = @"MWMDefaultAlert";
|
|||
return alert;
|
||||
}
|
||||
|
||||
+ (instancetype)trackWarningAlertWithCancelBlock:(TMWMVoidBlock)block
|
||||
{
|
||||
kStatisticsEvent = @"Track warning alert";
|
||||
MWMDefaultAlert * alert = [self defaultAlertWithTitle:@"recent_track_background_dialog_title"
|
||||
message:@"recent_track_background_dialog_message"
|
||||
rightButtonTitle:@"off_recent_track_background_button"
|
||||
leftButtonTitle:@"continue_download"
|
||||
rightButtonAction:block];
|
||||
return alert;
|
||||
}
|
||||
|
||||
+ (instancetype)defaultAlertWithTitle:(nonnull NSString *)title
|
||||
message:(nullable NSString *)message
|
||||
rightButtonTitle:(nonnull NSString *)rightButtonTitle
|
||||
|
|
|
@ -58,6 +58,7 @@ static NSString * const kUDLastRateRequestDate = @"LastRateRequestDate";
|
|||
extern NSString * const kUDAlreadySharedKey = @"UserAlreadyShared";
|
||||
static NSString * const kUDLastShareRequstDate = @"LastShareRequestDate";
|
||||
static NSString * const kUDAutoNightModeOff = @"AutoNightModeOff";
|
||||
static NSString * const kUDTrackWarningAlertWasShown = @"TrackWarningAlertWasShown";
|
||||
static NSString * const kPushDeviceTokenLogEvent = @"iOSPushDeviceToken";
|
||||
static NSString * const kIOSIDFA = @"IFA";
|
||||
static NSString * const kBundleVersion = @"BundleVersion";
|
||||
|
@ -610,6 +611,24 @@ using namespace osm_auth_ios;
|
|||
{
|
||||
LOG(LINFO, ("applicationWillEnterForeground"));
|
||||
GetFramework().EnterForeground();
|
||||
if (!GpsTracker::Instance().IsEnabled())
|
||||
return;
|
||||
|
||||
MWMViewController * topVc = static_cast<MWMViewController *>(
|
||||
self.mapViewController.navigationController.topViewController);
|
||||
if (![topVc isKindOfClass:[MWMViewController class]])
|
||||
return;
|
||||
|
||||
NSUserDefaults * ud = [NSUserDefaults standardUserDefaults];
|
||||
if ([ud boolForKey:kUDTrackWarningAlertWasShown])
|
||||
return;
|
||||
|
||||
[topVc.alertController presentTrackWarningAlertWithCancelBlock:^{
|
||||
GpsTracker::Instance().SetEnabled(false);
|
||||
}];
|
||||
|
||||
[ud setBool:YES forKey:kUDTrackWarningAlertWasShown];
|
||||
[ud synchronize];
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application
|
||||
|
|
Loading…
Add table
Reference in a new issue