mirror of https://github.com/procxx/kepka.git
Fixed subscribeToUploader.
This commit is contained in:
parent
aaf61dfbad
commit
1ed83cf193
|
@ -4483,7 +4483,9 @@ void ApiWrap::editMedia(
|
||||||
std::move(file.information),
|
std::move(file.information),
|
||||||
type,
|
type,
|
||||||
to,
|
to,
|
||||||
caption));
|
caption,
|
||||||
|
nullptr,
|
||||||
|
true));
|
||||||
}
|
}
|
||||||
_fileLoader->addTasks(std::move(tasks));
|
_fileLoader->addTasks(std::move(tasks));
|
||||||
}
|
}
|
||||||
|
|
|
@ -4173,14 +4173,14 @@ void HistoryWidget::uploadFile(
|
||||||
Auth().api().sendFile(fileContent, type, options);
|
Auth().api().sendFile(fileContent, type, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::subscribeToUploader(bool edit) {
|
void HistoryWidget::subscribeToUploader() {
|
||||||
if (_uploaderSubscriptions) {
|
if (_uploaderSubscriptions) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
using namespace Storage;
|
using namespace Storage;
|
||||||
Auth().uploader().photoReady(
|
Auth().uploader().photoReady(
|
||||||
) | rpl::start_with_next([=](const UploadedPhoto &data) {
|
) | rpl::start_with_next([=](const UploadedPhoto &data) {
|
||||||
edit
|
data.edit
|
||||||
? photoEdited(data.fullId, data.silent, data.file)
|
? photoEdited(data.fullId, data.silent, data.file)
|
||||||
: photoUploaded(data.fullId, data.silent, data.file);
|
: photoUploaded(data.fullId, data.silent, data.file);
|
||||||
}, _uploaderSubscriptions);
|
}, _uploaderSubscriptions);
|
||||||
|
@ -4194,7 +4194,7 @@ void HistoryWidget::subscribeToUploader(bool edit) {
|
||||||
}, _uploaderSubscriptions);
|
}, _uploaderSubscriptions);
|
||||||
Auth().uploader().documentReady(
|
Auth().uploader().documentReady(
|
||||||
) | rpl::start_with_next([=](const UploadedDocument &data) {
|
) | rpl::start_with_next([=](const UploadedDocument &data) {
|
||||||
edit
|
data.edit
|
||||||
? documentEdited(data.fullId, data.silent, data.file)
|
? documentEdited(data.fullId, data.silent, data.file)
|
||||||
: documentUploaded(data.fullId, data.silent, data.file);
|
: documentUploaded(data.fullId, data.silent, data.file);
|
||||||
}, _uploaderSubscriptions);
|
}, _uploaderSubscriptions);
|
||||||
|
@ -4236,9 +4236,8 @@ void HistoryWidget::sendFileConfirmed(
|
||||||
|
|
||||||
it->msgId = newId;
|
it->msgId = newId;
|
||||||
}
|
}
|
||||||
|
subscribeToUploader();
|
||||||
subscribeToUploader(isEditing);
|
file->edit = isEditing;
|
||||||
|
|
||||||
Auth().uploader().upload(newId, file);
|
Auth().uploader().upload(newId, file);
|
||||||
|
|
||||||
const auto history = Auth().data().history(file->to.peer);
|
const auto history = Auth().data().history(file->to.peer);
|
||||||
|
|
|
@ -442,7 +442,7 @@ private:
|
||||||
MsgId replyTo,
|
MsgId replyTo,
|
||||||
std::shared_ptr<SendingAlbum> album = nullptr);
|
std::shared_ptr<SendingAlbum> album = nullptr);
|
||||||
|
|
||||||
void subscribeToUploader(bool edit = false);
|
void subscribeToUploader();
|
||||||
|
|
||||||
void photoUploaded(
|
void photoUploaded(
|
||||||
const FullMsgId &msgId,
|
const FullMsgId &msgId,
|
||||||
|
|
|
@ -1319,6 +1319,7 @@ void MainWidget::onEditMedia(
|
||||||
const std::shared_ptr<FileLoadResult> &file,
|
const std::shared_ptr<FileLoadResult> &file,
|
||||||
const FullMsgId &oldId) {
|
const FullMsgId &oldId) {
|
||||||
LOG(("ON EDIT MEDIA"));
|
LOG(("ON EDIT MEDIA"));
|
||||||
|
App::main()->setEditMedia(FullMsgId());
|
||||||
_history->sendFileConfirmed(file, oldId);
|
_history->sendFileConfirmed(file, oldId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -329,7 +329,7 @@ void Uploader::sendNext() {
|
||||||
MTP_int(uploadingData.partsCount),
|
MTP_int(uploadingData.partsCount),
|
||||||
MTP_string(photoFilename),
|
MTP_string(photoFilename),
|
||||||
MTP_bytes(md5));
|
MTP_bytes(md5));
|
||||||
_photoReady.fire({ uploadingId, silent, file });
|
_photoReady.fire({ uploadingId, silent, file, uploadingData.file->edit });
|
||||||
} else if (uploadingData.type() == SendMediaType::File
|
} else if (uploadingData.type() == SendMediaType::File
|
||||||
|| uploadingData.type() == SendMediaType::WallPaper
|
|| uploadingData.type() == SendMediaType::WallPaper
|
||||||
|| uploadingData.type() == SendMediaType::Audio) {
|
|| uploadingData.type() == SendMediaType::Audio) {
|
||||||
|
@ -364,7 +364,7 @@ void Uploader::sendNext() {
|
||||||
file,
|
file,
|
||||||
thumb });
|
thumb });
|
||||||
} else {
|
} else {
|
||||||
_documentReady.fire({ uploadingId, silent, file });
|
_documentReady.fire({ uploadingId, silent, file, uploadingData.file->edit });
|
||||||
}
|
}
|
||||||
} else if (uploadingData.type() == SendMediaType::Secure) {
|
} else if (uploadingData.type() == SendMediaType::Secure) {
|
||||||
_secureReady.fire({
|
_secureReady.fire({
|
||||||
|
|
|
@ -19,12 +19,14 @@ struct UploadedPhoto {
|
||||||
FullMsgId fullId;
|
FullMsgId fullId;
|
||||||
bool silent = false;
|
bool silent = false;
|
||||||
MTPInputFile file;
|
MTPInputFile file;
|
||||||
|
bool edit = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct UploadedDocument {
|
struct UploadedDocument {
|
||||||
FullMsgId fullId;
|
FullMsgId fullId;
|
||||||
bool silent = false;
|
bool silent = false;
|
||||||
MTPInputFile file;
|
MTPInputFile file;
|
||||||
|
bool edit = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct UploadedThumbDocument {
|
struct UploadedThumbDocument {
|
||||||
|
@ -32,6 +34,7 @@ struct UploadedThumbDocument {
|
||||||
bool silent = false;
|
bool silent = false;
|
||||||
MTPInputFile file;
|
MTPInputFile file;
|
||||||
MTPInputFile thumb;
|
MTPInputFile thumb;
|
||||||
|
bool edit = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct UploadSecureProgress {
|
struct UploadSecureProgress {
|
||||||
|
|
|
@ -528,7 +528,8 @@ FileLoadTask::FileLoadTask(
|
||||||
SendMediaType type,
|
SendMediaType type,
|
||||||
const FileLoadTo &to,
|
const FileLoadTo &to,
|
||||||
const TextWithTags &caption,
|
const TextWithTags &caption,
|
||||||
std::shared_ptr<SendingAlbum> album)
|
std::shared_ptr<SendingAlbum> album,
|
||||||
|
std::optional<bool> edit)
|
||||||
: _id(rand_value<uint64>())
|
: _id(rand_value<uint64>())
|
||||||
, _to(to)
|
, _to(to)
|
||||||
, _album(std::move(album))
|
, _album(std::move(album))
|
||||||
|
@ -536,7 +537,8 @@ FileLoadTask::FileLoadTask(
|
||||||
, _content(content)
|
, _content(content)
|
||||||
, _information(std::move(information))
|
, _information(std::move(information))
|
||||||
, _type(type)
|
, _type(type)
|
||||||
, _caption(caption) {
|
, _caption(caption)
|
||||||
|
, _edit(edit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
FileLoadTask::FileLoadTask(
|
FileLoadTask::FileLoadTask(
|
||||||
|
@ -697,6 +699,8 @@ void FileLoadTask::process() {
|
||||||
_caption,
|
_caption,
|
||||||
_album);
|
_album);
|
||||||
|
|
||||||
|
_result->edit = _edit.value_or(false);
|
||||||
|
|
||||||
QString filename, filemime;
|
QString filename, filemime;
|
||||||
qint64 filesize = 0;
|
qint64 filesize = 0;
|
||||||
QByteArray filedata;
|
QByteArray filedata;
|
||||||
|
|
|
@ -228,6 +228,8 @@ struct FileLoadResult {
|
||||||
PreparedPhotoThumbs photoThumbs;
|
PreparedPhotoThumbs photoThumbs;
|
||||||
TextWithTags caption;
|
TextWithTags caption;
|
||||||
|
|
||||||
|
bool edit = false;
|
||||||
|
|
||||||
void setFileData(const QByteArray &filedata);
|
void setFileData(const QByteArray &filedata);
|
||||||
void setThumbData(const QByteArray &thumbdata);
|
void setThumbData(const QByteArray &thumbdata);
|
||||||
|
|
||||||
|
@ -273,7 +275,8 @@ public:
|
||||||
SendMediaType type,
|
SendMediaType type,
|
||||||
const FileLoadTo &to,
|
const FileLoadTo &to,
|
||||||
const TextWithTags &caption,
|
const TextWithTags &caption,
|
||||||
std::shared_ptr<SendingAlbum> album = nullptr);
|
std::shared_ptr<SendingAlbum> album = nullptr,
|
||||||
|
std::optional<bool> edit = false);
|
||||||
FileLoadTask(
|
FileLoadTask(
|
||||||
const QByteArray &voice,
|
const QByteArray &voice,
|
||||||
int32 duration,
|
int32 duration,
|
||||||
|
@ -320,6 +323,7 @@ private:
|
||||||
VoiceWaveform _waveform;
|
VoiceWaveform _waveform;
|
||||||
SendMediaType _type;
|
SendMediaType _type;
|
||||||
TextWithTags _caption;
|
TextWithTags _caption;
|
||||||
|
std::optional<bool> _edit;
|
||||||
|
|
||||||
std::shared_ptr<FileLoadResult> _result;
|
std::shared_ptr<FileLoadResult> _result;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue