mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Show send action animations in Replies thread.
This commit is contained in:
@@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_session.h"
|
||||
#include "ui/image/image_location_factory.h"
|
||||
#include "history/history_item.h"
|
||||
#include "history/history.h"
|
||||
#include "core/mime_type.h"
|
||||
#include "main/main_session.h"
|
||||
#include "apiwrap.h"
|
||||
@@ -235,11 +236,7 @@ void Uploader::processPhotoProgress(const FullMsgId &newId) {
|
||||
const auto photo = item->media()
|
||||
? item->media()->photo()
|
||||
: nullptr;
|
||||
session->sendProgressManager().update(
|
||||
item->history(),
|
||||
Api::SendProgressType::UploadPhoto,
|
||||
0);
|
||||
session->data().requestItemRepaint(item);
|
||||
sendProgressUpdate(item, Api::SendProgressType::UploadPhoto);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,23 +251,14 @@ void Uploader::processDocumentProgress(const FullMsgId &newId) {
|
||||
const auto progress = (document && document->uploading())
|
||||
? document->uploadingData->offset
|
||||
: 0;
|
||||
|
||||
session->sendProgressManager().update(
|
||||
item->history(),
|
||||
sendAction,
|
||||
progress);
|
||||
session->data().requestItemRepaint(item);
|
||||
sendProgressUpdate(item, sendAction, progress);
|
||||
}
|
||||
}
|
||||
|
||||
void Uploader::processPhotoFailed(const FullMsgId &newId) {
|
||||
const auto session = &_api->session();
|
||||
if (const auto item = session->data().message(newId)) {
|
||||
session->sendProgressManager().update(
|
||||
item->history(),
|
||||
Api::SendProgressType::UploadPhoto,
|
||||
-1);
|
||||
session->data().requestItemRepaint(item);
|
||||
sendProgressUpdate(item, Api::SendProgressType::UploadPhoto, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,14 +270,25 @@ void Uploader::processDocumentFailed(const FullMsgId &newId) {
|
||||
const auto sendAction = (document && document->isVoiceMessage())
|
||||
? Api::SendProgressType::UploadVoice
|
||||
: Api::SendProgressType::UploadFile;
|
||||
session->sendProgressManager().update(
|
||||
item->history(),
|
||||
sendAction,
|
||||
-1);
|
||||
session->data().requestItemRepaint(item);
|
||||
sendProgressUpdate(item, sendAction, -1);
|
||||
}
|
||||
}
|
||||
|
||||
void Uploader::sendProgressUpdate(
|
||||
not_null<HistoryItem*> item,
|
||||
Api::SendProgressType type,
|
||||
int progress) {
|
||||
const auto history = item->history();
|
||||
auto &manager = _api->session().sendProgressManager();
|
||||
manager.update(history, type, progress);
|
||||
if (const auto replyTo = item->replyToTop()) {
|
||||
if (history->peer->isMegagroup()) {
|
||||
manager.update(history, replyTo, type, progress);
|
||||
}
|
||||
}
|
||||
_api->session().data().requestItemRepaint(item);
|
||||
}
|
||||
|
||||
Uploader::~Uploader() {
|
||||
clear();
|
||||
}
|
||||
|
@@ -16,6 +16,10 @@ class ApiWrap;
|
||||
struct FileLoadResult;
|
||||
struct SendMediaReady;
|
||||
|
||||
namespace Api {
|
||||
enum class SendProgressType;
|
||||
} // namespace Api
|
||||
|
||||
namespace Main {
|
||||
class Session;
|
||||
} // namespace Main
|
||||
@@ -128,7 +132,12 @@ private:
|
||||
|
||||
void currentFailed();
|
||||
|
||||
not_null<ApiWrap*> _api;
|
||||
void sendProgressUpdate(
|
||||
not_null<HistoryItem*> item,
|
||||
Api::SendProgressType type,
|
||||
int progress = 0);
|
||||
|
||||
const not_null<ApiWrap*> _api;
|
||||
base::flat_map<mtpRequestId, QByteArray> requestsSent;
|
||||
base::flat_map<mtpRequestId, int32> docRequestsSent;
|
||||
base::flat_map<mtpRequestId, int32> dcMap;
|
||||
|
Reference in New Issue
Block a user