mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 15:47:11 +02:00
Delegated responsibility for clearing listen state to sections.
This commit is contained in:
parent
b1b01385d0
commit
0a0dcb9054
7 changed files with 19 additions and 2 deletions
|
@ -797,6 +797,7 @@ void HistoryWidget::initVoiceRecordBar() {
|
|||
data.waveform,
|
||||
data.duration,
|
||||
action);
|
||||
_voiceRecordBar->clearListenState();
|
||||
}, lifetime());
|
||||
|
||||
_voiceRecordBar->lockShowStarts(
|
||||
|
|
|
@ -1018,6 +1018,10 @@ bool ComposeControls::showRecordButton() const {
|
|||
&& !isEditingMessage();
|
||||
}
|
||||
|
||||
void ComposeControls::clearListenState() {
|
||||
_voiceRecordBar->clearListenState();
|
||||
}
|
||||
|
||||
void ComposeControls::drawRestrictedWrite(Painter &p, const QString &error) {
|
||||
p.fillRect(_writeRestricted->rect(), st::historyReplyBg);
|
||||
|
||||
|
|
|
@ -152,6 +152,7 @@ public:
|
|||
void setText(const TextWithTags &text);
|
||||
void clear();
|
||||
void hidePanelsAnimated();
|
||||
void clearListenState();
|
||||
|
||||
[[nodiscard]] rpl::producer<bool> lockShowStarts() const;
|
||||
[[nodiscard]] bool isLockPresent() const;
|
||||
|
|
|
@ -1399,7 +1399,6 @@ void VoiceRecordBar::requestToSendWithOptions(Api::SendOptions options) {
|
|||
data->waveform,
|
||||
Duration(data->samples),
|
||||
options });
|
||||
hideAnimated();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1416,6 +1415,9 @@ bool VoiceRecordBar::isRecording() const {
|
|||
}
|
||||
|
||||
void VoiceRecordBar::hideAnimated() {
|
||||
if (isHidden()) {
|
||||
return;
|
||||
}
|
||||
visibilityAnimate(false, [=] { hide(); });
|
||||
}
|
||||
|
||||
|
@ -1455,6 +1457,12 @@ float64 VoiceRecordBar::activeAnimationRatio() const {
|
|||
return _activeAnimation.value(_inField.current() ? 1. : 0.);
|
||||
}
|
||||
|
||||
void VoiceRecordBar::clearListenState() {
|
||||
if (isListenState()) {
|
||||
hideAnimated();
|
||||
}
|
||||
}
|
||||
|
||||
float64 VoiceRecordBar::showAnimationRatio() const {
|
||||
// There is no reason to set the final value to zero,
|
||||
// because at zero this widget is hidden.
|
||||
|
|
|
@ -49,7 +49,9 @@ public:
|
|||
|
||||
void startRecording();
|
||||
void finishAnimating();
|
||||
void hideAnimated();
|
||||
void hideFast();
|
||||
void clearListenState();
|
||||
|
||||
void orderControls();
|
||||
|
||||
|
@ -102,7 +104,6 @@ private:
|
|||
bool isTypeRecord() const;
|
||||
bool hasDuration() const;
|
||||
|
||||
void hideAnimated();
|
||||
void finish();
|
||||
|
||||
void activeAnimate(bool active);
|
||||
|
|
|
@ -890,6 +890,7 @@ void RepliesWidget::sendVoice(ComposeControls::VoiceToSend &&data) {
|
|||
std::move(action));
|
||||
|
||||
_composeControls->cancelReplyMessage();
|
||||
_composeControls->clearListenState();
|
||||
finishSending();
|
||||
}
|
||||
|
||||
|
|
|
@ -573,6 +573,7 @@ void ScheduledWidget::sendVoice(
|
|||
auto action = Api::SendAction(_history);
|
||||
action.options = options;
|
||||
session().api().sendVoiceMessage(bytes, waveform, duration, action);
|
||||
_composeControls->clearListenState();
|
||||
}
|
||||
|
||||
void ScheduledWidget::edit(
|
||||
|
|
Loading…
Add table
Reference in a new issue