mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 23:53:58 +02:00
Replaced Notify::replyMarkupUpdated with Data::MessageUpdate.
This commit is contained in:
parent
6507007086
commit
b629e0c43a
9 changed files with 20 additions and 29 deletions
|
@ -133,8 +133,9 @@ struct MessageUpdate {
|
|||
DialogRowRepaint = (1 << 2),
|
||||
DialogRowRefresh = (1 << 3),
|
||||
CallAdded = (1 << 4),
|
||||
ReplyMarkup = (1 << 5),
|
||||
|
||||
LastUsedBit = (1 << 4),
|
||||
LastUsedBit = (1 << 5),
|
||||
};
|
||||
using Flags = base::flags<Flag>;
|
||||
friend inline constexpr auto is_flag_type(Flag) { return true; }
|
||||
|
|
|
@ -289,12 +289,6 @@ bool skipPaintEvent(QWidget *widget, QPaintEvent *event) {
|
|||
|
||||
namespace Notify {
|
||||
|
||||
void replyMarkupUpdated(not_null<const HistoryItem*> item) {
|
||||
if (const auto m = CheckMainWidget(&item->history()->session())) {
|
||||
m->notify_replyMarkupUpdated(item);
|
||||
}
|
||||
}
|
||||
|
||||
void inlineKeyboardMoved(
|
||||
not_null<const HistoryItem*> item,
|
||||
int oldKeyboardTop,
|
||||
|
|
|
@ -76,7 +76,6 @@ enum ClipStopperType {
|
|||
|
||||
namespace Notify {
|
||||
|
||||
void replyMarkupUpdated(not_null<const HistoryItem*> item);
|
||||
void inlineKeyboardMoved(
|
||||
not_null<const HistoryItem*> item,
|
||||
int oldKeyboardTop,
|
||||
|
|
|
@ -485,7 +485,7 @@ void HistoryItem::setRealId(MsgId newId) {
|
|||
}
|
||||
_history->owner().notifyItemIdChange({ this, oldId });
|
||||
|
||||
// We don't call Notify::replyMarkupUpdated(this) and update keyboard
|
||||
// We don't fire MessageUpdate::Flag::ReplyMarkup and update keyboard
|
||||
// in history widget, because it can't exist for an outgoing message.
|
||||
// Only inline keyboards can be in outgoing messages.
|
||||
if (const auto markup = inlineReplyMarkup()) {
|
||||
|
|
|
@ -41,7 +41,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_channel.h"
|
||||
#include "data/data_user.h"
|
||||
#include "data/data_histories.h"
|
||||
#include "facades.h" // Notify::replyMarkupUpdated
|
||||
#include "app.h"
|
||||
#include "styles/style_dialogs.h"
|
||||
#include "styles/style_widgets.h"
|
||||
|
@ -1279,14 +1278,19 @@ void HistoryMessage::checkIsolatedEmoji() {
|
|||
}
|
||||
|
||||
void HistoryMessage::setReplyMarkup(const MTPReplyMarkup *markup) {
|
||||
const auto requestUpdate = [&] {
|
||||
history()->owner().requestItemResize(this);
|
||||
history()->session().changes().messageUpdated(
|
||||
this,
|
||||
Data::MessageUpdate::Flag::ReplyMarkup);
|
||||
};
|
||||
if (!markup) {
|
||||
if (_flags & MTPDmessage::Flag::f_reply_markup) {
|
||||
_flags &= ~MTPDmessage::Flag::f_reply_markup;
|
||||
if (Has<HistoryMessageReplyMarkup>()) {
|
||||
RemoveComponents(HistoryMessageReplyMarkup::Bit());
|
||||
}
|
||||
history()->owner().requestItemResize(this);
|
||||
Notify::replyMarkupUpdated(this);
|
||||
requestUpdate();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1304,8 +1308,7 @@ void HistoryMessage::setReplyMarkup(const MTPReplyMarkup *markup) {
|
|||
changed = true;
|
||||
}
|
||||
if (changed) {
|
||||
history()->owner().requestItemResize(this);
|
||||
Notify::replyMarkupUpdated(this);
|
||||
requestUpdate();
|
||||
}
|
||||
} else {
|
||||
if (!(_flags & MTPDmessage::Flag::f_reply_markup)) {
|
||||
|
@ -1315,8 +1318,7 @@ void HistoryMessage::setReplyMarkup(const MTPReplyMarkup *markup) {
|
|||
AddComponents(HistoryMessageReplyMarkup::Bit());
|
||||
}
|
||||
Get<HistoryMessageReplyMarkup>()->create(*markup);
|
||||
history()->owner().requestItemResize(this);
|
||||
Notify::replyMarkupUpdated(this);
|
||||
requestUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -602,6 +602,14 @@ HistoryWidget::HistoryWidget(
|
|||
itemEdited(update.item);
|
||||
}, lifetime());
|
||||
|
||||
session().changes().messageUpdates(
|
||||
Data::MessageUpdate::Flag::ReplyMarkup
|
||||
) | rpl::start_with_next([=](const Data::MessageUpdate &update) {
|
||||
if (_keyboard->forMsgId() == update.item->fullId()) {
|
||||
updateBotKeyboard(update.item->history(), true);
|
||||
}
|
||||
}, lifetime());
|
||||
|
||||
subscribe(Media::Player::instance()->switchToNextNotifier(), [this](const Media::Player::Instance::Switch &pair) {
|
||||
if (pair.from.type() == AudioMsgId::Type::Voice) {
|
||||
scrollToCurrentVoiceMessage(pair.from.contextId(), pair.to);
|
||||
|
@ -1516,12 +1524,6 @@ void HistoryWidget::onRecordUpdate(quint16 level, qint32 samples) {
|
|||
}
|
||||
}
|
||||
|
||||
void HistoryWidget::notify_replyMarkupUpdated(not_null<const HistoryItem*> item) {
|
||||
if (_keyboard->forMsgId() == item->fullId()) {
|
||||
updateBotKeyboard(item->history(), true);
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryWidget::notify_inlineKeyboardMoved(not_null<const HistoryItem*> item, int oldKeyboardTop, int newKeyboardTop) {
|
||||
if (_history == item->history() || _migrated == item->history()) {
|
||||
if (const auto move = _list->moveScrollFollowingInlineKeyboard(item, oldKeyboardTop, newKeyboardTop)) {
|
||||
|
|
|
@ -275,8 +275,6 @@ public:
|
|||
|
||||
PeerData *ui_getPeerForMouseAction();
|
||||
|
||||
void notify_inlineBotRequesting(bool requesting);
|
||||
void notify_replyMarkupUpdated(not_null<const HistoryItem*> item);
|
||||
void notify_inlineKeyboardMoved(not_null<const HistoryItem*> item, int oldKeyboardTop, int newKeyboardTop);
|
||||
bool notify_switchInlineBotButtonReceived(const QString &query, UserData *samePeerBot, MsgId samePeerReplyTo);
|
||||
|
||||
|
|
|
@ -604,10 +604,6 @@ void MainWidget::onFilesOrForwardDrop(
|
|||
}
|
||||
}
|
||||
|
||||
void MainWidget::notify_replyMarkupUpdated(not_null<const HistoryItem*> item) {
|
||||
_history->notify_replyMarkupUpdated(item);
|
||||
}
|
||||
|
||||
void MainWidget::notify_inlineKeyboardMoved(not_null<const HistoryItem*> item, int oldKeyboardTop, int newKeyboardTop) {
|
||||
_history->notify_inlineKeyboardMoved(item, oldKeyboardTop, newKeyboardTop);
|
||||
}
|
||||
|
|
|
@ -230,7 +230,6 @@ public:
|
|||
MsgId msgId);
|
||||
PeerData *ui_getPeerForMouseAction();
|
||||
|
||||
void notify_replyMarkupUpdated(not_null<const HistoryItem*> item);
|
||||
void notify_inlineKeyboardMoved(not_null<const HistoryItem*> item, int oldKeyboardTop, int newKeyboardTop);
|
||||
bool notify_switchInlineBotButtonReceived(const QString &query, UserData *samePeerBot, MsgId samePeerReplyTo);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue