2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 22:46:10 +00:00

Add sending paid stories replies.

This commit is contained in:
John Preston
2025-02-25 18:59:16 +04:00
parent fe2df96953
commit 1684465e04
14 changed files with 442 additions and 156 deletions

View File

@@ -266,6 +266,27 @@ bool PreparedList::hasSpoilerMenu(bool compress) const {
return allAreVideo || (allAreMedia && compress);
}
std::shared_ptr<PreparedBundle> PrepareFilesBundle(
std::vector<PreparedGroup> groups,
SendFilesWay way,
TextWithTags caption,
bool ctrlShiftEnter) {
auto totalCount = 0;
for (const auto &group : groups) {
totalCount += group.list.files.size();
}
const auto sendComment = !caption.text.isEmpty()
&& (groups.size() != 1 || !groups.front().sentWithCaption());
return std::make_shared<PreparedBundle>(PreparedBundle{
.groups = std::move(groups),
.way = way,
.caption = std::move(caption),
.totalCount = totalCount + (sendComment ? 1 : 0),
.sendComment = sendComment,
.ctrlShiftEnter = ctrlShiftEnter,
});
}
int MaxAlbumItems() {
return kMaxAlbumCount;
}

View File

@@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#pragma once
#include "editor/photo_editor_common.h"
#include "ui/chat/attach/attach_send_files_way.h"
#include "ui/rect_part.h"
#include <QtCore/QSemaphore>
@@ -153,6 +154,20 @@ struct PreparedGroup {
SendFilesWay way,
bool slowmode);
struct PreparedBundle {
std::vector<PreparedGroup> groups;
SendFilesWay way;
TextWithTags caption;
int totalCount = 0;
bool sendComment = false;
bool ctrlShiftEnter = false;
};
[[nodiscard]] std::shared_ptr<PreparedBundle> PrepareFilesBundle(
std::vector<PreparedGroup> groups,
SendFilesWay way,
TextWithTags caption,
bool ctrlShiftEnter);
[[nodiscard]] int MaxAlbumItems();
[[nodiscard]] bool ValidateThumbDimensions(int width, int height);