mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added process of server notification for disabled withdrawal feature.
This commit is contained in:
parent
29b7673b88
commit
4f7b5ca7da
3 changed files with 26 additions and 3 deletions
|
@ -2121,6 +2121,8 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
||||||
};
|
};
|
||||||
if (IsForceLogoutNotification(d)) {
|
if (IsForceLogoutNotification(d)) {
|
||||||
Core::App().forceLogOut(&session().account(), text);
|
Core::App().forceLogOut(&session().account(), text);
|
||||||
|
} else if (IsWithdrawalNotification(d)) {
|
||||||
|
return;
|
||||||
} else if (d.is_popup()) {
|
} else if (d.is_popup()) {
|
||||||
const auto &windows = session().windows();
|
const auto &windows = session().windows();
|
||||||
if (!windows.empty()) {
|
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
|
} // namespace Api
|
||||||
|
|
|
@ -211,4 +211,7 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[[nodiscard]] bool IsWithdrawalNotification(
|
||||||
|
const MTPDupdateServiceNotification &);
|
||||||
|
|
||||||
} // namespace Api
|
} // namespace Api
|
||||||
|
|
|
@ -11,6 +11,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "api/api_earn.h"
|
#include "api/api_earn.h"
|
||||||
#include "api/api_filter_updates.h"
|
#include "api/api_filter_updates.h"
|
||||||
#include "api/api_statistics.h"
|
#include "api/api_statistics.h"
|
||||||
|
#include "api/api_text_entities.h"
|
||||||
|
#include "api/api_updates.h"
|
||||||
#include "base/unixtime.h"
|
#include "base/unixtime.h"
|
||||||
#include "boxes/peers/edit_peer_color_box.h" // AddLevelBadge.
|
#include "boxes/peers/edit_peer_color_box.h" // AddLevelBadge.
|
||||||
#include "chat_helpers/stickers_emoji_pack.h"
|
#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 "statistics/chart_widget.h"
|
||||||
#include "ui/basic_click_handlers.h"
|
#include "ui/basic_click_handlers.h"
|
||||||
#include "ui/boxes/boost_box.h"
|
#include "ui/boxes/boost_box.h"
|
||||||
|
#include "ui/boxes/confirm_box.h"
|
||||||
#include "ui/controls/userpic_button.h"
|
#include "ui/controls/userpic_button.h"
|
||||||
#include "ui/effects/animation_value_f.h"
|
#include "ui/effects/animation_value_f.h"
|
||||||
#include "ui/effects/credits_graphics.h"
|
#include "ui/effects/credits_graphics.h"
|
||||||
|
@ -288,9 +291,8 @@ void InnerWidget::load() {
|
||||||
_loaded.events_starting_with(false) | rpl::map(!rpl::mappers::_1),
|
_loaded.events_starting_with(false) | rpl::map(!rpl::mappers::_1),
|
||||||
_showFinished.events());
|
_showFinished.events());
|
||||||
|
|
||||||
const auto fail = [show = _controller->uiShow()](const QString &error) {
|
const auto show = _controller->uiShow();
|
||||||
show->showToast(error);
|
const auto fail = [=](const QString &error) { show->showToast(error); };
|
||||||
};
|
|
||||||
|
|
||||||
const auto finish = [=] {
|
const auto finish = [=] {
|
||||||
_loaded.fire(true);
|
_loaded.fire(true);
|
||||||
|
@ -303,6 +305,7 @@ void InnerWidget::load() {
|
||||||
const MTPUpdates &updates) {
|
const MTPUpdates &updates) {
|
||||||
using TLCreditsUpdate = MTPDupdateStarsRevenueStatus;
|
using TLCreditsUpdate = MTPDupdateStarsRevenueStatus;
|
||||||
using TLCurrencyUpdate = MTPDupdateBroadcastRevenueTransactions;
|
using TLCurrencyUpdate = MTPDupdateBroadcastRevenueTransactions;
|
||||||
|
using TLNotificationUpdate = MTPDupdateServiceNotification;
|
||||||
Api::PerformForUpdate<TLCreditsUpdate>(updates, [&](
|
Api::PerformForUpdate<TLCreditsUpdate>(updates, [&](
|
||||||
const TLCreditsUpdate &d) {
|
const TLCreditsUpdate &d) {
|
||||||
if (peerId == peerFromMTP(d.vpeer())) {
|
if (peerId == peerFromMTP(d.vpeer())) {
|
||||||
|
@ -325,6 +328,17 @@ void InnerWidget::load() {
|
||||||
_stateUpdated.fire({});
|
_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());
|
}, lifetime());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue