Run main menu hide animation on account switch.

This commit is contained in:
John Preston 2020-06-29 16:11:34 +04:00
parent 1757dd856b
commit 5f9dae1b72
3 changed files with 16 additions and 6 deletions

View File

@ -196,7 +196,6 @@ void MainWindow::finishFirstShow() {
}
void MainWindow::clearWidgetsHook() {
destroyLayer();
_mediaPreview.destroy();
_main.destroy();
_intro.destroy();
@ -284,10 +283,17 @@ void MainWindow::setupIntro(Intro::EnterPoint point) {
void MainWindow::setupMain() {
Expects(account().sessionExists());
auto animated = (_intro || _passcodeLock);
auto bg = animated ? grabInner() : QPixmap();
destroyLayer();
const auto animated = (_intro || _passcodeLock);
const auto bg = animated ? grabInner() : QPixmap();
const auto weak = (_main && _layer)
? Ui::MakeWeak(_layer.get())
: nullptr;
if (weak) {
Assert(!animated);
_layer->hideAllAnimatedPrepare();
} else {
destroyLayer();
}
auto created = object_ptr<MainWidget>(bodyWidget(), sessionController());
clearWidgets();
_main = std::move(created);
@ -304,6 +310,9 @@ void MainWindow::setupMain() {
Core::App().checkStartUrl();
}
fixOrder();
if (const auto strong = weak.data()) {
strong->hideAllAnimatedRun();
}
}
void MainWindow::showSettings() {

View File

@ -45,6 +45,7 @@ Controller::Controller()
Controller::~Controller() {
// We want to delete all widgets before the _sessionController.
_widget.ui_hideSettingsAndLayer(anim::type::instant);
_widget.clearWidgets();
}

@ -1 +1 @@
Subproject commit 2a0d189ee22d8573bd4f9f0971ef1aa27a12f02d
Subproject commit d6e7aa6f63febb6f7fd6e0a80a469fb86dc17e6e