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

View file

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

View file

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

View file

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