Add some error reporting about camera problems.

This commit is contained in:
John Preston 2020-08-21 16:34:37 +04:00
parent 4d2041ae48
commit 21c578cf2e
3 changed files with 32 additions and 0 deletions

View file

@ -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";

View file

@ -395,3 +395,7 @@ callTitle: WindowTitle(defaultWindowTitle) {
closeIconActiveOver: callTitleCloseIconOver;
}
callTitleShadow: icon {{ "calls_shadow_controls", windowShadowFg }};
callErrorToast: Toast(defaultToast) {
minWidth: 240px;
}

View file

@ -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());