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.vmessages.v,
data.vdialogs.v); data.vdialogs.v);
_session->data().chatsListChanged(folder); _session->data().chatsListChanged(folder);
_session->data().notifyPinnedDialogsOrderUpdated();
}); });
}).fail([=](const RPCError &error) { }).fail([=](const RPCError &error) {
finalize(); finalize();

View File

@ -398,18 +398,19 @@ MainWindow::MainWindow()
subscribe(Core::App().authSessionChanged(), [this] { subscribe(Core::App().authSessionChanged(), [this] {
if (AuthSession::Exists()) { if (AuthSession::Exists()) {
// We need only common pinned dialogs.
Auth().data().chatsListChanges( if (!_private->_touchBar) {
) | rpl::start_with_next([this](Data::Folder* folder) { if (auto view = reinterpret_cast<NSView*>(winId())) {
// We need only common pinned dialogs. // Create TouchBar.
if (!folder && !_private->_touchBar) { [NSApplication sharedApplication].automaticCustomizeTouchBarMenuItemEnabled = YES;
if (auto view = reinterpret_cast<NSView*>(winId())) { _private->_touchBar = [[TouchBar alloc] init:view];
// 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; @property(retain) NSMutableArray * _Nullable mainPinnedButtons;
- (id _Nonnull) init:(NSView * _Nonnull)view; - (id _Nonnull) init:(NSView * _Nonnull)view;
- (void)handlePropertyChange:(Media::Player::TrackState)property; - (void) handlePropertyChange:(Media::Player::TrackState)property;
- (void) setTouchBar:(TouchBarType)type;
@end @end

View File

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