diff options
author | Ilya Grechuhin <i.grechuhin@mapswithme.com> | 2015-06-03 15:40:38 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:49:51 +0300 |
commit | 1ac06d7429aa136793568e222fb150ea9fdcab82 (patch) | |
tree | 2fa24787c9b3721a405dcbec2126d2982dfcd99e /iphone/Maps/Classes/MapsAppDelegate.mm | |
parent | 2a1c6347aded0f76e997a0869810d84089ac47dd (diff) |
[ios] Added disable standby on routing, follow, active download modes.
Diffstat (limited to 'iphone/Maps/Classes/MapsAppDelegate.mm')
-rw-r--r-- | iphone/Maps/Classes/MapsAppDelegate.mm | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm index 46aa02801c..3706e29cb0 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.mm +++ b/iphone/Maps/Classes/MapsAppDelegate.mm @@ -70,6 +70,12 @@ void InitLocalizedStrings() f.AddString("routing_failed_internal_error", [L(@"routing_failed_internal_error") UTF8String]); } +@interface MapsAppDelegate () + +@property (nonatomic) NSInteger standbyCounter; + +@end + @implementation MapsAppDelegate { NSString * m_geoURL; @@ -184,6 +190,8 @@ void InitLocalizedStrings() [self customizeAppearance]; [self initMyTrackerService]; + + self.standbyCounter = 0; if ([application respondsToSelector:@selector(setMinimumBackgroundFetchInterval:)]) [application setMinimumBackgroundFetchInterval:(6 * 60 * 60)]; @@ -207,8 +215,6 @@ void InitLocalizedStrings() } [[NSUserDefaults standardUserDefaults] synchronize]; - application.idleTimerDisabled = YES; - Framework & f = GetFramework(); application.applicationIconBadgeNumber = f.GetCountryTree().GetActiveMapLayout().GetOutOfDateCount(); f.GetLocationState()->InvalidatePosition(); @@ -512,6 +518,24 @@ void InitLocalizedStrings() [RouteState remove]; } +#pragma mark - Standby + +- (void)enableStandby +{ + self.standbyCounter--; +} + +- (void)disableStandby +{ + self.standbyCounter++; +} + +- (void)setStandbyCounter:(NSInteger)standbyCounter +{ + _standbyCounter = MAX(0, standbyCounter); + [UIApplication sharedApplication].idleTimerDisabled = (_standbyCounter != 0); +} + #pragma mark - Alert logic - (void)firstLaunchSetup |