Don't use a 10s timer for battery level polling. Legacy code?

This commit is contained in:
Guillaume BIENKOWSKI 2014-11-28 16:59:27 +01:00
parent 45f0642485
commit 4dc4fca33e
2 changed files with 2 additions and 5 deletions

View file

@ -61,7 +61,6 @@
@interface PhoneMainView : UIViewController<IncomingCallViewDelegate> {
@private
NSMutableArray *inhibitedEvents;
NSTimer *batteryTimer;
}
@property (nonatomic, retain) IBOutlet UIView *statusBarBG;

View file

@ -187,13 +187,12 @@ static RootViewManager* rootViewManagerInstance = nil;
selector:@selector(onGlobalStateChanged:)
name:kLinphoneGlobalStateUpdate
object:nil];
[[UIDevice currentDevice] setBatteryMonitoringEnabled:YES];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(batteryLevelChanged:)
name:UIDeviceBatteryLevelDidChangeNotification
object:nil];
[[UIDevice currentDevice] setBatteryMonitoringEnabled:YES];
batteryTimer = [NSTimer scheduledTimerWithTimeInterval:10.0f target:self selector:@selector(batteryLevelChanged:) userInfo:nil repeats:TRUE];
}
- (void)viewWillDisappear:(BOOL)animated {
@ -221,7 +220,6 @@ static RootViewManager* rootViewManagerInstance = nil;
object:nil];
[[UIDevice currentDevice] setBatteryMonitoringEnabled:NO];
[batteryTimer invalidate];
}
- (void)viewDidAppear:(BOOL)animated {