mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 22:27:20 +02:00
Fixed draft applying while recording voice message in HistoryWidget.
Relevant commit: d15a5c9bdc
.
This commit is contained in:
parent
1b624d67b8
commit
de20ff05eb
3 changed files with 14 additions and 1 deletions
|
@ -820,6 +820,13 @@ void HistoryWidget::initVoiceRecordBar() {
|
|||
_scroll->viewportEvent(e);
|
||||
}, lifetime());
|
||||
|
||||
_voiceRecordBar->shownValue(
|
||||
) | rpl::start_with_next([=](bool shown) {
|
||||
if (!shown) {
|
||||
applyDraft();
|
||||
}
|
||||
}, lifetime());
|
||||
|
||||
_voiceRecordBar->hideFast();
|
||||
}
|
||||
|
||||
|
@ -1621,7 +1628,8 @@ void HistoryWidget::applyDraft(FieldHistoryAction fieldHistoryAction) {
|
|||
: _history->localEditDraft()
|
||||
? _history->localEditDraft()
|
||||
: _history->localDraft();
|
||||
auto fieldAvailable = canWriteMessage();
|
||||
auto fieldAvailable = canWriteMessage()
|
||||
&& !_voiceRecordBar->preventDraftApply();
|
||||
if (!draft || (!_history->localEditDraft() && !fieldAvailable)) {
|
||||
auto fieldWillBeHiddenAfterEdit = (!fieldAvailable && _editMsgId != 0);
|
||||
clearFieldText(0, fieldHistoryAction);
|
||||
|
|
|
@ -1414,6 +1414,10 @@ bool VoiceRecordBar::isRecording() const {
|
|||
return _recording.current();
|
||||
}
|
||||
|
||||
bool VoiceRecordBar::preventDraftApply() const {
|
||||
return isRecording() || isListenState();
|
||||
}
|
||||
|
||||
void VoiceRecordBar::hideAnimated() {
|
||||
if (isHidden()) {
|
||||
return;
|
||||
|
|
|
@ -72,6 +72,7 @@ public:
|
|||
[[nodiscard]] bool isRecording() const;
|
||||
[[nodiscard]] bool isLockPresent() const;
|
||||
[[nodiscard]] bool isListenState() const;
|
||||
[[nodiscard]] bool preventDraftApply() const;
|
||||
|
||||
private:
|
||||
enum class StopType {
|
||||
|
|
Loading…
Add table
Reference in a new issue