2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Moved cancelUploadLayer from MainWidget to SessionController.

This commit is contained in:
23rd
2021-06-18 09:39:10 +03:00
parent 23c54896e5
commit 7c02d67665
8 changed files with 38 additions and 37 deletions

View File

@@ -68,7 +68,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lang/lang_keys.h"
#include "lang/lang_cloud_manager.h"
#include "boxes/add_contact_box.h"
#include "storage/file_upload.h"
#include "mainwindow.h"
#include "inline_bots/inline_bot_layout_item.h"
#include "boxes/confirm_box.h"
@@ -750,36 +749,6 @@ void MainWidget::showSendPathsLayer() {
}
}
void MainWidget::cancelUploadLayer(not_null<HistoryItem*> item) {
const auto itemId = item->fullId();
session().uploader().pause(itemId);
const auto stopUpload = [=] {
Ui::hideLayer();
auto &data = session().data();
if (const auto item = data.message(itemId)) {
if (!item->isEditingMedia()) {
const auto history = item->history();
item->destroy();
history->requestChatListMessage();
} else {
item->returnSavedMedia();
session().uploader().cancel(item->fullId());
}
data.sendHistoryChangeNotifications();
}
session().uploader().unpause();
};
const auto continueUpload = [=] {
session().uploader().unpause();
};
Ui::show(Box<ConfirmBox>(
tr::lng_selected_cancel_sure_this(tr::now),
tr::lng_selected_upload_stop(tr::now),
tr::lng_continue(tr::now),
stopUpload,
continueUpload));
}
void MainWidget::deletePhotoLayer(PhotoData *photo) {
if (!photo) return;
Ui::show(Box<ConfirmBox>(tr::lng_delete_photo_sure(tr::now), tr::lng_box_delete(tr::now), crl::guard(this, [=] {