Added display of toast with potential human-readable errors from server.

This commit is contained in:
23rd 2023-08-24 20:40:58 +03:00 committed by John Preston
parent c9a976bf87
commit d9f397ea3f
2 changed files with 6 additions and 0 deletions

View File

@ -85,6 +85,7 @@ struct StatisticalChart {
struct StatisticalGraph final {
StatisticalChart chart;
QString zoomToken;
QString error;
};
struct StatisticalValue final {

View File

@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lang/lang_keys.h"
#include "main/main_session.h"
#include "statistics/chart_widget.h"
#include "ui/toast/toast.h"
#include "ui/layers/generic_box.h"
namespace {
@ -37,6 +38,10 @@ void StatisticsBox(not_null<Ui::GenericBox*> box, not_null<PeerData*> peer) {
const Data::StatisticalGraph &graph) {
if (graph.chart) {
widget->setZoomedChartData(graph.chart);
} else if (!graph.error.isEmpty()) {
Ui::Toast::Show(
box->uiShow()->toastParent(),
graph.error);
}
}, [=](const QString &error) {
}, [=] {