mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Improve typing status sending.
This commit is contained in:
parent
53c308c24b
commit
48dad5f477
2 changed files with 29 additions and 12 deletions
|
@ -152,7 +152,14 @@ bool SendProgressManager::skipRequest(const Key &key) const {
|
|||
return true;
|
||||
}
|
||||
const auto recently = base::unixtime::now() - kSendTypingsToOfflineFor;
|
||||
return !Data::OnlineTextActive(user->onlineTill, recently);
|
||||
const auto online = user->onlineTill;
|
||||
if (online == -2) { // last seen recently
|
||||
return false;
|
||||
} else if (online < 0) {
|
||||
return (-online < recently);
|
||||
} else {
|
||||
return (online < recently);
|
||||
}
|
||||
}
|
||||
|
||||
void SendProgressManager::done(
|
||||
|
|
|
@ -39,10 +39,16 @@ namespace {
|
|||
constexpr int kRecentlyInSeconds = 20 * 3600;
|
||||
const auto kPsaBadgePrefix = "cloud_lng_badge_psa_";
|
||||
|
||||
bool ShowUserBotIcon(not_null<UserData*> user) {
|
||||
[[nodiscard]] bool ShowUserBotIcon(not_null<UserData*> user) {
|
||||
return user->isBot() && !user->isSupport() && !user->isRepliesChat();
|
||||
}
|
||||
|
||||
[[nodiscard]] bool ShowSendActionInDialogs(History *history) {
|
||||
return history
|
||||
&& (!history->peer->isUser()
|
||||
|| history->peer->asUser()->onlineTill > 0);
|
||||
}
|
||||
|
||||
void PaintRowTopRight(Painter &p, const QString &text, QRect &rectForName, bool active, bool selected) {
|
||||
const auto width = st::dialogsDateFont->width(text);
|
||||
rectForName.setWidth(rectForName.width() - width - st::dialogsDateSkip);
|
||||
|
@ -362,7 +368,8 @@ void paintRow(
|
|||
|
||||
p.setFont(st::dialogsTextFont);
|
||||
auto &color = active ? st::dialogsTextFgServiceActive : (selected ? st::dialogsTextFgServiceOver : st::dialogsTextFgService);
|
||||
if (history && !history->sendActionPainter()->paint(p, nameleft, texttop, availableWidth, fullWidth, color, ms)) {
|
||||
if (ShowSendActionInDialogs(history)
|
||||
&& !history->sendActionPainter()->paint(p, nameleft, texttop, availableWidth, fullWidth, color, ms)) {
|
||||
if (history->cloudDraftTextCache.isEmpty()) {
|
||||
auto draftWrapped = textcmdLink(1, tr::lng_dialogs_text_from_wrapped(tr::now, lt_from, tr::lng_from_draft(tr::now)));
|
||||
auto draftText = supportMode
|
||||
|
@ -389,7 +396,8 @@ void paintRow(
|
|||
|
||||
auto &color = active ? st::dialogsTextFgServiceActive : (selected ? st::dialogsTextFgServiceOver : st::dialogsTextFgService);
|
||||
p.setFont(st::dialogsTextFont);
|
||||
if (history && !history->sendActionPainter()->paint(p, nameleft, texttop, availableWidth, fullWidth, color, ms)) {
|
||||
if (ShowSendActionInDialogs(history)
|
||||
&& !history->sendActionPainter()->paint(p, nameleft, texttop, availableWidth, fullWidth, color, ms)) {
|
||||
// Empty history
|
||||
}
|
||||
} else if (!item->isEmpty()) {
|
||||
|
@ -741,14 +749,16 @@ void RowPainter::paint(
|
|||
texttop,
|
||||
availableWidth,
|
||||
st::dialogsTextFont->height);
|
||||
const auto actionWasPainted = history ? history->sendActionPainter()->paint(
|
||||
p,
|
||||
itemRect.x(),
|
||||
itemRect.y(),
|
||||
itemRect.width(),
|
||||
fullWidth,
|
||||
color,
|
||||
ms) : false;
|
||||
const auto actionWasPainted = ShowSendActionInDialogs(history)
|
||||
? history->sendActionPainter()->paint(
|
||||
p,
|
||||
itemRect.x(),
|
||||
itemRect.y(),
|
||||
itemRect.width(),
|
||||
fullWidth,
|
||||
color,
|
||||
ms)
|
||||
: false;
|
||||
if (const auto folder = row->folder()) {
|
||||
PaintListEntryText(p, itemRect, active, selected, row);
|
||||
} else if (!actionWasPainted) {
|
||||
|
|
Loading…
Add table
Reference in a new issue