Skip to content

Commit

Permalink
Fixed a bug where KVO didn't call on the main queue.
Browse files Browse the repository at this point in the history
  • Loading branch information
newmarcel committed Aug 9, 2019
1 parent 45de5b8 commit bbd974d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions KeepingYouAwake/KYAAppController.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,12 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
{
if([object isEqual:self.sleepWakeTimer] && [keyPath isEqualToString:@"scheduled"])
{
// Update the status item for scheduling changes
BOOL active = [change[NSKeyValueChangeNewKey] boolValue];
self.statusItemController.activeAppearanceEnabled = active;
KYA_WEAK weakSelf = self;
dispatch_async(dispatch_get_main_queue(), ^{
// Update the status item for scheduling changes
BOOL active = [change[NSKeyValueChangeNewKey] boolValue];
weakSelf.statusItemController.activeAppearanceEnabled = active;
});
}
}

Expand Down

0 comments on commit bbd974d

Please sign in to comment.