2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Try to hangup current call when quitting the app.

This commit is contained in:
John Preston
2017-04-29 23:06:32 +03:00
parent 29fc69ebaa
commit e050e270fc
8 changed files with 92 additions and 32 deletions

View File

@@ -21,6 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "calls/calls_instance.h"
#include "mtproto/connection.h"
#include "messenger.h"
#include "auth_session.h"
#include "apiwrap.h"
#include "lang.h"
@@ -70,6 +71,11 @@ void Instance::destroyCall(gsl::not_null<Call*> call) {
_currentCallPanel.reset();
_currentCall.reset();
_currentCallChanged.notify(nullptr, true);
if (App::quitting()) {
LOG(("Calls::Instance doesn't prevent quit any more."));
}
Messenger::Instance().quitPreventFinished();
}
}
@@ -201,6 +207,18 @@ void Instance::showInfoPanel(gsl::not_null<Call*> call) {
}
}
bool Instance::isQuitPrevent() {
if (!_currentCall) {
return false;
}
_currentCall->hangup();
if (!_currentCall) {
return false;
}
LOG(("Calls::Instance prevents quit, saving drafts..."));
return true;
}
void Instance::handleCallUpdate(const MTPPhoneCall &call) {
if (call.type() == mtpc_phoneCallRequested) {
auto &phoneCall = call.c_phoneCallRequested();