From 5d8888bb8bd3ee0f3bdbbff8b86620d47867e9f5 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Tue, 2 Apr 2019 13:38:53 +0300 Subject: [PATCH] Refactored code. - Refactored passing message id to edit media. - Removed get/setEditMedia from mainwidget. - Combined onEditMedia and onSendFileConfirm in single method. - Added argument in FileLoadTask to pass message id to edit media. - Renamed flags in apiwrap. - Added check for allowing edit media when use clipboard. - Removed unused fileIsValidForAlbum. - Removed LOGs. - Replaced _isNotAlbum with _isAlbum. - Removed _viaRemoteContent. - Removed _newMediaPath. - Added empty() to MessageGroupId. --- Telegram/SourceFiles/apiwrap.cpp | 26 +++--- Telegram/SourceFiles/apiwrap.h | 3 +- .../SourceFiles/boxes/edit_caption_box.cpp | 81 ++++++++++--------- Telegram/SourceFiles/boxes/edit_caption_box.h | 9 ++- Telegram/SourceFiles/data/data_document.cpp | 16 ---- Telegram/SourceFiles/data/data_document.h | 1 - Telegram/SourceFiles/data/data_groups.cpp | 6 +- Telegram/SourceFiles/data/data_groups.h | 2 +- Telegram/SourceFiles/data/data_types.h | 5 +- .../SourceFiles/history/history_widget.cpp | 4 - Telegram/SourceFiles/mainwidget.cpp | 24 +----- Telegram/SourceFiles/mainwidget.h | 15 +--- .../SourceFiles/storage/localimageloader.cpp | 16 ++-- .../SourceFiles/storage/localimageloader.h | 4 +- 14 files changed, 94 insertions(+), 118 deletions(-) diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index c5c4402ee8..642d41afd6 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -4471,7 +4471,8 @@ void ApiWrap::editMedia( Storage::PreparedList &&list, SendMediaType type, TextWithTags &&caption, - const SendOptions &options) { + const SendOptions &options, + MsgId msgIdToEdit) { if (list.files.empty()) return; auto &file = list.files.front(); @@ -4484,7 +4485,7 @@ void ApiWrap::editMedia( to, caption, nullptr, - true)); + msgIdToEdit)); } void ApiWrap::sendFiles( @@ -4620,17 +4621,17 @@ void ApiWrap::editUploadedPhoto( MTPVector(), MTP_int(0)); - auto flags2 = MTPmessages_EditMessage::Flag::f_message | 0; - flags2 |= MTPmessages_EditMessage::Flag::f_no_webpage; - flags2 |= MTPmessages_EditMessage::Flag::f_entities; - flags2 |= MTPmessages_EditMessage::Flag::f_media; + auto flagsEditMsg = MTPmessages_EditMessage::Flag::f_message | 0; + flagsEditMsg |= MTPmessages_EditMessage::Flag::f_no_webpage; + flagsEditMsg |= MTPmessages_EditMessage::Flag::f_entities; + flagsEditMsg |= MTPmessages_EditMessage::Flag::f_media; auto sentEntities = TextUtilities::EntitiesToMTP( item->originalText().entities, TextUtilities::ConvertOption::SkipLocal); request(MTPmessages_EditMessage( - MTP_flags(flags2), + MTP_flags(flagsEditMsg), item->history()->peer->input, MTP_int(item->id), MTP_string(item->originalText().text), @@ -4683,18 +4684,17 @@ void ApiWrap::editUploadedDocument( MTPVector(), MTP_int(0)); - auto flags2 = MTPmessages_EditMessage::Flag::f_message | 0; - flags2 |= MTPmessages_EditMessage::Flag::f_no_webpage; - flags2 |= MTPmessages_EditMessage::Flag::f_entities; - flags2 |= MTPmessages_EditMessage::Flag::f_media; + auto flagsEditMsg = MTPmessages_EditMessage::Flag::f_message | 0; + flagsEditMsg |= MTPmessages_EditMessage::Flag::f_no_webpage; + flagsEditMsg |= MTPmessages_EditMessage::Flag::f_entities; + flagsEditMsg |= MTPmessages_EditMessage::Flag::f_media; auto sentEntities = TextUtilities::EntitiesToMTP( item->originalText().entities, TextUtilities::ConvertOption::SkipLocal); - request(MTPmessages_EditMessage( - MTP_flags(flags2), + MTP_flags(flagsEditMsg), item->history()->peer->input, MTP_int(item->id), MTP_string(item->originalText().text), diff --git a/Telegram/SourceFiles/apiwrap.h b/Telegram/SourceFiles/apiwrap.h index 46cee107b0..6c7c4e0e9d 100644 --- a/Telegram/SourceFiles/apiwrap.h +++ b/Telegram/SourceFiles/apiwrap.h @@ -332,7 +332,8 @@ public: Storage::PreparedList &&list, SendMediaType type, TextWithTags &&caption, - const SendOptions &options); + const SendOptions &options, + MsgId msgIdToEdit); void sendUploadedPhoto( FullMsgId localId, diff --git a/Telegram/SourceFiles/boxes/edit_caption_box.cpp b/Telegram/SourceFiles/boxes/edit_caption_box.cpp index fdd42ffff7..11c8dbf4be 100644 --- a/Telegram/SourceFiles/boxes/edit_caption_box.cpp +++ b/Telegram/SourceFiles/boxes/edit_caption_box.cpp @@ -24,7 +24,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/history_item.h" #include "lang/lang_keys.h" #include "layout.h" -#include "mainwidget.h" #include "media/clip/media_clip_reader.h" #include "storage/storage_media_prepare.h" #include "styles/style_boxes.h" @@ -45,8 +44,9 @@ EditCaptionBox::EditCaptionBox( , _msgId(item->fullId()) { Expects(item->media() != nullptr); Expects(item->media()->allowsEditCaption()); + _isAllowedEditMedia = item->media()->allowsEditMedia(); - _isNotAlbum = !item->groupId(); + _isAlbum = !item->groupId().empty(); QSize dimensions; auto image = (Image*)nullptr; @@ -288,9 +288,10 @@ void EditCaptionBox::updateEmojiPanelGeometry() { } void EditCaptionBox::prepareGifPreview(DocumentData* document) { + const auto newPath = getNewMediaPath(); if (_gifPreview) { return; - } else if (!document && _newMediaPath.isEmpty()) { + } else if (!document && newPath.isEmpty()) { return; } const auto callback = [=](Media::Clip::Notification notification) { @@ -301,9 +302,9 @@ void EditCaptionBox::prepareGifPreview(DocumentData* document) { document, _msgId, callback); - } else if (!_newMediaPath.isEmpty()) { + } else if (!newPath.isEmpty()) { _gifPreview = Media::Clip::MakeReader( - _newMediaPath, + newPath, callback); } if (_gifPreview) _gifPreview->setAutoplay(); @@ -339,23 +340,11 @@ void EditCaptionBox::updateEditPreview() { const auto file = &_preparedList.files.front(); const auto fileMedia = &file->information->media; - const auto fileinfo = QFileInfo(_newMediaPath); + const auto fileinfo = QFileInfo(file->path); const auto filename = fileinfo.fileName(); const auto mimeType = Core::MimeTypeForFile(fileinfo).name(); - if (!_isNotAlbum) { - // This check only for users, who chose not valid file with absolute path. - if ((!_newMediaPath.isEmpty() - && !fileIsValidForAlbum(filename, mimeType)) - // And for users, who send file via remoteContent. - || _viaRemoteContent) { - _newMediaPath = QString(); - _preparedList.files.clear(); - return; - } - } - - if (!_newMediaPath.isEmpty()) { + if (!file->path.isEmpty()) { _isImage = fileIsImage(filename, mimeType); } _isAudio = false; @@ -392,7 +381,7 @@ void EditCaptionBox::updateEditPreview() { _doc = true; } - _wayWrap->toggle(_isImage && _isNotAlbum, anim::type::instant); + _wayWrap->toggle(_isImage && !_isAlbum, anim::type::instant); if (!_doc) { _thumb = App::pixmapFromImageInPlace( @@ -411,18 +400,35 @@ void EditCaptionBox::createEditMediaButton() { if (result.paths.isEmpty() && result.remoteContent.isEmpty()) { return; } - _viaRemoteContent = !result.remoteContent.isEmpty(); + if (!result.remoteContent.isEmpty()) { - _newMediaPath = QString(); + // Don't use remoteContent to edit album item. + if (_isAlbum) { + return; + } + + auto image = Media::Clip::PrepareForSending( + QString(), + result.remoteContent + ).thumbnail; _preparedList = Storage::PrepareMediaFromImage( - Media::Clip::PrepareForSending(QString(), result.remoteContent).thumbnail, + std::move(image), std::move(result.remoteContent), st::sendMediaPreviewSize); } else if (!result.paths.isEmpty()) { - _newMediaPath = result.paths.front(); - _preparedList = Storage::PrepareMediaList( - QStringList(_newMediaPath), + auto list = Storage::PrepareMediaList( + QStringList(result.paths.front()), st::sendMediaPreviewSize); + + // Don't rewrite _preparedList if new list is not valid for album. + if (_isAlbum) { + const auto fileMedia = &list.files.front().information->media; + if (!base::get_if(fileMedia) + && !base::get_if(fileMedia)) { + return; + } + } + _preparedList = std::move(list); } else { return; } @@ -431,9 +437,9 @@ void EditCaptionBox::createEditMediaButton() { }; const auto buttonCallback = [=] { - const auto filters = _isNotAlbum - ? QStringList(FileDialog::AllFilesFilter()) - : QStringList(qsl("Image and Video Files (*.png *.jpg *.mp4)")); + const auto filters = _isAlbum + ? QStringList(qsl("Image and Video Files (*.png *.jpg *.mp4)")) + : QStringList(FileDialog::AllFilesFilter()); FileDialog::GetOpenPath( this, lang(lng_choose_file), @@ -453,7 +459,7 @@ void EditCaptionBox::prepare() { if (_isAllowedEditMedia) { createEditMediaButton(); } else { - _newMediaPath = QString(); + _preparedList.files.clear(); } addButton(langFactory(lng_cancel), [this] { closeBox(); }); @@ -465,6 +471,9 @@ void EditCaptionBox::prepare() { not_null data, Ui::InputField::MimeAction action) { if (action == Ui::InputField::MimeAction::Check) { + if (!data->hasText() && !_isAllowedEditMedia) { + return false; + } if (data->hasImage()) { const auto image = qvariant_cast(data->imageData()); if (!image.isNull()) { @@ -497,6 +506,10 @@ void EditCaptionBox::prepare() { } bool EditCaptionBox::fileFromClipboard(not_null data) { + if (!_isAllowedEditMedia) { + return false; + } + auto list = [&] { auto url = QList(); auto canAddUrl = false; @@ -527,13 +540,9 @@ bool EditCaptionBox::fileFromClipboard(not_null data) { return result; }(); _preparedList = std::move(list); - _newMediaPath = _preparedList.files.empty() - ? QString() - : _preparedList.files.front().path; if (_preparedList.files.empty()) { return false; } - _viaRemoteContent = false; updateEditPreview(); return true; } @@ -748,7 +757,6 @@ void EditCaptionBox::save() { } if (!_preparedList.files.empty()) { - App::main()->setEditMedia(item->fullId()); const auto textWithTags = _field->getTextWithAppliedMarkdown(); auto sending = TextWithEntities{ textWithTags.text, @@ -760,7 +768,8 @@ void EditCaptionBox::save() { std::move(_preparedList), (!_asFile && _isImage) ? SendMediaType::Photo : SendMediaType::File, _field->getTextWithAppliedMarkdown(), - ApiWrap::SendOptions(item->history())); + ApiWrap::SendOptions(item->history()), + item->fullId().msg); closeBox(); return; } diff --git a/Telegram/SourceFiles/boxes/edit_caption_box.h b/Telegram/SourceFiles/boxes/edit_caption_box.h index c84e38a1ff..5b03c0550d 100644 --- a/Telegram/SourceFiles/boxes/edit_caption_box.h +++ b/Telegram/SourceFiles/boxes/edit_caption_box.h @@ -72,6 +72,12 @@ private: void createEditMediaButton(); + inline QString getNewMediaPath() { + return _preparedList.files.empty() + ? QString() + : _preparedList.files.front().path; + } + not_null _controller; FullMsgId _msgId; Image *_thumbnailImage = nullptr; @@ -111,8 +117,7 @@ private: Ui::SlideWrap *_wayWrap = nullptr; QString _newMediaPath; bool _isAllowedEditMedia = false; - bool _isNotAlbum = true; - bool _viaRemoteContent = false; + bool _isAlbum = false; rpl::event_stream<> _editMediaClicks; QString _error; diff --git a/Telegram/SourceFiles/data/data_document.cpp b/Telegram/SourceFiles/data/data_document.cpp index 671a61f6cd..b1a7443f11 100644 --- a/Telegram/SourceFiles/data/data_document.cpp +++ b/Telegram/SourceFiles/data/data_document.cpp @@ -122,22 +122,6 @@ bool fileIsImage(const QString &name, const QString &mime) { return false; } -bool fileIsValidForAlbum(const QString &name, const QString &mime) { - QString lowermime = mime.toLower(), namelower = name.toLower(); - if (lowermime.startsWith(qstr("video/mp4")) - || lowermime.startsWith(qstr("image/jpeg")) - || lowermime.startsWith(qstr("image/jpg")) - || lowermime.startsWith(qstr("image/png"))) { - return true; - } else if (namelower.endsWith(qstr(".mp4")) - || namelower.endsWith(qstr(".jpg")) - || namelower.endsWith(qstr(".jpeg")) - || namelower.endsWith(qstr(".png"))) { - return true; - } - return false; -} - QString FileNameUnsafe( const QString &title, const QString &filter, diff --git a/Telegram/SourceFiles/data/data_document.h b/Telegram/SourceFiles/data/data_document.h index 4ec0afdfc5..3092ae4ee2 100644 --- a/Telegram/SourceFiles/data/data_document.h +++ b/Telegram/SourceFiles/data/data_document.h @@ -72,7 +72,6 @@ struct VoiceData : public DocumentAdditionalData { }; bool fileIsImage(const QString &name, const QString &mime); -bool fileIsValidForAlbum(const QString &name, const QString &mime); namespace Serialize { class Document; diff --git a/Telegram/SourceFiles/data/data_groups.cpp b/Telegram/SourceFiles/data/data_groups.cpp index 763b1837e1..10a43467a2 100644 --- a/Telegram/SourceFiles/data/data_groups.cpp +++ b/Telegram/SourceFiles/data/data_groups.cpp @@ -64,7 +64,9 @@ void Groups::unregisterMessage(not_null item) { } } -void Groups::refreshMessage(not_null item, bool forceRefresh) { +void Groups::refreshMessage( + not_null item, + bool justRefreshViews) { if (!isGrouped(item)) { unregisterMessage(item); return; @@ -80,7 +82,7 @@ void Groups::refreshMessage(not_null item, bool forceRefresh) { } auto &items = i->second.items; - if (forceRefresh) { + if (justRefreshViews) { refreshViews(items); return; } diff --git a/Telegram/SourceFiles/data/data_groups.h b/Telegram/SourceFiles/data/data_groups.h index 7eeed45cba..4ab230e984 100644 --- a/Telegram/SourceFiles/data/data_groups.h +++ b/Telegram/SourceFiles/data/data_groups.h @@ -27,7 +27,7 @@ public: void unregisterMessage(not_null item); void refreshMessage( not_null item, - bool forceRefresh = false); + bool justRefreshViews = false); const Group *find(not_null item) const; diff --git a/Telegram/SourceFiles/data/data_types.h b/Telegram/SourceFiles/data/data_types.h index 3be72a4b2d..bb044b91de 100644 --- a/Telegram/SourceFiles/data/data_types.h +++ b/Telegram/SourceFiles/data/data_types.h @@ -98,8 +98,11 @@ struct MessageGroupId { return static_cast(value); } + bool empty() const { + return value == None; + } explicit operator bool() const { - return value != None; + return !empty(); } Underlying raw() const { return static_cast(value); diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 35fae084a3..ec3cad58f8 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -3054,7 +3054,6 @@ void HistoryWidget::chooseAttach() { uploadFile(result.remoteContent, SendMediaType::File); } } else { - LOG((result.paths[0])); auto list = Storage::PrepareMediaList( result.paths, st::sendMediaPreviewSize); @@ -4422,7 +4421,6 @@ void HistoryWidget::documentEdited( const FullMsgId &newId, bool silent, const MTPInputFile &file) { - LOG(("DOCUMENT EDITED %1").arg(newId.msg)); Auth().api().editUploadedDocument(newId, file, std::nullopt, silent); } @@ -4430,7 +4428,6 @@ void HistoryWidget::photoEdited( const FullMsgId &newId, bool silent, const MTPInputFile &file) { - LOG(("PHOTO EDITED %1").arg(newId.msg)); Auth().api().editUploadedPhoto(newId, file, silent); } @@ -4466,7 +4463,6 @@ void HistoryWidget::documentProgress(const FullMsgId &newId) { ? document->uploadingData->offset : 0; - LOG(("ITEM EXISTS %1 TYPE: %2 PROGRESS: %3").arg(newId.msg).arg(sendAction == SendAction::Type::UploadFile).arg(progress)); updateSendAction( item->history(), sendAction, diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index fb87c2dcc3..953e0d78c5 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -842,11 +842,9 @@ void MainWidget::cancelUploadLayer(not_null item) { Ui::hideLayer(); if (const auto item = App::histItemById(itemId)) { const auto history = item->history(); - if (!item->isEditingMedia()) { - if (!IsServerMsgId(itemId.msg)) { - item->destroy(); - history->requestChatListMessage(); - } + if (!IsServerMsgId(itemId.msg)) { + item->destroy(); + history->requestChatListMessage(); } else { item->returnSavedMedia(); session().uploader().cancel(item->fullId()); @@ -1318,15 +1316,8 @@ void MainWidget::inlineResultLoadFailed(FileLoader *loader, bool started) { } void MainWidget::onSendFileConfirm( - const std::shared_ptr &file) { - _history->sendFileConfirmed(file); -} - -void MainWidget::onEditMedia( const std::shared_ptr &file, - const FullMsgId &oldId) { - LOG(("ON EDIT MEDIA")); - App::main()->setEditMedia(FullMsgId()); + const std::optional &oldId) { _history->sendFileConfirmed(file, oldId); } @@ -3721,7 +3712,6 @@ void MainWidget::updateReceived(const mtpPrime *from, const mtpPrime *end) { void MainWidget::feedUpdates(const MTPUpdates &updates, uint64 randomId) { switch (updates.type()) { case mtpc_updates: { - LOG(("TYPE 1")); auto &d = updates.c_updates(); if (d.vseq.v) { if (d.vseq.v <= updSeq) { @@ -3742,7 +3732,6 @@ void MainWidget::feedUpdates(const MTPUpdates &updates, uint64 randomId) { } break; case mtpc_updatesCombined: { - LOG(("TYPE 2")); auto &d = updates.c_updatesCombined(); if (d.vseq_start.v) { if (d.vseq_start.v <= updSeq) { @@ -3763,7 +3752,6 @@ void MainWidget::feedUpdates(const MTPUpdates &updates, uint64 randomId) { } break; case mtpc_updateShort: { - LOG(("TYPE 3")); auto &d = updates.c_updateShort(); feedUpdate(d.vupdate); @@ -3771,7 +3759,6 @@ void MainWidget::feedUpdates(const MTPUpdates &updates, uint64 randomId) { } break; case mtpc_updateShortMessage: { - LOG(("TYPE 4")); auto &d = updates.c_updateShortMessage(); if (!session().data().userLoaded(d.vuser_id.v) || (d.has_via_bot_id() && !session().data().userLoaded(d.vvia_bot_id.v)) @@ -3787,7 +3774,6 @@ void MainWidget::feedUpdates(const MTPUpdates &updates, uint64 randomId) { } break; case mtpc_updateShortChatMessage: { - LOG(("TYPE 5")); auto &d = updates.c_updateShortChatMessage(); const auto noFrom = !session().data().userLoaded(d.vfrom_id.v); const auto chat = session().data().chatLoaded(d.vchat_id.v); @@ -3809,7 +3795,6 @@ void MainWidget::feedUpdates(const MTPUpdates &updates, uint64 randomId) { } break; case mtpc_updateShortSentMessage: { - LOG(("TYPE 6")); auto &d = updates.c_updateShortSentMessage(); if (!IsServerMsgId(d.vid.v)) { LOG(("API Error: Bad msgId got from server: %1").arg(d.vid.v)); @@ -3849,7 +3834,6 @@ void MainWidget::feedUpdates(const MTPUpdates &updates, uint64 randomId) { } break; case mtpc_updatesTooLong: { - LOG(("TYPE 7")); MTP_LOG(0, ("getDifference { good - updatesTooLong received }%1").arg(cTestMode() ? " TESTMODE" : "")); return getDifference(); } break; diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index 56779469b0..5acc965f3f 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -111,13 +111,6 @@ public: void start(); - void setEditMedia(FullMsgId flag) { - _editMedia = flag; - } - FullMsgId getEditMedia() const { - return _editMedia; - } - void openPeerByName( const QString &name, MsgId msgId = ShowAtUnreadMsgId, @@ -165,9 +158,9 @@ public: QPixmap grabForShowAnimation(const Window::SectionSlideParams ¶ms); void checkMainSectionToLayer(); - void onSendFileConfirm(const std::shared_ptr &file); - void onEditMedia(const std::shared_ptr &file, - const FullMsgId &oldId); + void onSendFileConfirm( + const std::shared_ptr &file, + const std::optional &oldId); bool onSendSticker(DocumentData *sticker); void destroyData(); @@ -553,6 +546,4 @@ private: bool _firstColumnResizing = false; int _firstColumnResizingShift = 0; - FullMsgId _editMedia; - }; diff --git a/Telegram/SourceFiles/storage/localimageloader.cpp b/Telegram/SourceFiles/storage/localimageloader.cpp index 46064011ed..718248dc37 100644 --- a/Telegram/SourceFiles/storage/localimageloader.cpp +++ b/Telegram/SourceFiles/storage/localimageloader.cpp @@ -529,7 +529,7 @@ FileLoadTask::FileLoadTask( const FileLoadTo &to, const TextWithTags &caption, std::shared_ptr album, - std::optional edit) + MsgId msgIdToEdit) : _id(rand_value()) , _to(to) , _album(std::move(album)) @@ -538,7 +538,7 @@ FileLoadTask::FileLoadTask( , _information(std::move(information)) , _type(type) , _caption(caption) -, _edit(edit) { +, _msgIdToEdit(msgIdToEdit) { } FileLoadTask::FileLoadTask( @@ -704,7 +704,7 @@ void FileLoadTask::process() { _caption, _album); - _result->edit = _edit.value_or(false); + _result->edit = (_msgIdToEdit > 0); QString filename, filemime; qint64 filesize = 0; @@ -984,11 +984,13 @@ void FileLoadTask::finish() { lng_send_image_too_large(lt_name, _filepath)), LayerOption::KeepOther); removeFromAlbum(); - } else if (App::main()->getEditMedia()) { - LOG(("FINISH UPLOAD EDIT")); - App::main()->onEditMedia(_result, App::main()->getEditMedia()); } else if (App::main()) { - App::main()->onSendFileConfirm(_result); + const auto fullId = _msgIdToEdit + ? std::make_optional(FullMsgId( + peerToChannel(_to.peer), + _msgIdToEdit)) + : std::nullopt; + App::main()->onSendFileConfirm(_result, fullId); } } diff --git a/Telegram/SourceFiles/storage/localimageloader.h b/Telegram/SourceFiles/storage/localimageloader.h index 2ab8e7a126..ca6aa6d8e6 100644 --- a/Telegram/SourceFiles/storage/localimageloader.h +++ b/Telegram/SourceFiles/storage/localimageloader.h @@ -276,7 +276,7 @@ public: const FileLoadTo &to, const TextWithTags &caption, std::shared_ptr album = nullptr, - std::optional edit = false); + MsgId msgIdToEdit = 0); FileLoadTask( const QByteArray &voice, int32 duration, @@ -323,7 +323,7 @@ private: VoiceWaveform _waveform; SendMediaType _type; TextWithTags _caption; - std::optional _edit; + MsgId _msgIdToEdit; std::shared_ptr _result;