mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Update API scheme to layer 143.
This commit is contained in:
@@ -91,8 +91,8 @@ struct PreparedFileThumbnail {
|
||||
|
||||
[[nodiscard]] bool FileThumbnailUploadRequired(
|
||||
const QString &filemime,
|
||||
int32 filesize) {
|
||||
constexpr auto kThumbnailUploadBySize = 5 * 1024 * 1024;
|
||||
int64 filesize) {
|
||||
constexpr auto kThumbnailUploadBySize = 5 * int64(1024 * 1024);
|
||||
const auto kThumbnailKnownMimes = {
|
||||
"image/jpeg",
|
||||
"image/gif",
|
||||
@@ -108,7 +108,7 @@ struct PreparedFileThumbnail {
|
||||
[[nodiscard]] PreparedFileThumbnail FinalizeFileThumbnail(
|
||||
PreparedFileThumbnail &&prepared,
|
||||
const QString &filemime,
|
||||
int32 filesize,
|
||||
int64 filesize,
|
||||
bool isSticker) {
|
||||
prepared.name = isSticker ? qsl("thumb.webp") : qsl("thumb.jpg");
|
||||
if (FileThumbnailUploadRequired(filemime, filesize)) {
|
||||
@@ -249,7 +249,7 @@ SendMediaReady::SendMediaReady(
|
||||
SendMediaType type,
|
||||
const QString &file,
|
||||
const QString &filename,
|
||||
int32 filesize,
|
||||
int64 filesize,
|
||||
const QByteArray &data,
|
||||
const uint64 &id,
|
||||
const uint64 &thumbId,
|
||||
@@ -842,9 +842,9 @@ void FileLoadTask::process(Args &&args) {
|
||||
fullimagebytes = fullimageformat = QByteArray();
|
||||
}
|
||||
}
|
||||
_result->filesize = (int32)qMin(filesize, qint64(INT_MAX));
|
||||
_result->filesize = qMin(filesize, qint64(UINT_MAX));
|
||||
|
||||
if (!filesize || filesize > kFileSizeLimit) {
|
||||
if (!filesize || filesize > kFileSizePremiumLimit) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -987,7 +987,7 @@ void FileLoadTask::process(Args &&args) {
|
||||
MTP_bytes(),
|
||||
MTP_int(base::unixtime::now()),
|
||||
MTP_string(filemime),
|
||||
MTP_int(filesize),
|
||||
MTP_long(filesize),
|
||||
MTP_vector<MTPPhotoSize>(1, thumbnail.mtpSize),
|
||||
MTPVector<MTPVideoSize>(),
|
||||
MTP_int(_dcId),
|
||||
@@ -1000,7 +1000,7 @@ void FileLoadTask::process(Args &&args) {
|
||||
MTP_bytes(),
|
||||
MTP_int(base::unixtime::now()),
|
||||
MTP_string(filemime),
|
||||
MTP_int(filesize),
|
||||
MTP_long(filesize),
|
||||
MTP_vector<MTPPhotoSize>(1, thumbnail.mtpSize),
|
||||
MTPVector<MTPVideoSize>(),
|
||||
MTP_int(_dcId),
|
||||
@@ -1048,6 +1048,12 @@ void FileLoadTask::finish() {
|
||||
tr::lng_send_image_empty(tr::now, lt_name, _filepath)),
|
||||
Ui::LayerOption::KeepOther);
|
||||
removeFromAlbum();
|
||||
} else if (_result->filesize > kFileSizePremiumLimit) {
|
||||
Ui::show(
|
||||
Ui::MakeInformBox(
|
||||
tr::lng_send_image_too_large(tr::now, lt_name, _filepath)),
|
||||
Ui::LayerOption::KeepOther);
|
||||
removeFromAlbum();
|
||||
} else if (_result->filesize > kFileSizeLimit) {
|
||||
Ui::show(
|
||||
Ui::MakeInformBox(
|
||||
|
Reference in New Issue
Block a user