diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index a9f1975b8..75cbb932c 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -1726,6 +1726,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_call_error_not_available" = "Sorry, {user} doesn't accept calls."; "lng_call_error_outdated" = "{user}'s app does not support calls. They need to update their app before you can call them."; +"lng_call_error_no_camera" = "No camera could be found. Please make sure that your camera is connected to the computer."; +"lng_call_error_camera_not_started" = "You can switch to video call once you're connected."; +"lng_call_error_camera_outdated" = "{user}'s app does not support video calls. They need to update their app."; "lng_call_error_audio_io" = "There seems to be a problem with audio playback on your computer. Please make sure that your computer's speakers and microphone are working and try again."; "lng_call_bar_hangup" = "End call"; diff --git a/Telegram/SourceFiles/calls/calls.style b/Telegram/SourceFiles/calls/calls.style index 006c31ff8..ae044b7c9 100644 --- a/Telegram/SourceFiles/calls/calls.style +++ b/Telegram/SourceFiles/calls/calls.style @@ -395,3 +395,7 @@ callTitle: WindowTitle(defaultWindowTitle) { closeIconActiveOver: callTitleCloseIconOver; } callTitleShadow: icon {{ "calls_shadow_controls", windowShadowFg }}; + +callErrorToast: Toast(defaultToast) { + minWidth: 240px; +} diff --git a/Telegram/SourceFiles/calls/calls_panel.cpp b/Telegram/SourceFiles/calls/calls_panel.cpp index cb09f917b..25bc8c6ba 100644 --- a/Telegram/SourceFiles/calls/calls_panel.cpp +++ b/Telegram/SourceFiles/calls/calls_panel.cpp @@ -27,6 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/wrap/fade_wrap.h" #include "ui/wrap/padding_wrap.h" #include "ui/platform/ui_platform_utility.h" +#include "ui/toast/toast.h" #include "ui/empty_userpic.h" #include "ui/emoji_config.h" #include "core/application.h" @@ -703,6 +704,30 @@ void Panel::reinitWithCall(Call *call) { } }, _callLifetime); + _call->errors( + ) | rpl::start_with_next([=](Error error) { + const auto text = [=] { + switch (error.type) { + case ErrorType::NoCamera: + return tr::lng_call_error_no_camera(tr::now); + case ErrorType::NotVideoCall: + return tr::lng_call_error_camera_outdated(tr::now, lt_user, _user->name); + case ErrorType::NotStartedCall: + return tr::lng_call_error_camera_not_started(tr::now); + //case ErrorType::NoMicrophone: + // return tr::lng_call_error_no_camera(tr::now); + case ErrorType::Unknown: + return Lang::Hard::CallErrorIncompatible(); + } + Unexpected("Error type in _call->errors()."); + }(); + Ui::Toast::Show(widget(), Ui::Toast::Config{ + .text = { text }, + .st = &st::callErrorToast, + .multiline = true, + }); + }, _callLifetime); + _name->setText(_user->name); updateStatusText(_call->state());