Improve group call error messages.

This commit is contained in:
John Preston 2020-12-07 17:15:34 +04:00
parent f11df0519e
commit 8b0430a255
2 changed files with 13 additions and 8 deletions

View file

@ -1851,7 +1851,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_group_call_no_members" = "No members";
"lng_group_call_members#one" = "{count} member";
"lng_group_call_members#other" = "{count} members";
"lng_group_call_no_anonymous" = "Anonymous admins can't join voice chats :(";
"lng_group_call_no_anonymous" = "Sorry, anonymous group admins can't join voice chats.";
"lng_group_call_too_many" = "Sorry, there are too many members in this voice chat. Please try again later.";
"lng_group_call_context_mute" = "Mute";
"lng_group_call_context_unmute" = "Allow to speak";
"lng_group_call_duration_days#one" = "{count} day";

View file

@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "api/api_send_progress.h"
#include "apiwrap.h"
#include "lang/lang_keys.h"
#include "lang/lang_hardcoded.h"
#include "boxes/confirm_box.h"
#include "ui/toasts/common_toasts.h"
#include "base/unixtime.h"
@ -230,14 +231,17 @@ void GroupCall::rejoin() {
maybeSendMutedUpdate(wasMuteState);
_channel->session().api().applyUpdates(updates);
}).fail([=](const RPCError &error) {
LOG(("Call Error: Could not join, error: %1"
).arg(error.type()));
const auto type = error.type();
LOG(("Call Error: Could not join, error: %1").arg(type));
hangup();
if (error.type() == u"GROUP_CALL_ANONYMOUS_FORBIDDEN"_q) {
Ui::ShowMultilineToast({
.text = tr::lng_group_call_no_anonymous(tr::now),
});
}
Ui::ShowMultilineToast({
.text = (type == u"GROUP_CALL_ANONYMOUS_FORBIDDEN"_q
? tr::lng_group_call_no_anonymous(tr::now)
: type == u"GROUPCALL_PARTICIPANTS_TOO_MUCH"_q
? tr::lng_group_call_too_many(tr::now)
: Lang::Hard::ServerError()),
});
}).send();
});
});