mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Added ability to provide text with tags when send existing document.
This commit is contained in:
parent
679350e23d
commit
ec7fbb8952
11 changed files with 47 additions and 26 deletions
|
@ -457,7 +457,8 @@ void GifsListWidget::mouseReleaseEvent(QMouseEvent *e) {
|
|||
void GifsListWidget::selectInlineResult(
|
||||
int index,
|
||||
Api::SendOptions options,
|
||||
bool forceSend) {
|
||||
bool forceSend,
|
||||
TextWithTags caption) {
|
||||
const auto item = _mosaic.maybeItemAt(index);
|
||||
if (!item) {
|
||||
return;
|
||||
|
@ -498,6 +499,7 @@ void GifsListWidget::selectInlineResult(
|
|||
.document = document,
|
||||
.options = options,
|
||||
.messageSendingFrom = messageSendingFrom(),
|
||||
.caption = std::move(caption),
|
||||
});
|
||||
} else if (!preview.usingThumbnail()) {
|
||||
if (preview.loading()) {
|
||||
|
|
|
@ -172,7 +172,8 @@ private:
|
|||
void selectInlineResult(
|
||||
int index,
|
||||
Api::SendOptions options,
|
||||
bool forceSend = false);
|
||||
bool forceSend = false,
|
||||
TextWithTags caption = {});
|
||||
|
||||
const std::shared_ptr<Show> _show;
|
||||
std::unique_ptr<Ui::TabbedSearch> _search;
|
||||
|
|
|
@ -62,6 +62,7 @@ struct FileChosen {
|
|||
not_null<DocumentData*> document;
|
||||
Api::SendOptions options;
|
||||
Ui::MessageSendingAnimationFrom messageSendingFrom;
|
||||
TextWithTags caption;
|
||||
};
|
||||
|
||||
struct PhotoChosen {
|
||||
|
|
|
@ -1201,7 +1201,13 @@ void HistoryWidget::initTabbedSelector() {
|
|||
controller()->sendingAnimation().appendSending(
|
||||
data.messageSendingFrom);
|
||||
const auto localId = data.messageSendingFrom.localId;
|
||||
sendExistingDocument(data.document, data.options, localId);
|
||||
auto messageToSend = Api::MessageToSend(
|
||||
prepareSendAction(data.options));
|
||||
messageToSend.textWithTags = base::take(data.caption);
|
||||
sendExistingDocument(
|
||||
data.document,
|
||||
std::move(messageToSend),
|
||||
localId);
|
||||
}
|
||||
}, lifetime());
|
||||
|
||||
|
@ -7458,7 +7464,7 @@ void HistoryWidget::requestMessageData(MsgId msgId) {
|
|||
|
||||
bool HistoryWidget::sendExistingDocument(
|
||||
not_null<DocumentData*> document,
|
||||
Api::SendOptions options,
|
||||
Api::MessageToSend messageToSend,
|
||||
std::optional<MsgId> localId) {
|
||||
const auto error = _peer
|
||||
? Data::RestrictionError(_peer, ChatRestriction::SendStickers)
|
||||
|
@ -7474,7 +7480,7 @@ bool HistoryWidget::sendExistingDocument(
|
|||
}
|
||||
|
||||
Api::SendExistingDocument(
|
||||
Api::MessageToSend(prepareSendAction(options)),
|
||||
std::move(messageToSend),
|
||||
document,
|
||||
localId);
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ struct Details;
|
|||
} // namespace SendMenu
|
||||
|
||||
namespace Api {
|
||||
struct MessageToSend;
|
||||
struct SendOptions;
|
||||
struct SendAction;
|
||||
} // namespace Api
|
||||
|
@ -273,7 +274,7 @@ public:
|
|||
[[nodiscard]] SendMenu::Details saveMenuDetails() const;
|
||||
bool sendExistingDocument(
|
||||
not_null<DocumentData*> document,
|
||||
Api::SendOptions options,
|
||||
Api::MessageToSend messageToSend,
|
||||
std::optional<MsgId> localId = std::nullopt);
|
||||
bool sendExistingPhoto(
|
||||
not_null<PhotoData*> photo,
|
||||
|
|
|
@ -760,8 +760,13 @@ void RepliesWidget::setupComposeControls() {
|
|||
controller()->hideLayer(anim::type::normal);
|
||||
controller()->sendingAnimation().appendSending(
|
||||
data.messageSendingFrom);
|
||||
const auto localId = data.messageSendingFrom.localId;
|
||||
sendExistingDocument(data.document, data.options, localId);
|
||||
auto messageToSend = Api::MessageToSend(
|
||||
prepareSendAction(data.options));
|
||||
messageToSend.textWithTags = base::take(data.caption);
|
||||
sendExistingDocument(
|
||||
data.document,
|
||||
std::move(messageToSend),
|
||||
data.messageSendingFrom.localId);
|
||||
}, lifetime());
|
||||
|
||||
_composeControls->photoChosen(
|
||||
|
@ -1327,7 +1332,7 @@ void RepliesWidget::refreshJoinGroupButton() {
|
|||
|
||||
bool RepliesWidget::sendExistingDocument(
|
||||
not_null<DocumentData*> document,
|
||||
Api::SendOptions options,
|
||||
Api::MessageToSend messageToSend,
|
||||
std::optional<MsgId> localId) {
|
||||
const auto error = Data::RestrictionError(
|
||||
_history->peer,
|
||||
|
@ -1341,7 +1346,7 @@ bool RepliesWidget::sendExistingDocument(
|
|||
}
|
||||
|
||||
Api::SendExistingDocument(
|
||||
Api::MessageToSend(prepareSendAction(options)),
|
||||
std::move(messageToSend),
|
||||
document,
|
||||
localId);
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ struct Details;
|
|||
} // namespace SendMenu
|
||||
|
||||
namespace Api {
|
||||
struct MessageToSend;
|
||||
struct SendOptions;
|
||||
struct SendAction;
|
||||
} // namespace Api
|
||||
|
@ -303,7 +304,7 @@ private:
|
|||
|
||||
bool sendExistingDocument(
|
||||
not_null<DocumentData*> document,
|
||||
Api::SendOptions options,
|
||||
Api::MessageToSend messageToSend,
|
||||
std::optional<MsgId> localId);
|
||||
void sendExistingPhoto(not_null<PhotoData*> photo);
|
||||
bool sendExistingPhoto(
|
||||
|
|
|
@ -342,7 +342,10 @@ void ScheduledWidget::setupComposeControls() {
|
|||
controller()->hideLayer(anim::type::normal);
|
||||
const auto document = data.document;
|
||||
const auto callback = crl::guard(this, [=](Api::SendOptions options) {
|
||||
sendExistingDocument(document, options);
|
||||
auto messageToSend = Api::MessageToSend(
|
||||
prepareSendAction(options));
|
||||
messageToSend.textWithTags = data.caption;
|
||||
sendExistingDocument(document, std::move(messageToSend));
|
||||
});
|
||||
controller()->show(
|
||||
PrepareScheduleBox(this, _show, sendMenuDetails(), callback));
|
||||
|
@ -815,7 +818,7 @@ void ScheduledWidget::edit(
|
|||
|
||||
bool ScheduledWidget::sendExistingDocument(
|
||||
not_null<DocumentData*> document,
|
||||
Api::SendOptions options) {
|
||||
Api::MessageToSend messageToSend) {
|
||||
const auto error = Data::RestrictionError(
|
||||
_history->peer,
|
||||
ChatRestriction::SendStickers);
|
||||
|
@ -826,9 +829,7 @@ bool ScheduledWidget::sendExistingDocument(
|
|||
return false;
|
||||
}
|
||||
|
||||
Api::SendExistingDocument(
|
||||
Api::MessageToSend(prepareSendAction(options)),
|
||||
document);
|
||||
Api::SendExistingDocument(std::move(messageToSend), document);
|
||||
|
||||
_composeControls->hidePanelsAnimated();
|
||||
_composeControls->focus();
|
||||
|
|
|
@ -26,6 +26,7 @@ struct Details;
|
|||
} // namespace SendMenu
|
||||
|
||||
namespace Api {
|
||||
struct MessageToSend;
|
||||
struct SendOptions;
|
||||
struct SendAction;
|
||||
} // namespace Api
|
||||
|
@ -253,7 +254,7 @@ private:
|
|||
|
||||
bool sendExistingDocument(
|
||||
not_null<DocumentData*> document,
|
||||
Api::SendOptions options);
|
||||
Api::MessageToSend messageToSend);
|
||||
void sendExistingPhoto(not_null<PhotoData*> photo);
|
||||
bool sendExistingPhoto(
|
||||
not_null<PhotoData*> photo,
|
||||
|
|
|
@ -252,7 +252,7 @@ void ReplyArea::sendVoice(VoiceToSend &&data) {
|
|||
|
||||
bool ReplyArea::sendExistingDocument(
|
||||
not_null<DocumentData*> document,
|
||||
Api::SendOptions options,
|
||||
Api::MessageToSend messageToSend,
|
||||
std::optional<MsgId> localId) {
|
||||
Expects(_data.peer != nullptr);
|
||||
|
||||
|
@ -268,10 +268,7 @@ bool ReplyArea::sendExistingDocument(
|
|||
return false;
|
||||
}
|
||||
|
||||
Api::SendExistingDocument(
|
||||
Api::MessageToSend(prepareSendAction(options)),
|
||||
document,
|
||||
localId);
|
||||
Api::SendExistingDocument(std::move(messageToSend), document, localId);
|
||||
|
||||
_controls->cancelReplyMessage();
|
||||
finishSending();
|
||||
|
@ -633,8 +630,13 @@ void ReplyArea::initActions() {
|
|||
_controls->fileChosen(
|
||||
) | rpl::start_with_next([=](ChatHelpers::FileChosen data) {
|
||||
_controller->uiShow()->hideLayer();
|
||||
const auto localId = data.messageSendingFrom.localId;
|
||||
sendExistingDocument(data.document, data.options, localId);
|
||||
auto messageToSend = Api::MessageToSend(
|
||||
prepareSendAction(data.options));
|
||||
messageToSend.textWithTags = base::take(data.caption);
|
||||
sendExistingDocument(
|
||||
data.document,
|
||||
std::move(messageToSend),
|
||||
data.messageSendingFrom.localId);
|
||||
}, _lifetime);
|
||||
|
||||
_controls->photoChosen(
|
||||
|
|
|
@ -13,9 +13,9 @@ class History;
|
|||
enum class SendMediaType;
|
||||
|
||||
namespace Api {
|
||||
struct MessageToSend;
|
||||
struct SendAction;
|
||||
struct SendOptions;
|
||||
struct MessageToSend;
|
||||
} // namespace Api
|
||||
|
||||
namespace Data {
|
||||
|
@ -120,7 +120,7 @@ private:
|
|||
|
||||
bool sendExistingDocument(
|
||||
not_null<DocumentData*> document,
|
||||
Api::SendOptions options,
|
||||
Api::MessageToSend messageToSend,
|
||||
std::optional<MsgId> localId);
|
||||
void sendExistingPhoto(not_null<PhotoData*> photo);
|
||||
bool sendExistingPhoto(
|
||||
|
|
Loading…
Add table
Reference in a new issue