mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Allow remove raised hand from context menu.
This commit is contained in:
parent
d624e2ef65
commit
7430fbacfd
3 changed files with 34 additions and 8 deletions
|
@ -1974,6 +1974,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_group_call_too_many" = "Sorry, there are too many members in this voice chat. Please try again later.";
|
"lng_group_call_too_many" = "Sorry, there are too many members in this voice chat. Please try again later.";
|
||||||
"lng_group_call_context_mute" = "Mute";
|
"lng_group_call_context_mute" = "Mute";
|
||||||
"lng_group_call_context_unmute" = "Allow to speak";
|
"lng_group_call_context_unmute" = "Allow to speak";
|
||||||
|
"lng_group_call_context_remove_hand" = "Cancel request to speak";
|
||||||
"lng_group_call_context_mute_for_me" = "Mute for me";
|
"lng_group_call_context_mute_for_me" = "Mute for me";
|
||||||
"lng_group_call_context_unmute_for_me" = "Unmute for me";
|
"lng_group_call_context_unmute_for_me" = "Unmute for me";
|
||||||
"lng_group_call_duration_days#one" = "{count} day";
|
"lng_group_call_duration_days#one" = "{count} day";
|
||||||
|
|
|
@ -492,6 +492,15 @@ void GroupCall::rejoin(not_null<PeerData*> as) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] uint64 FindLocalRaisedHandRating(
|
||||||
|
const std::vector<Data::GroupCallParticipant> &list) {
|
||||||
|
const auto i = ranges::max_element(
|
||||||
|
list,
|
||||||
|
ranges::less(),
|
||||||
|
&Data::GroupCallParticipant::raisedHandRating);
|
||||||
|
return (i == end(list)) ? 1 : (i->raisedHandRating + 1);
|
||||||
|
}
|
||||||
|
|
||||||
void GroupCall::applyMeInCallLocally() {
|
void GroupCall::applyMeInCallLocally() {
|
||||||
const auto call = _peer->groupCall();
|
const auto call = _peer->groupCall();
|
||||||
if (!call || call->id() != _id) {
|
if (!call || call->id() != _id) {
|
||||||
|
@ -514,9 +523,11 @@ void GroupCall::applyMeInCallLocally() {
|
||||||
: Group::kDefaultVolume;
|
: Group::kDefaultVolume;
|
||||||
const auto canSelfUnmute = (muted() != MuteState::ForceMuted)
|
const auto canSelfUnmute = (muted() != MuteState::ForceMuted)
|
||||||
&& (muted() != MuteState::RaisedHand);
|
&& (muted() != MuteState::RaisedHand);
|
||||||
const auto raisedHandRating = (i != end(participants))
|
const auto raisedHandRating = (muted() != MuteState::RaisedHand)
|
||||||
|
? uint64(0)
|
||||||
|
: (i != end(participants))
|
||||||
? i->raisedHandRating
|
? i->raisedHandRating
|
||||||
: uint64(0);
|
: FindLocalRaisedHandRating(participants);
|
||||||
const auto flags = (canSelfUnmute ? Flag::f_can_self_unmute : Flag(0))
|
const auto flags = (canSelfUnmute ? Flag::f_can_self_unmute : Flag(0))
|
||||||
| (lastActive ? Flag::f_active_date : Flag(0))
|
| (lastActive ? Flag::f_active_date : Flag(0))
|
||||||
| (_mySsrc ? Flag(0) : Flag::f_left)
|
| (_mySsrc ? Flag(0) : Flag::f_left)
|
||||||
|
|
|
@ -1479,10 +1479,7 @@ base::unique_qptr<Ui::PopupMenu> MembersController::createRowContextMenu(
|
||||||
not_null<PeerListRow*> row) {
|
not_null<PeerListRow*> row) {
|
||||||
const auto participantPeer = row->peer();
|
const auto participantPeer = row->peer();
|
||||||
const auto real = static_cast<Row*>(row.get());
|
const auto real = static_cast<Row*>(row.get());
|
||||||
if (isMe(participantPeer)
|
|
||||||
&& (!_peer->canManageGroupCall() || !real->ssrc())) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
auto result = base::make_unique_q<Ui::PopupMenu>(
|
auto result = base::make_unique_q<Ui::PopupMenu>(
|
||||||
parent,
|
parent,
|
||||||
st::groupCallPopupMenu);
|
st::groupCallPopupMenu);
|
||||||
|
@ -1538,11 +1535,25 @@ base::unique_qptr<Ui::PopupMenu> MembersController::createRowContextMenu(
|
||||||
_kickParticipantRequests.fire_copy(participantPeer);
|
_kickParticipantRequests.fire_copy(participantPeer);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (real->ssrc() != 0) {
|
if (real->ssrc() != 0
|
||||||
|
&& (!isMe(participantPeer) || _peer->canManageGroupCall())) {
|
||||||
addMuteActionsToContextMenu(result, participantPeer, admin, real);
|
addMuteActionsToContextMenu(result, participantPeer, admin, real);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isMe(participantPeer)) {
|
if (isMe(participantPeer)) {
|
||||||
|
if (const auto strong = _call.get()
|
||||||
|
; strong && strong->muted() == MuteState::RaisedHand) {
|
||||||
|
const auto removeHand = [=] {
|
||||||
|
if (const auto strong = _call.get()
|
||||||
|
; strong && strong->muted() == MuteState::RaisedHand) {
|
||||||
|
strong->setMutedAndUpdate(MuteState::ForceMuted);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
result->addAction(
|
||||||
|
tr::lng_group_call_context_remove_hand(tr::now),
|
||||||
|
removeHand);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
result->addAction(
|
result->addAction(
|
||||||
tr::lng_context_view_profile(tr::now),
|
tr::lng_context_view_profile(tr::now),
|
||||||
showProfile);
|
showProfile);
|
||||||
|
@ -1575,6 +1586,9 @@ base::unique_qptr<Ui::PopupMenu> MembersController::createRowContextMenu(
|
||||||
removeFromGroup);
|
removeFromGroup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (result->empty()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue