diff --git a/Telegram/SourceFiles/history/view/history_view_compose_controls.cpp b/Telegram/SourceFiles/history/view/history_view_compose_controls.cpp index c43d26298..ef09c0957 100644 --- a/Telegram/SourceFiles/history/view/history_view_compose_controls.cpp +++ b/Telegram/SourceFiles/history/view/history_view_compose_controls.cpp @@ -398,7 +398,7 @@ ComposeControls::ComposeControls( Mode mode) : _parent(parent) , _window(window) -//, _mode(mode) +, _mode(mode) , _wrap(std::make_unique(parent)) , _send(Ui::CreateChild(_wrap.get())) , _attachToggle(Ui::CreateChild( @@ -473,7 +473,10 @@ rpl::producer> ComposeControls::keyEvents() const { rpl::producer<> ComposeControls::sendRequests() const { auto filter = rpl::filter([=] { - return _send->type() == Ui::SendButton::Type::Schedule; + const auto type = (_mode == Mode::Normal) + ? Ui::SendButton::Type::Send + : Ui::SendButton::Type::Schedule; + return (_send->type() == type); }); auto submits = base::qt_signal_producer( _field.get(), @@ -708,7 +711,7 @@ void ComposeControls::updateSendButtonType() { //} else if (showRecordButton()) { // return Type::Record; } - return Type::Schedule; + return (_mode == Mode::Normal) ? Type::Send : Type::Schedule; }(); _send->setType(type); diff --git a/Telegram/SourceFiles/history/view/history_view_compose_controls.h b/Telegram/SourceFiles/history/view/history_view_compose_controls.h index 13179d945..1d75e0cf2 100644 --- a/Telegram/SourceFiles/history/view/history_view_compose_controls.h +++ b/Telegram/SourceFiles/history/view/history_view_compose_controls.h @@ -141,7 +141,7 @@ private: const not_null _parent; const not_null _window; History *_history = nullptr; - //Mode _mode = Mode::Normal; + Mode _mode = Mode::Normal; const std::unique_ptr _wrap; diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index 36c7ae36e..1d6287004 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -1710,7 +1710,7 @@ void Message::updateMediaInBubbleState() { auto getMediaHasSomethingAbove = [&] { return displayFromName() || displayForwardedFrom() - || item->Has() + || displayedReply() || item->Has(); }; auto entry = logEntryOriginal(); diff --git a/Telegram/SourceFiles/history/view/history_view_replies_section.cpp b/Telegram/SourceFiles/history/view/history_view_replies_section.cpp index 026a46016..42d70a1c0 100644 --- a/Telegram/SourceFiles/history/view/history_view_replies_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_replies_section.cpp @@ -374,10 +374,8 @@ bool RepliesWidget::confirmSendingFiles( text, boxCompressConfirm, _history->peer->slowmodeApplied() ? SendLimit::One : SendLimit::Many, - CanScheduleUntilOnline(_history->peer) - ? Api::SendType::ScheduledToUser - : Api::SendType::Scheduled, - SendMenu::Type::Disabled); + Api::SendType::Normal, + SendMenu::Type::Disabled); // #TODO replies schedule //_field->setTextWithTags({}); box->setConfirmedCallback(crl::guard(this, [=]( @@ -399,7 +397,7 @@ bool RepliesWidget::confirmSendingFiles( std::move(list), type, std::move(caption), - MsgId(0),//replyToId(), + MsgId(_rootId),//replyToId(), // #TODO replies reply options, album); })); @@ -460,7 +458,7 @@ void RepliesWidget::uploadFilesAfterConfirmation( return; } auto action = Api::SendAction(_history); - action.replyTo = replyTo; + action.replyTo = _rootId;// replyTo;// #TODO replies reply action.options = options; session().api().sendFiles( std::move(list), @@ -473,15 +471,10 @@ void RepliesWidget::uploadFilesAfterConfirmation( void RepliesWidget::uploadFile( const QByteArray &fileContent, SendMediaType type) { - const auto callback = [=](Api::SendOptions options) { - auto action = Api::SendAction(_history); - //action.replyTo = replyToId(); - action.options = options; - session().api().sendFile(fileContent, type, action); - }; - Ui::show( - PrepareScheduleBox(this, sendMenuType(), callback), - Ui::LayerOption::KeepOther); + // #TODO replies schedule + auto action = Api::SendAction(_history); + action.replyTo = _rootId;// #TODO replies reply + session().api().sendFile(fileContent, type, action); } bool RepliesWidget::showSendingFilesError( @@ -521,10 +514,12 @@ void RepliesWidget::send() { if (_composeControls->getTextWithAppliedMarkdown().text.isEmpty()) { return; } - const auto callback = [=](Api::SendOptions options) { send(options); }; - Ui::show( - PrepareScheduleBox(this, sendMenuType(), callback), - Ui::LayerOption::KeepOther); + send(Api::SendOptions()); + // #TODO replies schedule + //const auto callback = [=](Api::SendOptions options) { send(options); }; + //Ui::show( + // PrepareScheduleBox(this, sendMenuType(), callback), + // Ui::LayerOption::KeepOther); } void RepliesWidget::send(Api::SendOptions options) { @@ -537,7 +532,7 @@ void RepliesWidget::send(Api::SendOptions options) { auto message = ApiWrap::MessageToSend(_history); message.textWithTags = _composeControls->getTextWithAppliedMarkdown(); message.action.options = options; - //message.action.replyTo = replyToId(); + message.action.replyTo = _rootId;// replyToId();// #TODO replies reply message.webPageId = webPageId; //const auto error = GetErrorTextForSending( @@ -637,12 +632,14 @@ void RepliesWidget::edit( void RepliesWidget::sendExistingDocument( not_null document) { - const auto callback = [=](Api::SendOptions options) { - sendExistingDocument(document, options); - }; - Ui::show( - PrepareScheduleBox(this, sendMenuType(), callback), - Ui::LayerOption::KeepOther); + sendExistingDocument(document, Api::SendOptions()); + // #TODO replies schedule + //const auto callback = [=](Api::SendOptions options) { + // sendExistingDocument(document, options); + //}; + //Ui::show( + // PrepareScheduleBox(this, sendMenuType(), callback), + // Ui::LayerOption::KeepOther); } bool RepliesWidget::sendExistingDocument( @@ -657,7 +654,7 @@ bool RepliesWidget::sendExistingDocument( } auto message = Api::MessageToSend(_history); - //message.action.replyTo = replyToId(); + message.action.replyTo = _rootId;// replyToId();// #TODO replies reply message.action.options = options; Api::SendExistingDocument(std::move(message), document); @@ -675,12 +672,14 @@ bool RepliesWidget::sendExistingDocument( } void RepliesWidget::sendExistingPhoto(not_null photo) { - const auto callback = [=](Api::SendOptions options) { - sendExistingPhoto(photo, options); - }; - Ui::show( - PrepareScheduleBox(this, sendMenuType(), callback), - Ui::LayerOption::KeepOther); + sendExistingPhoto(photo, Api::SendOptions()); + // #TODO replies schedule + //const auto callback = [=](Api::SendOptions options) { + // sendExistingPhoto(photo, options); + //}; + //Ui::show( + // PrepareScheduleBox(this, sendMenuType(), callback), + // Ui::LayerOption::KeepOther); } bool RepliesWidget::sendExistingPhoto( @@ -695,7 +694,7 @@ bool RepliesWidget::sendExistingPhoto( } auto message = Api::MessageToSend(_history); - //message.action.replyTo = replyToId(); + message.action.replyTo = _rootId;// replyToId();// #TODO replies reply message.action.options = options; Api::SendExistingPhoto(std::move(message), photo); @@ -712,12 +711,13 @@ void RepliesWidget::sendInlineResult( Ui::show(Box(errorText)); return; } - const auto callback = [=](Api::SendOptions options) { - sendInlineResult(result, bot, options); - }; - Ui::show( - PrepareScheduleBox(this, sendMenuType(), callback), - Ui::LayerOption::KeepOther); + sendInlineResult(result, bot, Api::SendOptions()); + //const auto callback = [=](Api::SendOptions options) { + // sendInlineResult(result, bot, options); + //}; + //Ui::show( + // PrepareScheduleBox(this, sendMenuType(), callback), + // Ui::LayerOption::KeepOther); } void RepliesWidget::sendInlineResult( @@ -725,7 +725,7 @@ void RepliesWidget::sendInlineResult( not_null bot, Api::SendOptions options) { auto action = Api::SendAction(_history); - //action.replyTo = replyToId(); + action.replyTo = _rootId;// replyToId();// #TODO replies reply action.options = options; action.generateLocal = true; session().api().sendInlineResult(bot, result, action); @@ -752,6 +752,7 @@ void RepliesWidget::sendInlineResult( } SendMenu::Type RepliesWidget::sendMenuType() const { + // #TODO replies schedule return _history->peer->isSelf() ? SendMenu::Type::Reminder : HistoryView::CanScheduleUntilOnline(_history->peer)