diff --git a/Telegram/SourceFiles/boxes/send_files_box.cpp b/Telegram/SourceFiles/boxes/send_files_box.cpp index bed83c42c..3c0da6955 100644 --- a/Telegram/SourceFiles/boxes/send_files_box.cpp +++ b/Telegram/SourceFiles/boxes/send_files_box.cpp @@ -633,15 +633,17 @@ void SendFilesBox::refreshControls() { } void SendFilesBox::setupSendWayControls() { + const auto groupFilesFirst = _sendWay.current().groupFiles(); + const auto asPhotosFirst = _sendWay.current().sendImagesAsPhotos(); _groupFiles.create( this, tr::lng_send_grouped(tr::now), - _sendWay.current().groupFiles(), + groupFilesFirst, st::defaultBoxCheckbox); _sendImagesAsPhotos.create( this, tr::lng_send_compressed(tr::now), - _sendWay.current().sendImagesAsPhotos(), + asPhotosFirst, st::defaultBoxCheckbox); _sendWay.changes( @@ -664,6 +666,21 @@ void SendFilesBox::setupSendWayControls() { _sendWay = sendWay; }, lifetime()); + _wayRemember.create( + this, + tr::lng_remember(tr::now), + false, + st::defaultBoxCheckbox); + _wayRemember->hide(); + rpl::combine( + _groupFiles->checkedValue(), + _sendImagesAsPhotos->checkedValue() + ) | rpl::start_with_next([=](bool groupFiles, bool asPhoto) { + _wayRemember->setVisible( + (groupFiles != groupFilesFirst) || (asPhoto != asPhotosFirst)); + captionResized(); + }, lifetime()); + _hintLabel.create( this, tr::lng_edit_photo_editor_hint(tr::now), @@ -913,9 +930,10 @@ void SendFilesBox::updateBoxSize() { if (_caption) { footerHeight += st::boxPhotoCaptionSkip + _caption->height(); } - const auto pairs = std::array, 3>{ { + const auto pairs = std::array, 4>{ { { _groupFiles.data(), st::boxPhotoCompressedSkip }, { _sendImagesAsPhotos.data(), st::boxPhotoCompressedSkip }, + { _wayRemember.data(), st::boxPhotoCompressedSkip }, { _hintLabel.data(), st::editMediaLabelMargins.top() }, } }; for (const auto &pair : pairs) { @@ -980,10 +998,11 @@ void SendFilesBox::updateControlsGeometry() { _emojiToggle->update(); } } - const auto pairs = std::array, 3>{ { + const auto pairs = std::array, 4>{ { { _hintLabel.data(), st::editMediaLabelMargins.top() }, { _groupFiles.data(), st::boxPhotoCompressedSkip }, { _sendImagesAsPhotos.data(), st::boxPhotoCompressedSkip }, + { _wayRemember.data(), st::boxPhotoCompressedSkip }, } }; for (const auto &pair : ranges::views::reverse(pairs)) { const auto pointer = pair.first; @@ -1052,7 +1071,9 @@ void SendFilesBox::send( return; } - saveSendWaySettings(); + if (_wayRemember && _wayRemember->checked()) { + saveSendWaySettings(); + } for (auto &block : _blocks) { block.applyAlbumOrder(); diff --git a/Telegram/SourceFiles/boxes/send_files_box.h b/Telegram/SourceFiles/boxes/send_files_box.h index 944bc9372..0d336832e 100644 --- a/Telegram/SourceFiles/boxes/send_files_box.h +++ b/Telegram/SourceFiles/boxes/send_files_box.h @@ -187,6 +187,7 @@ private: object_ptr _groupFiles = { nullptr }; object_ptr _sendImagesAsPhotos = { nullptr }; + object_ptr _wayRemember = { nullptr }; object_ptr _hintLabel = { nullptr }; rpl::variable _sendWay = Ui::SendFilesWay();