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

Move call management to Core::App.

This commit is contained in:
John Preston
2020-06-25 21:57:36 +04:00
parent 8c4d3a86e7
commit 79a361ba43
23 changed files with 204 additions and 167 deletions

View File

@@ -245,9 +245,13 @@ MainWidget::MainWidget(
connect(_dialogs, SIGNAL(cancelled()), this, SLOT(dialogsCancelled()));
connect(_history, &HistoryWidget::cancelled, [=] { handleHistoryBack(); });
subscribe(session().calls().currentCallChanged(), [=](Calls::Call *call) {
Core::App().calls().currentCallValue(
) | rpl::start_with_next([=](Calls::Call *call) {
setCurrentCall(call);
});
}, lifetime());
if (_callTopBar) {
_callTopBar->finishAnimating();
}
Core::App().setDefaultFloatPlayerDelegate(floatPlayerDelegate());
Core::App().floatPlayerClosed(
@@ -943,16 +947,18 @@ void MainWidget::playerHeightUpdated() {
}
void MainWidget::setCurrentCall(Calls::Call *call) {
_currentCallLifetime.destroy();
_currentCall = call;
if (_currentCall) {
subscribe(_currentCall->stateChanged(), [this](Calls::Call::State state) {
_currentCall->stateValue(
) | rpl::start_with_next([=](Calls::Call::State state) {
using State = Calls::Call::State;
if (state == State::Established) {
createCallTopBar();
} else {
destroyCallTopBar();
}
});
}, _currentCallLifetime);
} else {
destroyCallTopBar();
}
@@ -2036,6 +2042,10 @@ void MainWidget::hideAll() {
_player->setVisible(false);
_playerHeight = 0;
}
if (_callTopBar) {
_callTopBar->setVisible(false);
_callTopBarHeight = 0;
}
}
void MainWidget::showAll() {
@@ -2091,6 +2101,10 @@ void MainWidget::showAll() {
_player->setVisible(true);
_playerHeight = _player->contentHeight();
}
if (_callTopBar) {
_callTopBar->setVisible(true);
_callTopBarHeight = _callTopBar->height();
}
updateControlsGeometry();
floatPlayerCheckVisibility();