mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +02:00
Handle all types of confcall invite responses.
This commit is contained in:
parent
e5f31dbe8e
commit
8ab1a7268b
4 changed files with 75 additions and 18 deletions
|
@ -4812,6 +4812,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_group_call_context_unpin_screen" = "Unpin screencast";
|
"lng_group_call_context_unpin_screen" = "Unpin screencast";
|
||||||
"lng_group_call_context_remove" = "Remove";
|
"lng_group_call_context_remove" = "Remove";
|
||||||
"lng_group_call_context_cancel_invite" = "Cancel invitation";
|
"lng_group_call_context_cancel_invite" = "Cancel invitation";
|
||||||
|
"lng_group_call_context_stop_ringing" = "Stop calling";
|
||||||
|
"lng_group_call_context_ban_from_call" = "Ban from call";
|
||||||
"lng_group_call_remove_channel" = "Remove {channel} from the video chat and ban them?";
|
"lng_group_call_remove_channel" = "Remove {channel} from the video chat and ban them?";
|
||||||
"lng_group_call_remove_channel_from_channel" = "Remove {channel} from the live stream?";
|
"lng_group_call_remove_channel_from_channel" = "Remove {channel} from the live stream?";
|
||||||
"lng_group_call_mac_access" = "Telegram Desktop does not have access to system wide keyboard input required for Push to Talk.";
|
"lng_group_call_mac_access" = "Telegram Desktop does not have access to system wide keyboard input required for Push to Talk.";
|
||||||
|
@ -4940,12 +4942,21 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_confcall_link_or" = "or";
|
"lng_confcall_link_or" = "or";
|
||||||
"lng_confcall_link_join" = "Be the first to join the call and add people from there. {link}";
|
"lng_confcall_link_join" = "Be the first to join the call and add people from there. {link}";
|
||||||
"lng_confcall_link_join_link" = "Open call {arrow}";
|
"lng_confcall_link_join_link" = "Open call {arrow}";
|
||||||
"lng_confcall_invite_done_user" = "You invited {user} to join the call.";
|
"lng_confcall_invite_done_user" = "You're calling {user} to join.";
|
||||||
"lng_confcall_invite_done_many#one" = "You invited **{count} person** to join the call.";
|
"lng_confcall_invite_done_many#one" = "You're calling **{count} person** to join.";
|
||||||
"lng_confcall_invite_done_many#other" = "You invited **{count} people** to join the call.";
|
"lng_confcall_invite_done_many#other" = "You're calling **{count} people** to join.";
|
||||||
"lng_confcall_invite_fail_user" = "You cannot call {user} because of their privacy settings.";
|
"lng_confcall_invite_already_user" = "{user} is already in the call.";
|
||||||
"lng_confcall_invite_fail_many#one" = "You cannot call **{count} person** because of their privacy settings.";
|
"lng_confcall_invite_already_many#one" = "**{count} person** is already in the call.";
|
||||||
"lng_confcall_invite_fail_many#other" = "You cannot call **{count} people** because of their privacy settings.";
|
"lng_confcall_invite_already_many#other" = "**{count} people** are already in the call.";
|
||||||
|
"lng_confcall_invite_privacy_user" = "You cannot call {user} because of their privacy settings.";
|
||||||
|
"lng_confcall_invite_privacy_many#one" = "You cannot call **{count} person** because of their privacy settings.";
|
||||||
|
"lng_confcall_invite_privacy_many#other" = "You cannot call **{count} people** because of their privacy settings.";
|
||||||
|
"lng_confcall_invite_fail_user" = "Couldn't call {user} to join.";
|
||||||
|
"lng_confcall_invite_fail_many#one" = "Couldn't call **{count} person** to join.";
|
||||||
|
"lng_confcall_invite_fail_many#other" = "Couldn't call **{count} people** to join.";
|
||||||
|
"lng_confcall_invite_kicked_user" = "{user} was removed from the call.";
|
||||||
|
"lng_confcall_invite_kicked_many#one" = "**{count} person** was removed from the call.";
|
||||||
|
"lng_confcall_invite_kicked_many#other" = "**{count} people** were removed from the call.";
|
||||||
|
|
||||||
"lng_no_mic_permission" = "Telegram needs microphone access so that you can make calls and record voice messages.";
|
"lng_no_mic_permission" = "Telegram needs microphone access so that you can make calls and record voice messages.";
|
||||||
|
|
||||||
|
|
|
@ -3819,8 +3819,12 @@ void GroupCall::inviteUsers(
|
||||||
state->result.privacyRestricted.push_back(user);
|
state->result.privacyRestricted.push_back(user);
|
||||||
} else if (type == u"USER_ALREADY_PARTICIPANT"_q) {
|
} else if (type == u"USER_ALREADY_PARTICIPANT"_q) {
|
||||||
state->result.alreadyIn.push_back(user);
|
state->result.alreadyIn.push_back(user);
|
||||||
|
} else if (type == u"USER_WAS_KICKED"_q) {
|
||||||
|
state->result.kicked.push_back(user);
|
||||||
} else if (type == u"GROUPCALL_FORBIDDEN"_q) {
|
} else if (type == u"GROUPCALL_FORBIDDEN"_q) {
|
||||||
startRejoin();
|
startRejoin();
|
||||||
|
} else {
|
||||||
|
state->result.failed.push_back(user);
|
||||||
}
|
}
|
||||||
finishRequest();
|
finishRequest();
|
||||||
}).send();
|
}).send();
|
||||||
|
@ -3989,37 +3993,83 @@ void GroupCall::destroyScreencast() {
|
||||||
TextWithEntities ComposeInviteResultToast(
|
TextWithEntities ComposeInviteResultToast(
|
||||||
const InviteResult &result) {
|
const InviteResult &result) {
|
||||||
auto text = TextWithEntities();
|
auto text = TextWithEntities();
|
||||||
|
const auto append = [&](TextWithEntities part) {
|
||||||
|
if (!text.empty()) {
|
||||||
|
text.append(u"\n\n"_q);
|
||||||
|
}
|
||||||
|
text.append(part);
|
||||||
|
};
|
||||||
|
|
||||||
const auto invited = int(result.invited.size());
|
const auto invited = int(result.invited.size());
|
||||||
|
const auto already = int(result.alreadyIn.size());
|
||||||
const auto restricted = int(result.privacyRestricted.size());
|
const auto restricted = int(result.privacyRestricted.size());
|
||||||
|
const auto kicked = int(result.kicked.size());
|
||||||
|
const auto failed = int(result.failed.size());
|
||||||
if (invited == 1) {
|
if (invited == 1) {
|
||||||
text.append(tr::lng_confcall_invite_done_user(
|
append(tr::lng_confcall_invite_done_user(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_user,
|
lt_user,
|
||||||
Ui::Text::Bold(result.invited.front()->shortName()),
|
Ui::Text::Bold(result.invited.front()->shortName()),
|
||||||
Ui::Text::RichLangValue));
|
Ui::Text::RichLangValue));
|
||||||
} else if (invited > 1) {
|
} else if (invited > 1) {
|
||||||
text.append(tr::lng_confcall_invite_done_many(
|
append(tr::lng_confcall_invite_done_many(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_count,
|
lt_count,
|
||||||
invited,
|
invited,
|
||||||
Ui::Text::RichLangValue));
|
Ui::Text::RichLangValue));
|
||||||
}
|
}
|
||||||
if (invited && restricted) {
|
if (already == 1) {
|
||||||
text.append(u"\n\n"_q);
|
append(tr::lng_confcall_invite_already_user(
|
||||||
|
tr::now,
|
||||||
|
lt_user,
|
||||||
|
Ui::Text::Bold(result.alreadyIn.front()->shortName()),
|
||||||
|
Ui::Text::RichLangValue));
|
||||||
|
} else if (already > 1) {
|
||||||
|
append(tr::lng_confcall_invite_already_many(
|
||||||
|
tr::now,
|
||||||
|
lt_count,
|
||||||
|
already,
|
||||||
|
Ui::Text::RichLangValue));
|
||||||
}
|
}
|
||||||
if (restricted == 1) {
|
if (restricted == 1) {
|
||||||
text.append(tr::lng_confcall_invite_fail_user(
|
append(tr::lng_confcall_invite_fail_user(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_user,
|
lt_user,
|
||||||
Ui::Text::Bold(result.privacyRestricted.front()->shortName()),
|
Ui::Text::Bold(result.privacyRestricted.front()->shortName()),
|
||||||
Ui::Text::RichLangValue));
|
Ui::Text::RichLangValue));
|
||||||
} else if (restricted > 1) {
|
} else if (restricted > 1) {
|
||||||
text.append(tr::lng_confcall_invite_fail_many(
|
append(tr::lng_confcall_invite_fail_many(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_count,
|
lt_count,
|
||||||
restricted,
|
restricted,
|
||||||
Ui::Text::RichLangValue));
|
Ui::Text::RichLangValue));
|
||||||
}
|
}
|
||||||
|
if (kicked == 1) {
|
||||||
|
append(tr::lng_confcall_invite_kicked_user(
|
||||||
|
tr::now,
|
||||||
|
lt_user,
|
||||||
|
Ui::Text::Bold(result.kicked.front()->shortName()),
|
||||||
|
Ui::Text::RichLangValue));
|
||||||
|
} else if (kicked > 1) {
|
||||||
|
append(tr::lng_confcall_invite_kicked_many(
|
||||||
|
tr::now,
|
||||||
|
lt_count,
|
||||||
|
kicked,
|
||||||
|
Ui::Text::RichLangValue));
|
||||||
|
}
|
||||||
|
if (failed == 1) {
|
||||||
|
append(tr::lng_confcall_invite_fail_user(
|
||||||
|
tr::now,
|
||||||
|
lt_user,
|
||||||
|
Ui::Text::Bold(result.failed.front()->shortName()),
|
||||||
|
Ui::Text::RichLangValue));
|
||||||
|
} else if (failed > 1) {
|
||||||
|
append(tr::lng_confcall_invite_fail_many(
|
||||||
|
tr::now,
|
||||||
|
lt_count,
|
||||||
|
failed,
|
||||||
|
Ui::Text::RichLangValue));
|
||||||
|
}
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,8 @@ struct InviteResult {
|
||||||
std::vector<not_null<UserData*>> invited;
|
std::vector<not_null<UserData*>> invited;
|
||||||
std::vector<not_null<UserData*>> alreadyIn;
|
std::vector<not_null<UserData*>> alreadyIn;
|
||||||
std::vector<not_null<UserData*>> privacyRestricted;
|
std::vector<not_null<UserData*>> privacyRestricted;
|
||||||
|
std::vector<not_null<UserData*>> kicked;
|
||||||
|
std::vector<not_null<UserData*>> failed;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct StartConferenceInfo {
|
struct StartConferenceInfo {
|
||||||
|
|
|
@ -511,10 +511,6 @@ object_ptr<Ui::BoxContent> PrepareInviteBox(
|
||||||
}
|
}
|
||||||
const auto done = [=](InviteResult result) {
|
const auto done = [=](InviteResult result) {
|
||||||
(*close)();
|
(*close)();
|
||||||
if (result.invited.empty()
|
|
||||||
&& result.privacyRestricted.empty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
showToast({ ComposeInviteResultToast(result) });
|
showToast({ ComposeInviteResultToast(result) });
|
||||||
};
|
};
|
||||||
call->inviteUsers(
|
call->inviteUsers(
|
||||||
|
@ -566,8 +562,6 @@ object_ptr<Ui::BoxContent> PrepareInviteBox(
|
||||||
lt_count,
|
lt_count,
|
||||||
result.invited.size(),
|
result.invited.size(),
|
||||||
Ui::Text::RichLangValue));
|
Ui::Text::RichLangValue));
|
||||||
} else {
|
|
||||||
Unexpected("Result in GroupCall::inviteUsers.");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue