Show toast on invite attempt to premium required.

This commit is contained in:
John Preston
2024-01-18 12:01:03 +04:00
parent f3f660a180
commit f6a95df550
7 changed files with 193 additions and 145 deletions
@@ -267,6 +267,10 @@ void AddParticipantsBoxController::subscribeToMigration() {
}
void AddParticipantsBoxController::rowClicked(not_null<PeerListRow*> row) {
const auto premiumRequiredError = WritePremiumRequiredError;
if (RecipientRow::ShowLockedError(this, row, premiumRequiredError)) {
return;
}
const auto &serverConfig = session().serverConfig();
auto count = fullCount();
auto limit = _peer && (_peer->isChat() || _peer->isMegagroup())
@@ -332,8 +336,10 @@ std::unique_ptr<PeerListRow> AddParticipantsBoxController::createRow(
if (user->isSelf()) {
return nullptr;
}
auto result = std::make_unique<PeerListRow>(user);
if (isAlreadyIn(user)) {
const auto already = isAlreadyIn(user);
const auto maybeLockedSt = already ? nullptr : &computeListSt().item;
auto result = std::make_unique<RecipientRow>(user, maybeLockedSt);
if (already) {
result->setDisabledState(PeerListRow::State::DisabledChecked);
}
return result;
@@ -707,6 +713,8 @@ void AddSpecialBoxController::prepare() {
loadMoreRows();
}
delegate()->peerListRefreshRows();
TrackPremiumRequiredChanges(this, lifetime());
}
void AddSpecialBoxController::prepareChatRows(not_null<ChatData*> chat) {