Removed sending of typing action when sticker is chose in autocomplete.

This commit is contained in:
23rd 2021-09-03 15:48:11 +03:00 committed by John Preston
parent de3b1ff9ae
commit c1d3e5f0c5
4 changed files with 22 additions and 19 deletions

View file

@ -1359,9 +1359,9 @@ void HistoryWidget::orderWidgets() {
_attachDragAreas.photo->raise();
}
void HistoryWidget::updateStickersByEmoji() {
bool HistoryWidget::updateStickersByEmoji() {
if (!_peer) {
return;
return false;
}
const auto emoji = [&] {
const auto errorForStickers = Data::RestrictionError(
@ -1379,23 +1379,24 @@ void HistoryWidget::updateStickersByEmoji() {
return EmojiPtr(nullptr);
}();
_fieldAutocomplete->showStickers(emoji);
return (emoji != nullptr);
}
void HistoryWidget::fieldChanged() {
const auto typing = (_history
&& !_inlineBot
&& !_editMsgId
&& (_textUpdateEvents & TextUpdateEvent::SendTyping));
InvokeQueued(this, [=] {
updateInlineBotQuery();
updateStickersByEmoji();
});
if (_history) {
if (!_inlineBot
&& !_editMsgId
&& (_textUpdateEvents & TextUpdateEvent::SendTyping)) {
const auto choosingSticker = updateStickersByEmoji();
if (!choosingSticker && typing) {
session().sendProgressManager().update(
_history,
Api::SendProgressType::Typing);
}
}
});
updateSendButtonType();
if (!HasSendText(_field)) {

View file

@ -154,7 +154,7 @@ public:
QRect historyRect() const;
void updateFieldPlaceholder();
void updateStickersByEmoji();
bool updateStickersByEmoji();
bool confirmSendingFiles(const QStringList &files);
bool confirmSendingFiles(not_null<const QMimeData*> data);

View file

@ -1279,9 +1279,9 @@ void ComposeControls::initAutocomplete() {
_autocomplete->hideFast();
}
void ComposeControls::updateStickersByEmoji() {
bool ComposeControls::updateStickersByEmoji() {
if (!_history) {
return;
return false;
}
const auto emoji = [&] {
const auto errorForStickers = Data::RestrictionError(
@ -1299,6 +1299,7 @@ void ComposeControls::updateStickersByEmoji() {
return EmojiPtr(nullptr);
}();
_autocomplete->showStickers(emoji);
return (emoji != nullptr);
}
void ComposeControls::updateFieldPlaceholder() {
@ -1343,11 +1344,9 @@ void ComposeControls::updateSilentBroadcast() {
}
void ComposeControls::fieldChanged() {
if (!_inlineBot
const auto typing = (!_inlineBot
&& !_header->isEditingMessage()
&& (_textUpdateEvents & TextUpdateEvent::SendTyping)) {
_sendActionUpdates.fire({ Api::SendProgressType::Typing });
}
&& (_textUpdateEvents & TextUpdateEvent::SendTyping));
updateSendButtonType();
if (!HasSendText(_field)) {
_previewState = Data::PreviewState::Allowed;
@ -1358,7 +1357,10 @@ void ComposeControls::fieldChanged() {
}
InvokeQueued(_autocomplete.get(), [=] {
updateInlineBotQuery();
updateStickersByEmoji();
const auto choosingSticker = updateStickersByEmoji();
if (!choosingSticker && typing) {
_sendActionUpdates.fire({ Api::SendProgressType::Typing });
}
});
if (!(_textUpdateEvents & TextUpdateEvent::SaveDraft)) {

View file

@ -221,7 +221,7 @@ private:
void orderControls();
void checkAutocomplete();
void updateStickersByEmoji();
bool updateStickersByEmoji();
void updateFieldPlaceholder();
void updateSilentBroadcast();
void editMessage(not_null<HistoryItem*> item);