mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +02:00
Remove MTP from requestDeepLinkInfo interface.
This commit is contained in:
parent
ab3d3a449b
commit
566128c3eb
3 changed files with 15 additions and 13 deletions
|
@ -293,14 +293,20 @@ void ApiWrap::topPromotionDone(const MTPhelp_PromoData &proxy) {
|
||||||
|
|
||||||
void ApiWrap::requestDeepLinkInfo(
|
void ApiWrap::requestDeepLinkInfo(
|
||||||
const QString &path,
|
const QString &path,
|
||||||
Fn<void(const MTPDhelp_deepLinkInfo &result)> callback) {
|
Fn<void(TextWithEntities message, bool updateRequired)> callback) {
|
||||||
request(_deepLinkInfoRequestId).cancel();
|
request(_deepLinkInfoRequestId).cancel();
|
||||||
_deepLinkInfoRequestId = request(MTPhelp_GetDeepLinkInfo(
|
_deepLinkInfoRequestId = request(MTPhelp_GetDeepLinkInfo(
|
||||||
MTP_string(path)
|
MTP_string(path)
|
||||||
)).done([=](const MTPhelp_DeepLinkInfo &result) {
|
)).done([=](const MTPhelp_DeepLinkInfo &result) {
|
||||||
_deepLinkInfoRequestId = 0;
|
_deepLinkInfoRequestId = 0;
|
||||||
if (result.type() == mtpc_help_deepLinkInfo) {
|
if (result.type() == mtpc_help_deepLinkInfo) {
|
||||||
callback(result.c_help_deepLinkInfo());
|
const auto &data = result.c_help_deepLinkInfo();
|
||||||
|
callback(TextWithEntities{
|
||||||
|
qs(data.vmessage()),
|
||||||
|
Api::EntitiesFromMTP(
|
||||||
|
_session,
|
||||||
|
data.ventities().value_or_empty())
|
||||||
|
}, data.is_update_app());
|
||||||
}
|
}
|
||||||
}).fail([=] {
|
}).fail([=] {
|
||||||
_deepLinkInfoRequestId = 0;
|
_deepLinkInfoRequestId = 0;
|
||||||
|
|
|
@ -192,7 +192,7 @@ public:
|
||||||
void refreshTopPromotion();
|
void refreshTopPromotion();
|
||||||
void requestDeepLinkInfo(
|
void requestDeepLinkInfo(
|
||||||
const QString &path,
|
const QString &path,
|
||||||
Fn<void(const MTPDhelp_deepLinkInfo &result)> callback);
|
Fn<void(TextWithEntities message, bool updateRequired)> callback);
|
||||||
void requestTermsUpdate();
|
void requestTermsUpdate();
|
||||||
void acceptTerms(bytes::const_span termsId);
|
void acceptTerms(bytes::const_span termsId);
|
||||||
|
|
||||||
|
|
|
@ -491,25 +491,21 @@ bool HandleUnknown(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const auto request = match->captured(1);
|
const auto request = match->captured(1);
|
||||||
const auto callback = crl::guard(controller, [=](const MTPDhelp_deepLinkInfo &result) {
|
const auto callback = crl::guard(controller, [=](
|
||||||
const auto text = TextWithEntities{
|
TextWithEntities message,
|
||||||
qs(result.vmessage()),
|
bool updateRequired) {
|
||||||
Api::EntitiesFromMTP(
|
if (updateRequired) {
|
||||||
&controller->session(),
|
|
||||||
result.ventities().value_or_empty())
|
|
||||||
};
|
|
||||||
if (result.is_update_app()) {
|
|
||||||
const auto callback = [=](Fn<void()> &&close) {
|
const auto callback = [=](Fn<void()> &&close) {
|
||||||
Core::UpdateApplication();
|
Core::UpdateApplication();
|
||||||
close();
|
close();
|
||||||
};
|
};
|
||||||
controller->show(Ui::MakeConfirmBox({
|
controller->show(Ui::MakeConfirmBox({
|
||||||
.text = text,
|
.text = message,
|
||||||
.confirmed = callback,
|
.confirmed = callback,
|
||||||
.confirmText = tr::lng_menu_update(),
|
.confirmText = tr::lng_menu_update(),
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
controller->show(Ui::MakeInformBox(text));
|
controller->show(Ui::MakeInformBox(message));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
controller->session().api().requestDeepLinkInfo(request, callback);
|
controller->session().api().requestDeepLinkInfo(request, callback);
|
||||||
|
|
Loading…
Add table
Reference in a new issue