Added passcode lock handler for touchbar.

This commit is contained in:
23rd 2019-05-02 14:02:54 +03:00 committed by John Preston
parent 92ff237c2d
commit c424607603
2 changed files with 13 additions and 0 deletions

View File

@ -36,6 +36,7 @@ static NSTouchBarItemIdentifier _Nullable currentPosition = [NSString stringWith
@interface TouchBar : NSTouchBar
@property TouchBarType touchBarType;
@property TouchBarType touchBarTypeBeforeLock;
@property(retain) NSDictionary * _Nullable touchbarItems;
@property(retain) NSTouchBar * _Nullable touchBarMain;

View File

@ -268,6 +268,16 @@ auto lifetime = rpl::lifetime();
}
}, lifetime);
Core::App().passcodeLockChanges(
) | rpl::start_with_next([=](bool locked) {
if (locked) {
self.touchBarTypeBeforeLock = self.touchBarType;
[self setTouchBar:TouchBarType::None];
} else {
[self setTouchBar:self.touchBarTypeBeforeLock];
}
}, lifetime);
return self;
}
@ -341,6 +351,8 @@ auto lifetime = rpl::lifetime();
[self.view setTouchBar:_touchBarMain];
} else if (type == TouchBarType::AudioPlayer) {
[self.view setTouchBar:_touchBarAudioPlayer];
} else if (type == TouchBarType::None) {
[self.view setTouchBar:nil];
}
}