mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-25 01:50:36 +00:00
Added process of server notification for disabled withdrawal feature.
This commit is contained in:
parent
29b7673b88
commit
4f7b5ca7da
@ -2121,6 +2121,8 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
||||
};
|
||||
if (IsForceLogoutNotification(d)) {
|
||||
Core::App().forceLogOut(&session().account(), text);
|
||||
} else if (IsWithdrawalNotification(d)) {
|
||||
return;
|
||||
} else if (d.is_popup()) {
|
||||
const auto &windows = session().windows();
|
||||
if (!windows.empty()) {
|
||||
@ -2622,4 +2624,8 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
||||
}
|
||||
}
|
||||
|
||||
bool IsWithdrawalNotification(const MTPDupdateServiceNotification &data) {
|
||||
return qs(data.vtype()).startsWith(u"API_WITHDRAWAL_FEATURE_DISABLED_"_q);
|
||||
}
|
||||
|
||||
} // namespace Api
|
||||
|
@ -211,4 +211,7 @@ private:
|
||||
|
||||
};
|
||||
|
||||
[[nodiscard]] bool IsWithdrawalNotification(
|
||||
const MTPDupdateServiceNotification &);
|
||||
|
||||
} // namespace Api
|
||||
|
@ -11,6 +11,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "api/api_earn.h"
|
||||
#include "api/api_filter_updates.h"
|
||||
#include "api/api_statistics.h"
|
||||
#include "api/api_text_entities.h"
|
||||
#include "api/api_updates.h"
|
||||
#include "base/unixtime.h"
|
||||
#include "boxes/peers/edit_peer_color_box.h" // AddLevelBadge.
|
||||
#include "chat_helpers/stickers_emoji_pack.h"
|
||||
@ -36,6 +38,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "statistics/chart_widget.h"
|
||||
#include "ui/basic_click_handlers.h"
|
||||
#include "ui/boxes/boost_box.h"
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
#include "ui/controls/userpic_button.h"
|
||||
#include "ui/effects/animation_value_f.h"
|
||||
#include "ui/effects/credits_graphics.h"
|
||||
@ -288,9 +291,8 @@ void InnerWidget::load() {
|
||||
_loaded.events_starting_with(false) | rpl::map(!rpl::mappers::_1),
|
||||
_showFinished.events());
|
||||
|
||||
const auto fail = [show = _controller->uiShow()](const QString &error) {
|
||||
show->showToast(error);
|
||||
};
|
||||
const auto show = _controller->uiShow();
|
||||
const auto fail = [=](const QString &error) { show->showToast(error); };
|
||||
|
||||
const auto finish = [=] {
|
||||
_loaded.fire(true);
|
||||
@ -303,6 +305,7 @@ void InnerWidget::load() {
|
||||
const MTPUpdates &updates) {
|
||||
using TLCreditsUpdate = MTPDupdateStarsRevenueStatus;
|
||||
using TLCurrencyUpdate = MTPDupdateBroadcastRevenueTransactions;
|
||||
using TLNotificationUpdate = MTPDupdateServiceNotification;
|
||||
Api::PerformForUpdate<TLCreditsUpdate>(updates, [&](
|
||||
const TLCreditsUpdate &d) {
|
||||
if (peerId == peerFromMTP(d.vpeer())) {
|
||||
@ -325,6 +328,17 @@ void InnerWidget::load() {
|
||||
_stateUpdated.fire({});
|
||||
}
|
||||
});
|
||||
Api::PerformForUpdate<TLNotificationUpdate>(updates, [&](
|
||||
const TLNotificationUpdate &d) {
|
||||
if (Api::IsWithdrawalNotification(d) && d.is_popup()) {
|
||||
show->show(Ui::MakeInformBox(TextWithEntities{
|
||||
qs(d.vmessage()),
|
||||
Api::EntitiesFromMTP(&
|
||||
_peer->session(),
|
||||
d.ventities().v),
|
||||
}));
|
||||
}
|
||||
});
|
||||
}, lifetime());
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user