Fixed accepting of Enter key in box of voice message discarding.

This commit is contained in:
23rd 2021-02-04 20:55:43 +03:00 committed by John Preston
parent 776c099a25
commit 90f90a4ca3
2 changed files with 5 additions and 1 deletions

View file

@ -1602,7 +1602,7 @@ void VoiceRecordBar::installListenStateFilter() {
_listen->playPause(); _listen->playPause();
return Result::Cancel; return Result::Cancel;
} }
if (isEnter) { if (isEnter && !_warningShown) {
requestToSendWithOptions({}); requestToSendWithOptions({});
return Result::Cancel; return Result::Cancel;
} }
@ -1633,6 +1633,7 @@ void VoiceRecordBar::showDiscardBox(
hideAnimated(); hideAnimated();
} }
close(); close();
_warningShown = false;
if (callback) { if (callback) {
callback(); callback();
} }
@ -1644,6 +1645,7 @@ void VoiceRecordBar::showDiscardBox(
tr::lng_record_lock_discard(tr::now), tr::lng_record_lock_discard(tr::now),
st::attentionBoxButton, st::attentionBoxButton,
std::move(sure))); std::move(sure)));
_warningShown = true;
} }
} // namespace HistoryView::Controls } // namespace HistoryView::Controls

View file

@ -143,6 +143,8 @@ private:
Fn<bool()> _startRecordingFilter; Fn<bool()> _startRecordingFilter;
bool _warningShown = false;
rpl::variable<bool> _recording = false; rpl::variable<bool> _recording = false;
rpl::variable<bool> _inField = false; rpl::variable<bool> _inField = false;
rpl::variable<bool> _lockShowing = false; rpl::variable<bool> _lockShowing = false;