From 90f90a4ca3865185259875e6e4f134e81377dbb5 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 4 Feb 2021 20:55:43 +0300 Subject: [PATCH] Fixed accepting of Enter key in box of voice message discarding. --- .../history/view/controls/history_view_voice_record_bar.cpp | 4 +++- .../history/view/controls/history_view_voice_record_bar.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp b/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp index 4bc2f6a01..3796889c6 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp @@ -1602,7 +1602,7 @@ void VoiceRecordBar::installListenStateFilter() { _listen->playPause(); return Result::Cancel; } - if (isEnter) { + if (isEnter && !_warningShown) { requestToSendWithOptions({}); return Result::Cancel; } @@ -1633,6 +1633,7 @@ void VoiceRecordBar::showDiscardBox( hideAnimated(); } close(); + _warningShown = false; if (callback) { callback(); } @@ -1644,6 +1645,7 @@ void VoiceRecordBar::showDiscardBox( tr::lng_record_lock_discard(tr::now), st::attentionBoxButton, std::move(sure))); + _warningShown = true; } } // namespace HistoryView::Controls diff --git a/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.h b/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.h index ff8e8cdbc..941f39af2 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.h +++ b/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.h @@ -143,6 +143,8 @@ private: Fn _startRecordingFilter; + bool _warningShown = false; + rpl::variable _recording = false; rpl::variable _inField = false; rpl::variable _lockShowing = false;