Hide call panel when starting hanging up.

This commit is contained in:
John Preston 2020-12-08 16:03:59 +04:00
parent 33fc3fe354
commit 529c12ea3a
2 changed files with 21 additions and 1 deletions

View File

@ -353,6 +353,16 @@ void GroupPanel::initWithCall(GroupCall *call) {
_channel = _call->channel();
call->stateValue(
) | rpl::filter([](State state) {
return (state == State::HangingUp)
|| (state == State::Ended)
|| (state == State::FailedHangingUp)
|| (state == State::Failed);
}) | rpl::start_with_next([=] {
closeBeforeDestroy();
}, _callLifetime);
call->levelUpdates(
) | rpl::filter([=](const LevelUpdate &update) {
return update.self;

View File

@ -196,6 +196,9 @@ void Instance::destroyGroupCall(not_null<GroupCall*> call) {
void Instance::createGroupCall(
not_null<ChannelData*> channel,
const MTPInputGroupCall &inputCall) {
if (_currentGroupCall) {
destroyGroupCall(_currentGroupCall.get());
}
auto call = std::make_unique<GroupCall>(
getGroupCallDelegate(),
channel,
@ -433,7 +436,14 @@ bool Instance::inCall() const {
}
bool Instance::inGroupCall() const {
return (_currentGroupCall != nullptr);
if (!_currentGroupCall) {
return false;
}
const auto state = _currentGroupCall->state();
return (state != GroupCall::State::HangingUp)
&& (state != GroupCall::State::Ended)
&& (state != GroupCall::State::FailedHangingUp)
&& (state != GroupCall::State::Failed);
}
bool Instance::activateCurrentCall() {