Files
tdesktop/Telegram/SourceFiles/data/data_send_action.h
allhaileris afb81b8278
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
init
2026-02-16 15:50:16 +03:00

82 lines
1.9 KiB
C++

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "ui/effects/animations.h"
class History;
namespace HistoryView {
class SendActionPainter;
} // namespace HistoryView
namespace Data {
class Thread;
class SendActionManager final {
public:
struct AnimationUpdate {
not_null<Thread*> thread;
QRect rect;
bool textUpdated = false;
};
explicit SendActionManager();
void registerFor(
not_null<History*> history,
MsgId rootId,
not_null<UserData*> user,
const MTPSendMessageAction &action,
TimeId when);
[[nodiscard]] auto animationUpdated() const
-> rpl::producer<AnimationUpdate>;
void updateAnimation(AnimationUpdate &&update);
[[nodiscard]] auto speakingAnimationUpdated() const
-> rpl::producer<not_null<History*>>;
void updateSpeakingAnimation(not_null<History*> history);
using SendActionPainter = HistoryView::SendActionPainter;
[[nodiscard]] std::shared_ptr<SendActionPainter> repliesPainter(
not_null<History*> history,
MsgId rootId);
void repliesPainterRemoved(
not_null<History*> history,
MsgId rootId);
void repliesPaintersClear(
not_null<History*> history,
not_null<UserData*> user);
void clear();
private:
bool callback(crl::time now);
[[nodiscard]] SendActionPainter *lookupPainter(
not_null<History*> history,
MsgId rootId);
// When typing in this history started.
base::flat_map<
std::pair<not_null<History*>, MsgId>,
crl::time> _sendActions;
Ui::Animations::Basic _animation;
rpl::event_stream<AnimationUpdate> _animationUpdate;
rpl::event_stream<not_null<History*>> _speakingAnimationUpdate;
base::flat_map<
not_null<History*>,
base::flat_map<
MsgId,
std::weak_ptr<SendActionPainter>>> _painters;
};
} // namespace Data