mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 22:27:20 +02:00
Show small voice chat button for empty voice chats.
This commit is contained in:
parent
613bf98283
commit
b6b7f5706f
3 changed files with 32 additions and 1 deletions
|
@ -321,6 +321,7 @@ rpl::producer<Ui::GroupCallBarContent> GroupCallTracker::ContentByCall(
|
|||
call->fullCountValue(
|
||||
) | rpl::start_with_next([=](int count) {
|
||||
state->current.count = count;
|
||||
state->current.shown = (count > 0);
|
||||
consumer.put_next_copy(state->current);
|
||||
}, lifetime);
|
||||
|
||||
|
|
|
@ -525,12 +525,36 @@ void TopBarWidget::setActiveChat(
|
|||
_activeChat = activeChat;
|
||||
return;
|
||||
}
|
||||
const auto peerChanged = (_activeChat.key.history()
|
||||
!= activeChat.key.history());
|
||||
|
||||
_activeChat = activeChat;
|
||||
_sendAction = sendAction;
|
||||
_titlePeerText.clear();
|
||||
_back->clearState();
|
||||
update();
|
||||
|
||||
if (peerChanged) {
|
||||
_activeChatLifetime.destroy();
|
||||
if (const auto history = _activeChat.key.history()) {
|
||||
session().changes().peerFlagsValue(
|
||||
history->peer,
|
||||
Data::PeerUpdate::Flag::GroupCall
|
||||
) | rpl::map([=] {
|
||||
return history->peer->groupCall();
|
||||
}) | rpl::distinct_until_changed(
|
||||
) | rpl::map([](Data::GroupCall *call) {
|
||||
return call ? call->fullCountValue() : rpl::single(-1);
|
||||
}) | rpl::flatten_latest(
|
||||
) | rpl::map([](int count) {
|
||||
return (count == 0);
|
||||
}) | rpl::distinct_until_changed(
|
||||
) | rpl::start_with_next([=] {
|
||||
updateControlsVisibility();
|
||||
updateControlsGeometry();
|
||||
}, _activeChatLifetime);
|
||||
}
|
||||
}
|
||||
updateUnreadBadge();
|
||||
refreshInfoButton();
|
||||
if (_menu) {
|
||||
|
@ -722,7 +746,12 @@ void TopBarWidget::updateControlsVisibility() {
|
|||
_call->setVisible(historyMode && callsEnabled);
|
||||
const auto groupCallsEnabled = [&] {
|
||||
if (const auto peer = _activeChat.key.peer()) {
|
||||
return peer->canManageGroupCall();
|
||||
if (peer->canManageGroupCall()) {
|
||||
return true;
|
||||
} else if (const auto call = peer->groupCall()) {
|
||||
return (call->fullCount() == 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}();
|
||||
|
|
|
@ -130,6 +130,7 @@ private:
|
|||
const not_null<Window::SessionController*> _controller;
|
||||
ActiveChat _activeChat;
|
||||
QString _customTitleText;
|
||||
rpl::lifetime _activeChatLifetime;
|
||||
|
||||
int _selectedCount = 0;
|
||||
bool _canDelete = false;
|
||||
|
|
Loading…
Add table
Reference in a new issue