[ios] Disable idle timer.

This commit is contained in:
Ilya Grechuhin 2015-05-29 18:12:09 +03:00 committed by Alex Zolotarev
parent 1977f27868
commit dabc7d0665
4 changed files with 2 additions and 31 deletions

View file

@ -2,9 +2,6 @@
@protocol DownloadIndicatorProtocol <NSObject>
- (void)disableStandby;
- (void)enableStandby;
- (void)disableDownloadIndicator;
- (void)enableDownloadIndicator;

View file

@ -206,13 +206,10 @@ extern NSString * const kAlohalyticsTapEventKey = @"$onClick";
- (void)onLocationStateModeChanged:(location::State::Mode)newMode
{
[UIApplication sharedApplication].idleTimerDisabled = NO;
switch (newMode)
{
case location::State::UnknownPosition:
{
[[MapsAppDelegate theApp] enableStandby];
[[MapsAppDelegate theApp].m_locationManager stop:self];
PlacePageView * placePage = self.containerView.placePage;
@ -224,15 +221,12 @@ extern NSString * const kAlohalyticsTapEventKey = @"$onClick";
break;
}
case location::State::PendingPosition:
[[MapsAppDelegate theApp] disableStandby];
[[MapsAppDelegate theApp].m_locationManager start:self];
[[NSNotificationCenter defaultCenter] postNotificationName:LOCATION_MANAGER_STARTED_NOTIFICATION object:nil];
break;
case location::State::NotFollow:
case location::State::Follow:
break;
case location::State::RotateAndFollow:
[UIApplication sharedApplication].idleTimerDisabled = YES;
break;
}
}
@ -910,7 +904,6 @@ extern NSString * const kAlohalyticsTapEventKey = @"$onClick";
- (void)routeViewDidStartFollowing:(RouteView *)routeView
{
[UIApplication sharedApplication].idleTimerDisabled = YES;
[routeView setState:RouteViewStateTurnInstructions animated:YES];
self.controlsManager.zoomHidden = NO;
GetFramework().FollowRoute();
@ -923,7 +916,6 @@ extern NSString * const kAlohalyticsTapEventKey = @"$onClick";
- (void)dismissRouting
{
[UIApplication sharedApplication].idleTimerDisabled = NO;
GetFramework().CloseRouting();
[self.controlsManager resetZoomButtonsVisibility];
[self.routeView setState:RouteViewStateHidden animated:YES];

View file

@ -11,7 +11,6 @@
@interface MapsAppDelegate : NSObject <UIApplicationDelegate, UIAlertViewDelegate, ActiveMapsObserverProtocol, DownloadIndicatorProtocol>
{
NSInteger m_standbyCounter;
NSInteger m_activeDownloadsCounter;
UIBackgroundTaskIdentifier m_backgroundTask;
NavigationController * m_navController;
@ -24,9 +23,6 @@
+ (MapsAppDelegate *)theApp;
- (void)disableStandby;
- (void)enableStandby;
- (void)disableDownloadIndicator;
- (void)enableDownloadIndicator;

View file

@ -205,6 +205,8 @@ void InitLocalizedStrings()
[self shouldShowFacebookAlert];
}
[[NSUserDefaults standardUserDefaults] synchronize];
application.idleTimerDisabled = YES;
Framework & f = GetFramework();
application.applicationIconBadgeNumber = f.GetCountryTree().GetActiveMapLayout().GetOutOfDateCount();
@ -304,22 +306,6 @@ void InitLocalizedStrings()
DeleteFramework();
}
- (void)disableStandby
{
++m_standbyCounter;
[UIApplication sharedApplication].idleTimerDisabled = YES;
}
- (void)enableStandby
{
--m_standbyCounter;
if (m_standbyCounter <= 0)
{
[UIApplication sharedApplication].idleTimerDisabled = NO;
m_standbyCounter = 0;
}
}
- (void)disableDownloadIndicator
{
--m_activeDownloadsCounter;