diff --git a/Telegram/SourceFiles/boxes/send_files_box.cpp b/Telegram/SourceFiles/boxes/send_files_box.cpp index 298f31ffb..adb7e5d72 100644 --- a/Telegram/SourceFiles/boxes/send_files_box.cpp +++ b/Telegram/SourceFiles/boxes/send_files_box.cpp @@ -1329,6 +1329,7 @@ SendFilesBox::SendFilesBox( Storage::PreparedList &&list, CompressConfirm compressed) : _list(std::move(list)) +, _compressConfirmInitial(compressed) , _compressConfirm(compressed) { } @@ -1434,15 +1435,7 @@ void SendFilesBox::prepare() { } void SendFilesBox::initSendWay() { - _albumVideosCount = _list.albumIsPossible - ? ranges::count( - _list.files, - Storage::PreparedFile::AlbumType::Video, - [](const Storage::PreparedFile &file) { return file.type; }) - : 0; - _albumPhotosCount = _list.albumIsPossible - ? (_list.files.size() - _albumVideosCount) - : 0; + refreshAlbumMediaCount(); const auto value = [&] { if (_compressConfirm == CompressConfirm::None) { return SendFilesWay::Files; @@ -1475,6 +1468,18 @@ void SendFilesBox::initSendWay() { }); } +void SendFilesBox::refreshAlbumMediaCount() { + _albumVideosCount = _list.albumIsPossible + ? ranges::count( + _list.files, + Storage::PreparedFile::AlbumType::Video, + [](const Storage::PreparedFile &file) { return file.type; }) + : 0; + _albumPhotosCount = _list.albumIsPossible + ? (_list.files.size() - _albumVideosCount) + : 0; +} + void SendFilesBox::preparePreview() { if (_list.files.size() == 1) { prepareSingleFilePreview(); @@ -1636,6 +1641,9 @@ bool SendFilesBox::addFiles(not_null data) { return false; } else if (_list.files.size() > 1 && !_albumPreview) { return false; + } else if (_list.files.front().type + == Storage::PreparedFile::AlbumType::None) { + return false; } applyAlbumOrder(); delete base::take(_preview); @@ -1646,6 +1654,9 @@ bool SendFilesBox::addFiles(not_null data) { _sendWay->setValue(SendFilesWay::Album); } _list.mergeToEnd(std::move(list)); + + _compressConfirm = _compressConfirmInitial; + refreshAlbumMediaCount(); preparePreview(); updateControlsGeometry(); return true; diff --git a/Telegram/SourceFiles/boxes/send_files_box.h b/Telegram/SourceFiles/boxes/send_files_box.h index a7d5c01f8..67609b1a3 100644 --- a/Telegram/SourceFiles/boxes/send_files_box.h +++ b/Telegram/SourceFiles/boxes/send_files_box.h @@ -83,6 +83,7 @@ private: not_null wrap, not_null content); + void refreshAlbumMediaCount(); void preparePreview(); void prepareSingleFilePreview(); void prepareAlbumPreview(); @@ -103,6 +104,7 @@ private: Storage::PreparedList _list; + CompressConfirm _compressConfirmInitial = CompressConfirm::None; CompressConfirm _compressConfirm = CompressConfirm::None; base::lambda