Show recording init errors.

This commit is contained in:
John Preston 2024-10-24 12:38:16 +04:00
parent ae89b65a98
commit b01d7ea5b9

View file

@ -1057,6 +1057,24 @@ void HistoryWidget::initVoiceRecordBar() {
_cornerButtons.updateUnreadThingsVisibility();
}, lifetime());
_voiceRecordBar->errors(
) | rpl::start_with_next([=](::Media::Capture::Error error) {
using Error = ::Media::Capture::Error;
switch (error) {
case Error::AudioInit:
case Error::AudioTimeout:
controller()->showToast(tr::lng_record_audio_problem(tr::now));
break;
case Error::VideoInit:
case Error::VideoTimeout:
controller()->showToast(tr::lng_record_video_problem(tr::now));
break;
default:
controller()->showToast(u"Unknown error."_q);
break;
}
}, lifetime());
_voiceRecordBar->updateSendButtonTypeRequests(
) | rpl::start_with_next([=] {
updateSendButtonType();