mirror of https://github.com/procxx/kepka.git
Skip call ended sound if ended from other device.
This commit is contained in:
parent
9dfd7f4ba9
commit
843f983051
|
@ -364,8 +364,10 @@ bool Call::handleUpdate(const MTPPhoneCall &call) {
|
||||||
}
|
}
|
||||||
if (data.has_reason() && data.vreason.type() == mtpc_phoneCallDiscardReasonBusy) {
|
if (data.has_reason() && data.vreason.type() == mtpc_phoneCallDiscardReasonBusy) {
|
||||||
setState(State::Busy);
|
setState(State::Busy);
|
||||||
} else {
|
} else if (_type == Type::Outgoing || _state == State::HangingUp) {
|
||||||
setState(State::Ended);
|
setState(State::Ended);
|
||||||
|
} else {
|
||||||
|
setState(State::EndedByOtherDevice);
|
||||||
}
|
}
|
||||||
} return true;
|
} return true;
|
||||||
|
|
||||||
|
@ -579,6 +581,7 @@ void Call::setState(State state) {
|
||||||
}
|
}
|
||||||
if (false
|
if (false
|
||||||
|| _state == State::Ended
|
|| _state == State::Ended
|
||||||
|
|| _state == State::EndedByOtherDevice
|
||||||
|| _state == State::Failed
|
|| _state == State::Failed
|
||||||
|| _state == State::Busy) {
|
|| _state == State::Busy) {
|
||||||
// Destroy controller before destroying Call Panel,
|
// Destroy controller before destroying Call Panel,
|
||||||
|
@ -594,6 +597,8 @@ void Call::setState(State state) {
|
||||||
break;
|
break;
|
||||||
case State::Ended:
|
case State::Ended:
|
||||||
_delegate->playSound(Delegate::Sound::Ended);
|
_delegate->playSound(Delegate::Sound::Ended);
|
||||||
|
// fallthrough
|
||||||
|
case State::EndedByOtherDevice:
|
||||||
_delegate->callFinished(this);
|
_delegate->callFinished(this);
|
||||||
break;
|
break;
|
||||||
case State::Failed:
|
case State::Failed:
|
||||||
|
@ -618,6 +623,7 @@ void Call::finish(FinishType type, const MTPPhoneCallDiscardReason &reason) {
|
||||||
}
|
}
|
||||||
if (_state == State::HangingUp
|
if (_state == State::HangingUp
|
||||||
|| _state == State::FailedHangingUp
|
|| _state == State::FailedHangingUp
|
||||||
|
|| _state == State::EndedByOtherDevice
|
||||||
|| _state == State::Ended
|
|| _state == State::Ended
|
||||||
|| _state == State::Failed) {
|
|| _state == State::Failed) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -91,6 +91,7 @@ public:
|
||||||
Failed,
|
Failed,
|
||||||
HangingUp,
|
HangingUp,
|
||||||
Ended,
|
Ended,
|
||||||
|
EndedByOtherDevice,
|
||||||
ExchangingKeys,
|
ExchangingKeys,
|
||||||
Waiting,
|
Waiting,
|
||||||
Requesting,
|
Requesting,
|
||||||
|
|
|
@ -710,6 +710,7 @@ void Panel::stateChanged(State state) {
|
||||||
if (_call) {
|
if (_call) {
|
||||||
if ((state != State::HangingUp)
|
if ((state != State::HangingUp)
|
||||||
&& (state != State::Ended)
|
&& (state != State::Ended)
|
||||||
|
&& (state != State::EndedByOtherDevice)
|
||||||
&& (state != State::FailedHangingUp)
|
&& (state != State::FailedHangingUp)
|
||||||
&& (state != State::Failed)) {
|
&& (state != State::Failed)) {
|
||||||
auto toggleButton = [this](auto &&button, bool visible) {
|
auto toggleButton = [this](auto &&button, bool visible) {
|
||||||
|
@ -785,7 +786,8 @@ void Panel::updateStatusText(State state) {
|
||||||
case State::FailedHangingUp:
|
case State::FailedHangingUp:
|
||||||
case State::Failed: return lang(lng_call_status_failed);
|
case State::Failed: return lang(lng_call_status_failed);
|
||||||
case State::HangingUp: return lang(lng_call_status_hanging);
|
case State::HangingUp: return lang(lng_call_status_hanging);
|
||||||
case State::Ended: return lang(lng_call_status_ended);
|
case State::Ended:
|
||||||
|
case State::EndedByOtherDevice: return lang(lng_call_status_ended);
|
||||||
case State::ExchangingKeys: return lang(lng_call_status_exchanging);
|
case State::ExchangingKeys: return lang(lng_call_status_exchanging);
|
||||||
case State::Waiting: return lang(lng_call_status_waiting);
|
case State::Waiting: return lang(lng_call_status_waiting);
|
||||||
case State::Requesting: return lang(lng_call_status_requesting);
|
case State::Requesting: return lang(lng_call_status_requesting);
|
||||||
|
|
Loading…
Reference in New Issue