Added handler of logout to touchbar.

This commit is contained in:
23rd 2019-05-08 13:42:15 +03:00 committed by John Preston
parent c89a21ef5e
commit c90e803f1b
4 changed files with 15 additions and 17 deletions

View File

@ -944,6 +944,7 @@ void ApiWrap::requestPinnedDialogs(Data::Folder *folder) {
data.vmessages.v,
data.vdialogs.v);
_session->data().chatsListChanged(folder);
_session->data().notifyPinnedDialogsOrderUpdated();
});
}).fail([=](const RPCError &error) {
finalize();

View File

@ -398,18 +398,19 @@ MainWindow::MainWindow()
subscribe(Core::App().authSessionChanged(), [this] {
if (AuthSession::Exists()) {
Auth().data().chatsListChanges(
) | rpl::start_with_next([this](Data::Folder* folder) {
// We need only common pinned dialogs.
if (!folder && !_private->_touchBar) {
if (auto view = reinterpret_cast<NSView*>(winId())) {
// Create TouchBar.
[NSApplication sharedApplication].automaticCustomizeTouchBarMenuItemEnabled = YES;
_private->_touchBar = [[TouchBar alloc] init:view];
}
// We need only common pinned dialogs.
if (!_private->_touchBar) {
if (auto view = reinterpret_cast<NSView*>(winId())) {
// Create TouchBar.
[NSApplication sharedApplication].automaticCustomizeTouchBarMenuItemEnabled = YES;
_private->_touchBar = [[TouchBar alloc] init:view];
}
}, lifetime());
}
} else {
if (_private->_touchBar) {
[_private->_touchBar setTouchBar:TouchBarType::None];
}
_private->_touchBar = nullptr;
}
});

View File

@ -49,6 +49,7 @@ static NSTouchBarItemIdentifier _Nullable currentPosition = [NSString stringWith
@property(retain) NSMutableArray * _Nullable mainPinnedButtons;
- (id _Nonnull) init:(NSView * _Nonnull)view;
- (void)handlePropertyChange:(Media::Player::TrackState)property;
- (void) handlePropertyChange:(Media::Player::TrackState)property;
- (void) setTouchBar:(TouchBarType)type;
@end

View File

@ -26,11 +26,6 @@ enum class SystemSettingsType {
Audio,
};
enum class TouchBarType {
AudioPlayer,
None,
};
void SetWatchingMediaKeys(bool watching);
bool IsApplicationActive();
void SetApplicationIcon(const QIcon &icon);