mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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(
|
call->fullCountValue(
|
||||||
) | rpl::start_with_next([=](int count) {
|
) | rpl::start_with_next([=](int count) {
|
||||||
state->current.count = count;
|
state->current.count = count;
|
||||||
|
state->current.shown = (count > 0);
|
||||||
consumer.put_next_copy(state->current);
|
consumer.put_next_copy(state->current);
|
||||||
}, lifetime);
|
}, lifetime);
|
||||||
|
|
||||||
|
|
|
@ -525,12 +525,36 @@ void TopBarWidget::setActiveChat(
|
||||||
_activeChat = activeChat;
|
_activeChat = activeChat;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const auto peerChanged = (_activeChat.key.history()
|
||||||
|
!= activeChat.key.history());
|
||||||
|
|
||||||
_activeChat = activeChat;
|
_activeChat = activeChat;
|
||||||
_sendAction = sendAction;
|
_sendAction = sendAction;
|
||||||
_titlePeerText.clear();
|
_titlePeerText.clear();
|
||||||
_back->clearState();
|
_back->clearState();
|
||||||
update();
|
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();
|
updateUnreadBadge();
|
||||||
refreshInfoButton();
|
refreshInfoButton();
|
||||||
if (_menu) {
|
if (_menu) {
|
||||||
|
@ -722,7 +746,12 @@ void TopBarWidget::updateControlsVisibility() {
|
||||||
_call->setVisible(historyMode && callsEnabled);
|
_call->setVisible(historyMode && callsEnabled);
|
||||||
const auto groupCallsEnabled = [&] {
|
const auto groupCallsEnabled = [&] {
|
||||||
if (const auto peer = _activeChat.key.peer()) {
|
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;
|
return false;
|
||||||
}();
|
}();
|
||||||
|
|
|
@ -130,6 +130,7 @@ private:
|
||||||
const not_null<Window::SessionController*> _controller;
|
const not_null<Window::SessionController*> _controller;
|
||||||
ActiveChat _activeChat;
|
ActiveChat _activeChat;
|
||||||
QString _customTitleText;
|
QString _customTitleText;
|
||||||
|
rpl::lifetime _activeChatLifetime;
|
||||||
|
|
||||||
int _selectedCount = 0;
|
int _selectedCount = 0;
|
||||||
bool _canDelete = false;
|
bool _canDelete = false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue