/* This file is part of Telegram Desktop, the official desktop application for the Telegram messaging service. For license and copyright information please follow this link: https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once #include "base/weak_ptr.h" #include "data/stickers/data_stickers.h" #include "mtproto/sender.h" class DocumentData; namespace Main { class Session; } // namespace Main namespace Api { void AddExistingStickerToSet( not_null session, const StickerSetIdentifier &set, not_null document, const QString &emoji, Fn done, Fn fail); class StickerUpload final : public base::has_weak_ptr { public: StickerUpload( not_null session, StickerSetIdentifier set, QByteArray webpBytes, QString emoji); ~StickerUpload(); void start( Fn done, Fn fail, Fn progress = nullptr); void cancel(); private: void uploadReady(const MTPInputFile &file); void uploadFailed(); void uploadProgressed(); void requestAddSticker(const MTPInputDocument &document); const not_null _session; StickerSetIdentifier _set; QByteArray _bytes; QString _emoji; MTP::Sender _api; rpl::lifetime _uploadLifetime; FullMsgId _uploadId; DocumentId _documentId = 0; mtpRequestId _addRequestId = 0; Fn _done; Fn _fail; Fn _progress; int _lastReportedPercent = -1; }; } // namespace Api