mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 23:53:58 +02:00
Added handler of state changes of other participants in group calls.
This commit is contained in:
parent
e1f5e10764
commit
e12689c8c1
3 changed files with 33 additions and 0 deletions
|
@ -589,10 +589,25 @@ void GroupCall::handleUpdate(const MTPDupdateGroupCallParticipants &data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto handleOtherParticipants = [=](
|
||||||
|
const MTPDgroupCallParticipant &data) {
|
||||||
|
const auto user = _peer->owner().user(data.vuser_id().v);
|
||||||
|
const auto participant = LookupParticipant(_peer, _id, user);
|
||||||
|
if (!participant) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_otherParticipantStateValue.fire(Group::ParticipantState{
|
||||||
|
.user = user,
|
||||||
|
.mutedByMe = data.is_muted_by_you(),
|
||||||
|
.volume = data.vvolume().value_or_empty(),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const auto self = _peer->session().userId();
|
const auto self = _peer->session().userId();
|
||||||
for (const auto &participant : data.vparticipants().v) {
|
for (const auto &participant : data.vparticipants().v) {
|
||||||
participant.match([&](const MTPDgroupCallParticipant &data) {
|
participant.match([&](const MTPDgroupCallParticipant &data) {
|
||||||
if (data.vuser_id().v != self) {
|
if (data.vuser_id().v != self) {
|
||||||
|
handleOtherParticipants(data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (data.is_left() && data.vsource().v == _mySsrc) {
|
if (data.is_left() && data.vsource().v == _mySsrc) {
|
||||||
|
@ -1030,6 +1045,11 @@ void GroupCall::pushToTalkCancel() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto GroupCall::otherParticipantStateValue() const
|
||||||
|
-> rpl::producer<Group::ParticipantState> {
|
||||||
|
return _otherParticipantStateValue.events();
|
||||||
|
}
|
||||||
|
|
||||||
//void GroupCall::setAudioVolume(bool input, float level) {
|
//void GroupCall::setAudioVolume(bool input, float level) {
|
||||||
// if (_instance) {
|
// if (_instance) {
|
||||||
// if (input) {
|
// if (input) {
|
||||||
|
|
|
@ -38,6 +38,7 @@ namespace Calls {
|
||||||
namespace Group {
|
namespace Group {
|
||||||
struct MuteRequest;
|
struct MuteRequest;
|
||||||
struct VolumeRequest;
|
struct VolumeRequest;
|
||||||
|
struct ParticipantState;
|
||||||
} // namespace Group
|
} // namespace Group
|
||||||
|
|
||||||
enum class MuteState {
|
enum class MuteState {
|
||||||
|
@ -109,6 +110,9 @@ public:
|
||||||
return _muted.value();
|
return _muted.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto otherParticipantStateValue() const
|
||||||
|
-> rpl::producer<Group::ParticipantState>;
|
||||||
|
|
||||||
enum State {
|
enum State {
|
||||||
Creating,
|
Creating,
|
||||||
Joining,
|
Joining,
|
||||||
|
@ -206,6 +210,8 @@ private:
|
||||||
rpl::variable<MuteState> _muted = MuteState::Muted;
|
rpl::variable<MuteState> _muted = MuteState::Muted;
|
||||||
bool _acceptFields = false;
|
bool _acceptFields = false;
|
||||||
|
|
||||||
|
rpl::event_stream<Group::ParticipantState> _otherParticipantStateValue;
|
||||||
|
|
||||||
uint64 _id = 0;
|
uint64 _id = 0;
|
||||||
uint64 _accessHash = 0;
|
uint64 _accessHash = 0;
|
||||||
uint32 _mySsrc = 0;
|
uint32 _mySsrc = 0;
|
||||||
|
|
|
@ -26,4 +26,11 @@ struct VolumeRequest {
|
||||||
bool locallyOnly = false;
|
bool locallyOnly = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ParticipantState {
|
||||||
|
not_null<UserData*> user;
|
||||||
|
std::optional<int> volume;
|
||||||
|
bool mutedByMe = false;
|
||||||
|
bool locallyOnly = false;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace Calls::Group
|
} // namespace Calls::Group
|
||||||
|
|
Loading…
Add table
Reference in a new issue