mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 23:53:58 +02:00
Fixed display of chat buttons on main touchbar after audio touchbar.
Fixed #10361.
This commit is contained in:
parent
07c65dfd74
commit
23996d14d3
2 changed files with 14 additions and 15 deletions
|
@ -540,10 +540,7 @@ void AppendEmojiPacks(
|
||||||
self.popoverTouchBar = [[[NSTouchBar alloc] init] autorelease];
|
self.popoverTouchBar = [[[NSTouchBar alloc] init] autorelease];
|
||||||
self.popoverTouchBar.delegate = self;
|
self.popoverTouchBar.delegate = self;
|
||||||
|
|
||||||
rpl::single(
|
controller->sessionController()->activeChatValue(
|
||||||
controller->sessionController()->activeChatCurrent()
|
|
||||||
) | rpl::then(
|
|
||||||
controller->sessionController()->activeChatChanges()
|
|
||||||
) | rpl::map([](Dialogs::Key k) {
|
) | rpl::map([](Dialogs::Key k) {
|
||||||
return k.peer()
|
return k.peer()
|
||||||
&& k.history()
|
&& k.history()
|
||||||
|
|
|
@ -59,7 +59,8 @@ const auto kAudioItemIdentifier = @"touchbarAudio";
|
||||||
Main::Session *_session;
|
Main::Session *_session;
|
||||||
Window::Controller *_controller;
|
Window::Controller *_controller;
|
||||||
|
|
||||||
rpl::producer<bool> _canApplyMarkdown;
|
bool _canApplyMarkdownLast;
|
||||||
|
rpl::event_stream<bool> _canApplyMarkdown;
|
||||||
rpl::event_stream<> _touchBarSwitches;
|
rpl::event_stream<> _touchBarSwitches;
|
||||||
rpl::lifetime _lifetime;
|
rpl::lifetime _lifetime;
|
||||||
}
|
}
|
||||||
|
@ -76,7 +77,10 @@ const auto kAudioItemIdentifier = @"touchbarAudio";
|
||||||
self.defaultItemIdentifiers = @[];
|
self.defaultItemIdentifiers = @[];
|
||||||
});
|
});
|
||||||
_controller = controller;
|
_controller = controller;
|
||||||
_canApplyMarkdown = std::move(canApplyMarkdown);
|
_canApplyMarkdownLast = false;
|
||||||
|
std::move(
|
||||||
|
canApplyMarkdown
|
||||||
|
) | rpl::start_to_stream(_canApplyMarkdown, _lifetime);
|
||||||
|
|
||||||
auto sessionChanges = domain->activeSessionChanges(
|
auto sessionChanges = domain->activeSessionChanges(
|
||||||
) | rpl::map([=](Main::Session *session) {
|
) | rpl::map([=](Main::Session *session) {
|
||||||
|
@ -138,18 +142,16 @@ const auto kAudioItemIdentifier = @"touchbarAudio";
|
||||||
init:_controller
|
init:_controller
|
||||||
touchBarSwitches:_touchBarSwitches.events()] autorelease];
|
touchBarSwitches:_touchBarSwitches.events()] autorelease];
|
||||||
rpl::combine(
|
rpl::combine(
|
||||||
rpl::single(false) | rpl::then(rpl::duplicate(_canApplyMarkdown)),
|
_canApplyMarkdown.events_starting_with_copy(
|
||||||
rpl::single(
|
_canApplyMarkdownLast),
|
||||||
false
|
_controller->sessionController()->activeChatValue(
|
||||||
) | rpl::then(
|
) | rpl::map([](Dialogs::Key k) {
|
||||||
_controller->sessionController()->activeChatChanges(
|
return k.peer() && k.history() && k.peer()->canWrite();
|
||||||
) | rpl::map([](Dialogs::Key k) {
|
}) | rpl::distinct_until_changed()
|
||||||
return k.peer() && k.history() && k.peer()->canWrite();
|
|
||||||
})
|
|
||||||
) | rpl::distinct_until_changed()
|
|
||||||
) | rpl::start_with_next([=](
|
) | rpl::start_with_next([=](
|
||||||
bool canApplyMarkdown,
|
bool canApplyMarkdown,
|
||||||
bool hasActiveChat) {
|
bool hasActiveChat) {
|
||||||
|
_canApplyMarkdownLast = canApplyMarkdown;
|
||||||
item.groupTouchBar.defaultItemIdentifiers = @[
|
item.groupTouchBar.defaultItemIdentifiers = @[
|
||||||
kPinnedPanelItemIdentifier,
|
kPinnedPanelItemIdentifier,
|
||||||
canApplyMarkdown
|
canApplyMarkdown
|
||||||
|
|
Loading…
Add table
Reference in a new issue