Commit e4d6e783 authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Kateryna Kostiuk

app: prevent sleeping with timed events

Change-Id: Id70f5ddf592f9e658c201246a0cebe14e278284a
Reviewed-by: Kateryna Kostiuk's avatarKateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
parent ecdc4faa
......@@ -55,6 +55,8 @@
@implementation AppDelegate
NSTimer* preventSleepTimer;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints"];
......@@ -74,6 +76,18 @@
queue = dispatch_queue_create("scNetworkReachability", DISPATCH_QUEUE_SERIAL);
[self setScNetworkQueue:queue];
[self beginObservingReachabilityStatus];
[self startSleepPreventionTimer];
}
- (void) startSleepPreventionTimer
{
if (preventSleepTimer != nil) {
[preventSleepTimer invalidate];
}
preventSleepTimer = [NSTimer timerWithTimeInterval:30.0 repeats:YES block:^(NSTimer * _Nonnull timer) {
UpdateSystemActivity(OverallAct);
}];
[[NSRunLoop mainRunLoop] addTimer:preventSleepTimer forMode:NSRunLoopCommonModes];
}
- (void) beginObservingReachabilityStatus
......@@ -303,6 +317,9 @@ static void ReachabilityCallback(SCNetworkReachabilityRef __unused target, SCNet
- (void) cleanExit
{
if (preventSleepTimer != nil) {
[preventSleepTimer invalidate];
}
[self.wizard close];
[self.ringWindowController close];
delete CallModel::instance().QObject::parent();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment