@@ -264,14 +264,16 @@ SendFilesBox::Block::Block(
264264 });
265265 _preview.reset (preview);
266266 } else {
267- const auto media = Ui::SingleMediaPreview::Create (
268- parent,
269- st,
270- gifPaused,
271- first,
272- [=](Ui::AttachActionType type) {
273- return actionAllowed ((*_items)[from], type);
274- });
267+ const auto media = way.sendImagesAsPhotos ()
268+ ? Ui::SingleMediaPreview::Create (
269+ parent,
270+ st,
271+ gifPaused,
272+ first,
273+ [=](Ui::AttachActionType type) {
274+ return actionAllowed ((*_items)[from], type);
275+ })
276+ : nullptr ;
275277 if (media) {
276278 _isSingleMedia = true ;
277279 _preview.reset (media);
@@ -633,7 +635,9 @@ void SendFilesBox::setupDragArea() {
633635 auto computeState = [=](const QMimeData *data) {
634636 using DragState = Storage::MimeDataState;
635637 const auto state = Storage::ComputeMimeDataState (data);
636- return (state == DragState::PhotoFiles || state == DragState::Image)
638+ return (state == DragState::PhotoFiles
639+ || state == DragState::Image
640+ || state == DragState::MediaFiles)
637641 ? (_sendWay.current ().sendImagesAsPhotos ()
638642 ? DragState::Image
639643 : DragState::Files)
@@ -973,11 +977,11 @@ void SendFilesBox::initSendWay() {
973977 const auto was = hidden ();
974978 updateCaptionPlaceholder ();
975979 updateEmojiPanelGeometry ();
976- for ( auto &block : _blocks) {
977- block. setSendWay (value );
978- }
979- refreshButtons ();
980- refreshPriceTag ();
980+ applyBlockChanges ();
981+ generatePreviewFrom ( 0 );
982+ _inner-> resizeToWidth (st::boxWideWidth);
983+ refreshControls ();
984+ captionResized ();
981985 if (was != hidden ()) {
982986 updateBoxSize ();
983987 updateControlsGeometry ();
@@ -1296,15 +1300,15 @@ void SendFilesBox::setupSendWayControls() {
12961300 _st.files .check );
12971301 _sendImagesAsPhotos.create (
12981302 this ,
1299- tr::lng_send_compressed (tr::now),
1300- _sendWay.current ().sendImagesAsPhotos (),
1303+ tr::lng_send_as_documents (tr::now),
1304+ ! _sendWay.current ().sendImagesAsPhotos (),
13011305 _st.files .checkbox ,
13021306 _st.files .check );
13031307
13041308 _sendWay.changes (
13051309 ) | rpl::on_next ([=](SendFilesWay value) {
13061310 _groupFiles->setChecked (value.groupFiles ());
1307- _sendImagesAsPhotos->setChecked (value.sendImagesAsPhotos ());
1311+ _sendImagesAsPhotos->setChecked (! value.sendImagesAsPhotos ());
13081312 }, lifetime ());
13091313
13101314 _groupFiles->checkedChanges (
@@ -1326,10 +1330,10 @@ void SendFilesBox::setupSendWayControls() {
13261330 _sendImagesAsPhotos->checkedChanges (
13271331 ) | rpl::on_next ([=](bool checked) {
13281332 auto sendWay = _sendWay.current ();
1329- if (sendWay.sendImagesAsPhotos () == checked) {
1333+ if (sendWay.sendImagesAsPhotos () == ! checked) {
13301334 return ;
13311335 }
1332- sendWay.setSendImagesAsPhotos (checked);
1336+ sendWay.setSendImagesAsPhotos (! checked);
13331337 if (checkWithWay (sendWay)) {
13341338 _sendWay = sendWay;
13351339 } else {
@@ -1349,9 +1353,10 @@ void SendFilesBox::setupSendWayControls() {
13491353 rpl::combine (
13501354 _groupFiles->checkedValue (),
13511355 _sendImagesAsPhotos->checkedValue ()
1352- ) | rpl::on_next ([=](bool groupFiles, bool asPhoto ) {
1356+ ) | rpl::on_next ([=](bool groupFiles, bool asDocuments ) {
13531357 _wayRemember->setVisible (
1354- (groupFiles != groupFilesFirst) || (asPhoto != asPhotosFirst));
1358+ (groupFiles != groupFilesFirst)
1359+ || ((!asDocuments) != asPhotosFirst));
13551360 captionResized ();
13561361 }, lifetime ());
13571362
@@ -1388,8 +1393,8 @@ void SendFilesBox::updateSendWayControls() {
13881393 _sendImagesAsPhotos->setVisible (
13891394 _list.hasSendImagesAsPhotosOption (onlyOne));
13901395 _sendImagesAsPhotos->setText ((_list.files .size () > 1 )
1391- ? tr::lng_send_compressed (tr::now)
1392- : tr::lng_send_compressed_one (tr::now));
1396+ ? tr::lng_send_as_documents (tr::now)
1397+ : tr::lng_send_as_documents_one (tr::now));
13931398
13941399 _hintLabel->setVisible (
13951400 _show->session ().settings ().photoEditorHintShown ()
0 commit comments