2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

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

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