2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-01 06:55:58 +00:00

Update API scheme, new paid.

This commit is contained in:
John Preston
2025-02-18 19:50:55 +04:00
parent 852ab19760
commit 960cf7a34b
22 changed files with 302 additions and 290 deletions

View File

@@ -552,38 +552,6 @@ void UserData::setStarsPerMessage(int stars) {
}
}
int UserData::starsForMessageLocked() const {
return _starsForMessageLocked;
}
void UserData::lockStarsForMessage() {
if (_starsPerMessage == _starsForMessageLocked) {
return;
}
cancelStarsForMessage();
if (_starsPerMessage) {
_starsForMessageLocked = _starsPerMessage;
session().credits().lock(StarsAmount(_starsPerMessage));
session().changes().peerUpdated(this, UpdateFlag::StarsPerMessage);
}
}
int UserData::commitStarsForMessage() {
if (const auto stars = base::take(_starsForMessageLocked)) {
session().credits().withdrawLocked(StarsAmount(stars));
session().changes().peerUpdated(this, UpdateFlag::StarsPerMessage);
return stars;
}
return 0;
}
void UserData::cancelStarsForMessage() {
if (const auto stars = base::take(_starsForMessageLocked)) {
session().credits().unlock(StarsAmount(stars));
session().changes().peerUpdated(this, UpdateFlag::StarsPerMessage);
}
}
bool UserData::canAddContact() const {
return canShareThisContact() && !isContact();
}