Removed simultaneous voice recording.

This commit is contained in:
23rd 2022-06-08 11:59:06 +03:00
parent 7bf9db8644
commit 176f3ea15c
5 changed files with 17 additions and 1 deletions

View File

@ -4351,6 +4351,7 @@ bool HistoryWidget::isSearching() const {
bool HistoryWidget::showRecordButton() const {
return Media::Capture::instance()->available()
&& !_voiceRecordBar->isListenState()
&& !_voiceRecordBar->isRecordingByAnotherBar()
&& !HasSendText(_field)
&& !readyToForward()
&& !_editMsgId;

View File

@ -1333,6 +1333,7 @@ void ComposeControls::orderControls() {
bool ComposeControls::showRecordButton() const {
return ::Media::Capture::instance()->available()
&& !_voiceRecordBar->isListenState()
&& !_voiceRecordBar->isRecordingByAnotherBar()
&& !HasSendText(_field)
//&& !readyToForward()
&& !isEditingMessage();

View File

@ -1541,7 +1541,13 @@ rpl::producer<not_null<QEvent*>> VoiceRecordBar::lockViewportEvents() const {
}
rpl::producer<> VoiceRecordBar::updateSendButtonTypeRequests() const {
return _listenChanges.events();
return rpl::merge(
::Media::Capture::instance()->startedChanges(
) | rpl::filter([=] {
// Perhaps a voice is recording from another place.
return !isActive();
}) | rpl::to_empty,
_listenChanges.events());
}
rpl::producer<> VoiceRecordBar::recordingTipRequests() const {
@ -1560,6 +1566,10 @@ bool VoiceRecordBar::isTypeRecord() const {
return (_send->type() == Ui::SendButton::Type::Record);
}
bool VoiceRecordBar::isRecordingByAnotherBar() const {
return !isRecording() && ::Media::Capture::instance()->started();
}
bool VoiceRecordBar::hasDuration() const {
return _recordingSamples > 0;
}

View File

@ -79,6 +79,7 @@ public:
[[nodiscard]] bool isLockPresent() const;
[[nodiscard]] bool isListenState() const;
[[nodiscard]] bool isActive() const;
[[nodiscard]] bool isRecordingByAnotherBar() const;
private:
enum class StopType {

View File

@ -42,6 +42,9 @@ public:
return _updates.events();
}
[[nodiscard]] bool started() const {
return _started.current();
}
[[nodiscard]] rpl::producer<bool> startedChanges() const {
return _started.changes();
}