2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Show reload toast inside Support::Templates.

This commit is contained in:
John Preston
2018-11-16 09:51:47 +04:00
parent 123523ef62
commit d6b4448d3c
3 changed files with 29 additions and 23 deletions

View File

@@ -11,7 +11,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/buttons.h"
#include "ui/widgets/labels.h"
#include "ui/widgets/menu.h"
#include "ui/toast/toast.h"
#include "ui/special_buttons.h"
#include "ui/empty_userpic.h"
#include "mainwindow.h"
@@ -212,14 +211,7 @@ void MainMenu::refreshMenu() {
(*fix)->setCheckable(true);
(*fix)->setChecked(Auth().settings().supportFixChatsOrder());
const auto subscription = Ui::AttachAsChild(_menu, rpl::lifetime());
_menu->addAction(qsl("Reload templates"), [=] {
*subscription = Auth().supportTemplates().errors(
) | rpl::start_with_next([=](QStringList errors) {
Ui::Toast::Show(errors.isEmpty()
? "Templates reloaded!"
: ("Errors:\n\n" + errors.join("\n\n")));
});
Auth().supportTemplates().reload();
}, &st::mainMenuReload, &st::mainMenuReloadOver);
}