2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 22:55:11 +00:00

Pass MTP::Instance to MTP::Sender.

This commit is contained in:
John Preston
2019-11-27 11:02:56 +03:00
parent a0152557ec
commit e943264823
65 changed files with 406 additions and 275 deletions

View File

@@ -828,6 +828,7 @@ StickersListWidget::StickersListWidget(
QWidget *parent,
not_null<Window::SessionController*> controller)
: Inner(parent, controller)
, _api(controller->session().api().instance())
, _section(Section::Stickers)
, _megagroupSetAbout(st::columnMinimalWidthThird - st::emojiScroll.width - st::emojiPanHeaderLeft)
, _addText(tr::lng_stickers_featured_add(tr::now).toUpper())
@@ -1069,7 +1070,7 @@ void StickersListWidget::sendSearchRequest() {
_footer->setLoading(true);
const auto hash = int32(0);
_searchRequestId = request(MTPmessages_SearchStickerSets(
_searchRequestId = _api.request(MTPmessages_SearchStickerSets(
MTP_flags(0),
MTP_string(_searchQuery),
MTP_int(hash)
@@ -1092,7 +1093,7 @@ void StickersListWidget::searchForSets(const QString &query) {
if (_searchQuery != cleaned) {
_footer->setLoading(false);
if (const auto requestId = base::take(_searchRequestId)) {
request(requestId).cancel();
_api.request(requestId).cancel();
}
if (_searchCache.find(cleaned) != _searchCache.cend()) {
_searchRequestTimer.cancel();
@@ -1108,7 +1109,7 @@ void StickersListWidget::searchForSets(const QString &query) {
void StickersListWidget::cancelSetsSearch() {
_footer->setLoading(false);
if (const auto requestId = base::take(_searchRequestId)) {
request(requestId).cancel();
_api.request(requestId).cancel();
}
_searchRequestTimer.cancel();
_searchQuery = _searchNextQuery = QString();
@@ -2468,7 +2469,7 @@ void StickersListWidget::refreshMegagroupStickers(GroupStickersPlace place) {
return;
}
_megagroupSetIdRequested = set.vid().v;
request(MTPmessages_GetStickerSet(
_api.request(MTPmessages_GetStickerSet(
_megagroupSet->mgInfo->stickerSet
)).done([=](const MTPmessages_StickerSet &result) {
if (const auto set = Stickers::FeedSetFull(result)) {
@@ -2810,7 +2811,7 @@ void StickersListWidget::installSet(uint64 setId) {
const auto input = Stickers::inputSetId(*it);
if ((it->flags & MTPDstickerSet_ClientFlag::f_not_loaded)
|| it->stickers.empty()) {
request(MTPmessages_GetStickerSet(
_api.request(MTPmessages_GetStickerSet(
input
)).done([=](const MTPmessages_StickerSet &result) {
Stickers::FeedSetFull(result);
@@ -2825,7 +2826,7 @@ void StickersListWidget::installSet(uint64 setId) {
void StickersListWidget::sendInstallRequest(
uint64 setId,
const MTPInputStickerSet &input) {
request(MTPmessages_InstallStickerSet(
_api.request(MTPmessages_InstallStickerSet(
input,
MTP_bool(false)
)).done([=](const MTPmessages_StickerSetInstallResult &result) {
@@ -2876,9 +2877,9 @@ void StickersListWidget::removeSet(uint64 setId) {
auto it = sets.find(_removingSetId);
if (it != sets.cend()) {
if (it->id && it->access) {
request(MTPmessages_UninstallStickerSet(MTP_inputStickerSetID(MTP_long(it->id), MTP_long(it->access)))).send();
_api.request(MTPmessages_UninstallStickerSet(MTP_inputStickerSetID(MTP_long(it->id), MTP_long(it->access)))).send();
} else if (!it->shortName.isEmpty()) {
request(MTPmessages_UninstallStickerSet(MTP_inputStickerSetShortName(MTP_string(it->shortName)))).send();
_api.request(MTPmessages_UninstallStickerSet(MTP_inputStickerSetShortName(MTP_string(it->shortName)))).send();
}
auto writeRecent = false;
auto &recent = Stickers::GetRecentPack();