mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-05 08:55:59 +00:00
Revert "Remove SendMediaReady legacy helper."
This reverts commit 91f8989f70
.
This commit is contained in:
@@ -36,8 +36,43 @@ enum class SendMediaType {
|
||||
Secure,
|
||||
};
|
||||
|
||||
using UploadFileParts = QMap<int, QByteArray>;
|
||||
struct SendMediaReady {
|
||||
SendMediaReady() = default; // temp
|
||||
SendMediaReady(
|
||||
SendMediaType type,
|
||||
const QString &file,
|
||||
const QString &filename,
|
||||
int64 filesize,
|
||||
const QByteArray &data,
|
||||
const uint64 &id,
|
||||
const uint64 &thumbId,
|
||||
const QString &thumbExt,
|
||||
const PeerId &peer,
|
||||
const MTPPhoto &photo,
|
||||
const PreparedPhotoThumbs &photoThumbs,
|
||||
const MTPDocument &document,
|
||||
const QByteArray &jpeg);
|
||||
|
||||
SendMediaType type;
|
||||
QString file, filename;
|
||||
int64 filesize = 0;
|
||||
QByteArray data;
|
||||
QString thumbExt;
|
||||
uint64 id, thumbId; // id always file-id of media, thumbId is file-id of thumb ( == id for photos)
|
||||
PeerId peer;
|
||||
|
||||
MTPPhoto photo;
|
||||
MTPDocument document;
|
||||
PreparedPhotoThumbs photoThumbs;
|
||||
UploadFileParts parts;
|
||||
QByteArray jpeg_md5;
|
||||
|
||||
QString caption;
|
||||
|
||||
};
|
||||
|
||||
using TaskId = void*; // no interface, just id
|
||||
inline constexpr auto kEmptyTaskId = TaskId();
|
||||
|
||||
class Task {
|
||||
public:
|
||||
@@ -109,7 +144,7 @@ struct SendingAlbum {
|
||||
struct Item {
|
||||
explicit Item(TaskId taskId);
|
||||
|
||||
TaskId taskId = kEmptyTaskId;
|
||||
TaskId taskId;
|
||||
uint64 randomId = 0;
|
||||
FullMsgId msgId;
|
||||
std::optional<MTPInputSingleMedia> media;
|
||||
@@ -147,21 +182,17 @@ struct FileLoadTo {
|
||||
MsgId replaceMediaOf;
|
||||
};
|
||||
|
||||
using UploadFileParts = QMap<int, QByteArray>;
|
||||
struct FilePrepareDescriptor {
|
||||
TaskId taskId = kEmptyTaskId;
|
||||
base::required<uint64> id;
|
||||
SendMediaType type = SendMediaType::File;
|
||||
FileLoadTo to = { PeerId(), Api::SendOptions(), FullReplyTo(), MsgId() };
|
||||
TextWithTags caption;
|
||||
bool spoiler = false;
|
||||
std::shared_ptr<SendingAlbum> album;
|
||||
};
|
||||
struct FilePrepareResult {
|
||||
explicit FilePrepareResult(FilePrepareDescriptor &&descriptor);
|
||||
struct FileLoadResult {
|
||||
FileLoadResult(
|
||||
TaskId taskId,
|
||||
uint64 id,
|
||||
const FileLoadTo &to,
|
||||
const TextWithTags &caption,
|
||||
bool spoiler,
|
||||
std::shared_ptr<SendingAlbum> album);
|
||||
|
||||
TaskId taskId = kEmptyTaskId;
|
||||
uint64 id = 0;
|
||||
TaskId taskId;
|
||||
uint64 id;
|
||||
FileLoadTo to;
|
||||
std::shared_ptr<SendingAlbum> album;
|
||||
SendMediaType type = SendMediaType::File;
|
||||
@@ -185,8 +216,8 @@ struct FilePrepareResult {
|
||||
QImage goodThumbnail;
|
||||
QByteArray goodThumbnailBytes;
|
||||
|
||||
MTPPhoto photo = MTP_photoEmpty(MTP_long(0));
|
||||
MTPDocument document = MTP_documentEmpty(MTP_long(0));
|
||||
MTPPhoto photo;
|
||||
MTPDocument document;
|
||||
|
||||
PreparedPhotoThumbs photoThumbs;
|
||||
TextWithTags caption;
|
||||
@@ -199,9 +230,6 @@ struct FilePrepareResult {
|
||||
|
||||
};
|
||||
|
||||
[[nodiscard]] std::shared_ptr<FilePrepareResult> MakePreparedFile(
|
||||
FilePrepareDescriptor &&descriptor);
|
||||
|
||||
class FileLoadTask final : public Task {
|
||||
public:
|
||||
static std::unique_ptr<Ui::PreparedFileInformation> ReadMediaInformation(
|
||||
@@ -248,7 +276,7 @@ public:
|
||||
}
|
||||
void finish() override;
|
||||
|
||||
FilePrepareResult *peekResult() const;
|
||||
FileLoadResult *peekResult() const;
|
||||
|
||||
private:
|
||||
static bool CheckForSong(
|
||||
@@ -284,6 +312,6 @@ private:
|
||||
TextWithTags _caption;
|
||||
bool _spoiler = false;
|
||||
|
||||
std::shared_ptr<FilePrepareResult> _result;
|
||||
std::shared_ptr<FileLoadResult> _result;
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user