Disabled drag'n'drop area when user is recording voice message.

This commit is contained in:
23rd 2020-10-12 14:45:48 +03:00 committed by John Preston
parent ad4bf9b5c8
commit 57eb4f8234
5 changed files with 9 additions and 4 deletions

View File

@ -368,7 +368,7 @@ HistoryWidget::HistoryWidget(
_attachDragAreas = DragArea::SetupDragAreaToContainer(
this,
crl::guard(this, [=](not_null<const QMimeData*> d) {
return _history && _canSendMessages;
return _history && _canSendMessages && !isRecording();
}),
crl::guard(this, [=](bool f) { _field->setAcceptDrops(f); }),
crl::guard(this, [=] { updateControlsGeometry(); }));

View File

@ -580,7 +580,7 @@ int ComposeControls::heightCurrent() const {
}
bool ComposeControls::focus() {
if (_voiceRecordBar->isRecording()) {
if (isRecording()) {
return false;
}
_field->setFocus();
@ -1345,4 +1345,8 @@ rpl::producer<bool> ComposeControls::lockShowStarts() const {
return _voiceRecordBar->lockShowStarts();
}
bool ComposeControls::isRecording() const {
return _voiceRecordBar->isRecording();
}
} // namespace HistoryView

View File

@ -137,6 +137,7 @@ public:
[[nodiscard]] rpl::producer<bool> lockShowStarts() const;
[[nodiscard]] bool isLockPresent() const;
[[nodiscard]] bool isRecording() const;
private:
enum class TextUpdateEvent {

View File

@ -1761,7 +1761,7 @@ void RepliesWidget::clearSelected() {
void RepliesWidget::setupDragArea() {
const auto areas = DragArea::SetupDragAreaToContainer(
this,
[=](not_null<const QMimeData*> d) { return _history; },
[=](auto d) { return _history && !_composeControls->isRecording(); },
nullptr,
[=] { updateControlsGeometry(); });

View File

@ -1188,7 +1188,7 @@ void ScheduledWidget::clearSelected() {
void ScheduledWidget::setupDragArea() {
const auto areas = DragArea::SetupDragAreaToContainer(
this,
[=](not_null<const QMimeData*> d) { return _history; },
[=](auto d) { return _history && !_composeControls->isRecording(); },
nullptr,
[=] { updateControlsGeometry(); });