mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 23:53:58 +02:00
Added ability to send recorded voice data from ComposeControls.
This commit is contained in:
parent
ab38ddc21d
commit
024a35d770
2 changed files with 21 additions and 2 deletions
|
@ -721,12 +721,15 @@ rpl::producer<not_null<QKeyEvent*>> ComposeControls::keyEvents() const {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<Api::SendOptions> ComposeControls::sendRequests() const {
|
auto ComposeControls::sendContentRequests(SendRequestType requestType) const {
|
||||||
auto filter = rpl::filter([=] {
|
auto filter = rpl::filter([=] {
|
||||||
const auto type = (_mode == Mode::Normal)
|
const auto type = (_mode == Mode::Normal)
|
||||||
? Ui::SendButton::Type::Send
|
? Ui::SendButton::Type::Send
|
||||||
: Ui::SendButton::Type::Schedule;
|
: Ui::SendButton::Type::Schedule;
|
||||||
return (_send->type() == type);
|
const auto sendRequestType = _voiceRecordBar->isListenState()
|
||||||
|
? SendRequestType::Voice
|
||||||
|
: SendRequestType::Text;
|
||||||
|
return (_send->type() == type) && (sendRequestType == requestType);
|
||||||
});
|
});
|
||||||
auto map = rpl::map_to(Api::SendOptions());
|
auto map = rpl::map_to(Api::SendOptions());
|
||||||
auto submits = base::qt_signal_producer(
|
auto submits = base::qt_signal_producer(
|
||||||
|
@ -738,6 +741,10 @@ rpl::producer<Api::SendOptions> ComposeControls::sendRequests() const {
|
||||||
_sendCustomRequests.events());
|
_sendCustomRequests.events());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpl::producer<Api::SendOptions> ComposeControls::sendRequests() const {
|
||||||
|
return sendContentRequests(SendRequestType::Text);
|
||||||
|
}
|
||||||
|
|
||||||
rpl::producer<VoiceToSend> ComposeControls::sendVoiceRequests() const {
|
rpl::producer<VoiceToSend> ComposeControls::sendVoiceRequests() const {
|
||||||
return _voiceRecordBar->sendVoiceRequests();
|
return _voiceRecordBar->sendVoiceRequests();
|
||||||
}
|
}
|
||||||
|
@ -973,6 +980,12 @@ void ComposeControls::init() {
|
||||||
updateHeight();
|
updateHeight();
|
||||||
}, _wrap->lifetime());
|
}, _wrap->lifetime());
|
||||||
|
|
||||||
|
sendContentRequests(
|
||||||
|
SendRequestType::Voice
|
||||||
|
) | rpl::start_with_next([=](Api::SendOptions options) {
|
||||||
|
_voiceRecordBar->requestToSendWithOptions(options);
|
||||||
|
}, _wrap->lifetime());
|
||||||
|
|
||||||
{
|
{
|
||||||
const auto lastMsgId = _wrap->lifetime().make_state<FullMsgId>();
|
const auto lastMsgId = _wrap->lifetime().make_state<FullMsgId>();
|
||||||
|
|
||||||
|
|
|
@ -169,6 +169,10 @@ private:
|
||||||
Normal,
|
Normal,
|
||||||
Edit,
|
Edit,
|
||||||
};
|
};
|
||||||
|
enum class SendRequestType {
|
||||||
|
Text,
|
||||||
|
Voice,
|
||||||
|
};
|
||||||
using TextUpdateEvents = base::flags<TextUpdateEvent>;
|
using TextUpdateEvents = base::flags<TextUpdateEvent>;
|
||||||
friend inline constexpr bool is_flag_type(TextUpdateEvent) { return true; };
|
friend inline constexpr bool is_flag_type(TextUpdateEvent) { return true; };
|
||||||
|
|
||||||
|
@ -195,6 +199,8 @@ private:
|
||||||
|
|
||||||
void sendSilent();
|
void sendSilent();
|
||||||
void sendScheduled();
|
void sendScheduled();
|
||||||
|
[[nodiscard]] auto sendContentRequests(
|
||||||
|
SendRequestType requestType = SendRequestType::Text) const;
|
||||||
|
|
||||||
void orderControls();
|
void orderControls();
|
||||||
void checkAutocomplete();
|
void checkAutocomplete();
|
||||||
|
|
Loading…
Add table
Reference in a new issue