Respect conference_supported flag.

This commit is contained in:
John Preston 2025-04-04 16:15:33 +05:00
parent a5fa595627
commit fbbcbc8753
5 changed files with 26 additions and 8 deletions

View file

@ -24,8 +24,8 @@ CallSignalBars {
inactiveOpacity: double; inactiveOpacity: double;
} }
callWidthMin: 372px; callWidthMin: 380px;
callHeightMin: 440px; callHeightMin: 520px;
callWidth: 720px; callWidth: 720px;
callHeight: 540px; callHeight: 540px;
@ -532,7 +532,7 @@ callErrorToast: Toast(defaultToast) {
} }
groupCallWidth: 380px; groupCallWidth: 380px;
groupCallHeight: 580px; groupCallHeight: 520px;
groupCallWidthRtmp: 720px; groupCallWidthRtmp: 720px;
groupCallWidthRtmpMin: 240px; groupCallWidthRtmpMin: 240px;
groupCallHeightRtmp: 580px; groupCallHeightRtmp: 580px;

View file

@ -1033,6 +1033,8 @@ void Call::createAndStartController(const MTPDphoneCall &call) {
return; return;
} }
_conferenceSupported = call.is_conference_supported();
const auto &protocol = call.vprotocol().c_phoneCallProtocol(); const auto &protocol = call.vprotocol().c_phoneCallProtocol();
const auto &serverConfig = _user->session().serverConfig(); const auto &serverConfig = _user->session().serverConfig();

View file

@ -170,6 +170,10 @@ public:
return _errors.events(); return _errors.events();
} }
[[nodiscard]] rpl::producer<bool> confereceSupportedValue() const {
return _conferenceSupported.value();
}
enum class RemoteAudioState { enum class RemoteAudioState {
Muted, Muted,
Active, Active,
@ -322,6 +326,7 @@ private:
MTP::Sender _api; MTP::Sender _api;
Type _type = Type::Outgoing; Type _type = Type::Outgoing;
rpl::variable<State> _state = State::Starting; rpl::variable<State> _state = State::Starting;
rpl::variable<bool> _conferenceSupported = false;
rpl::variable<RemoteAudioState> _remoteAudioState rpl::variable<RemoteAudioState> _remoteAudioState
= RemoteAudioState::Active; = RemoteAudioState::Active;
rpl::variable<Webrtc::VideoState> _remoteVideoState; rpl::variable<Webrtc::VideoState> _remoteVideoState;

View file

@ -690,6 +690,16 @@ void Panel::reinitWithCall(Call *call) {
_user = _call->user(); _user = _call->user();
_call->confereceSupportedValue(
) | rpl::start_with_next([=](bool supported) {
_conferenceSupported = supported;
_addPeople->toggle(_conferenceSupported
&& (_call->state() != State::WaitingUserConfirmation),
window()->isHidden() ? anim::type::instant : anim::type::normal);
updateHangupGeometry();
}, _callLifetime);
auto remoteMuted = _call->remoteAudioStateValue( auto remoteMuted = _call->remoteAudioStateValue(
) | rpl::map(rpl::mappers::_1 == Call::RemoteAudioState::Muted); ) | rpl::map(rpl::mappers::_1 == Call::RemoteAudioState::Muted);
rpl::duplicate( rpl::duplicate(
@ -1321,7 +1331,8 @@ void Panel::updateHangupGeometry() {
const auto buttonWidth = st::callCancel.button.width; const auto buttonWidth = st::callCancel.button.width;
const auto cancelWidth = buttonWidth * (1. - hangupProgress); const auto cancelWidth = buttonWidth * (1. - hangupProgress);
const auto cancelLeft = (widget()->width() - buttonWidth) / 2 const auto cancelLeft = (widget()->width() - buttonWidth) / 2
- ((isBusy || incomingWaiting) ? buttonWidth : 0); - ((isBusy || incomingWaiting) ? buttonWidth : 0)
+ ((isWaitingUser || _conferenceSupported) ? 0 : (buttonWidth / 2));
_cancel->moveToLeft(cancelLeft, _buttonsTop); _cancel->moveToLeft(cancelLeft, _buttonsTop);
_decline->moveToLeft(cancelLeft, _buttonsTop); _decline->moveToLeft(cancelLeft, _buttonsTop);
@ -1413,12 +1424,11 @@ void Panel::stateChanged(State state) {
} }
_camera->setVisible(!_startVideo); _camera->setVisible(!_startVideo);
const auto windowHidden = window()->isHidden();
const auto toggleButton = [&](auto &&button, bool visible) { const auto toggleButton = [&](auto &&button, bool visible) {
button->toggle( button->toggle(
visible, visible,
window()->isHidden() (windowHidden ? anim::type::instant : anim::type::normal));
? anim::type::instant
: anim::type::normal);
}; };
const auto incomingWaiting = _call->isIncomingWaiting(); const auto incomingWaiting = _call->isIncomingWaiting();
if (incomingWaiting) { if (incomingWaiting) {
@ -1430,7 +1440,7 @@ void Panel::stateChanged(State state) {
toggleButton( toggleButton(
_screencast, _screencast,
!(isBusy || isWaitingUser || incomingWaiting)); !(isBusy || isWaitingUser || incomingWaiting));
toggleButton(_addPeople, !isWaitingUser); toggleButton(_addPeople, !isWaitingUser && _conferenceSupported);
const auto hangupShown = !_decline->toggled() const auto hangupShown = !_decline->toggled()
&& !_cancel->toggled(); && !_cancel->toggled();
if (_hangupShown != hangupShown) { if (_hangupShown != hangupShown) {

View file

@ -200,6 +200,7 @@ private:
object_ptr<Ui::FadeWrap<Ui::CallButton>> _decline; object_ptr<Ui::FadeWrap<Ui::CallButton>> _decline;
object_ptr<Ui::FadeWrap<Ui::CallButton>> _cancel; object_ptr<Ui::FadeWrap<Ui::CallButton>> _cancel;
bool _hangupShown = false; bool _hangupShown = false;
bool _conferenceSupported = false;
bool _outgoingPreviewInBody = false; bool _outgoingPreviewInBody = false;
std::optional<AnswerHangupRedialState> _answerHangupRedialState; std::optional<AnswerHangupRedialState> _answerHangupRedialState;
Ui::Animations::Simple _hangupShownProgress; Ui::Animations::Simple _hangupShownProgress;