/* 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 "history/history_item_helpers.h" class History; enum class SendMediaType; namespace Api { struct MessageToSend; struct SendAction; struct SendOptions; } // namespace Api namespace Data { struct ReactionId; } // namespace Data namespace HistoryView { class ComposeControls; } // namespace HistoryView namespace HistoryView::Controls { struct VoiceToSend; } // namespace HistoryView::Controls namespace InlineBots { class Result; } // namespace InlineBots namespace Main { class Session; } // namespace Main namespace SendMenu { struct Details; } // namespace SendMenu namespace Ui { struct PreparedList; struct PreparedBundle; class SendFilesWay; class RpWidget; } // namespace Ui namespace Media::Stories { class Controller; struct ReplyAreaData { PeerData *peer = nullptr; StoryId id = 0; friend inline auto operator<=>(ReplyAreaData, ReplyAreaData) = default; friend inline bool operator==(ReplyAreaData, ReplyAreaData) = default; }; class ReplyArea final : public base::has_weak_ptr { public: explicit ReplyArea(not_null controller); ~ReplyArea(); void show( ReplyAreaData data, rpl::producer likedValue); bool sendReaction(const Data::ReactionId &id); [[nodiscard]] bool focused() const; [[nodiscard]] rpl::producer focusedValue() const; [[nodiscard]] rpl::producer activeValue() const; [[nodiscard]] rpl::producer hasSendTextValue() const; [[nodiscard]] bool ignoreWindowMove(QPoint position) const; void tryProcessKeyInput(not_null e); [[nodiscard]] not_null likeAnimationTarget() const; private: class Cant; using VoiceToSend = HistoryView::Controls::VoiceToSend; [[nodiscard]] Main::Session &session() const; [[nodiscard]] not_null history() const; bool send( Api::MessageToSend message, bool skipToast = false); [[nodiscard]] bool checkSendPayment( int messagesCount, int starsApproved, Fn withPaymentApproved); void uploadFile(const QByteArray &fileContent, SendMediaType type); bool confirmSendingFiles( QImage &&image, QByteArray &&content, std::optional overrideSendImagesAsPhotos = std::nullopt, const QString &insertTextOnCancel = QString()); bool confirmSendingFiles( Ui::PreparedList &&list, const QString &insertTextOnCancel = QString()); bool confirmSendingFiles( not_null data, std::optional overrideSendImagesAsPhotos, const QString &insertTextOnCancel = QString()); bool showSendingFilesError(const Ui::PreparedList &list) const; bool showSendingFilesError( const Ui::PreparedList &list, std::optional compress) const; void sendingFilesConfirmed( Ui::PreparedList &&list, Ui::SendFilesWay way, TextWithTags &&caption, Api::SendOptions options, bool ctrlShiftEnter); void sendingFilesConfirmed( std::shared_ptr bundle, Api::SendOptions options); void finishSending(bool skipToast = false); bool sendExistingDocument( not_null document, Api::MessageToSend messageToSend, std::optional localId); void sendExistingPhoto(not_null photo); bool sendExistingPhoto( not_null photo, Api::SendOptions options); void sendInlineResult( std::shared_ptr result, not_null bot); void sendInlineResult( std::shared_ptr result, not_null bot, Api::SendOptions options, std::optional localMessageId); void initGeometry(); void initActions(); [[nodiscard]] Api::SendAction prepareSendAction( Api::SendOptions options) const; void send(Api::SendOptions options); void sendVoice(const VoiceToSend &data); void chooseAttach(std::optional overrideSendImagesAsPhotos); [[nodiscard]] Fn sendMenuDetails() const; void showPremiumToast(not_null emoji); [[nodiscard]] bool showSlowmodeError(); const not_null _controller; rpl::variable _isComment; rpl::variable _starsForMessage; const std::unique_ptr _controls; std::unique_ptr _cant; ReplyAreaData _data; base::has_weak_ptr _shownPeerGuard; bool _chooseAttachRequest = false; rpl::variable _choosingAttach; SendPaymentHelper _sendPayment; rpl::lifetime _lifetime; }; } // namespace Media::Stories