Periodically reload owned star amount.

This commit is contained in:
levlam 2024-08-16 15:32:47 +03:00
parent 1c41488452
commit 86afb5b0f3
3 changed files with 7 additions and 2 deletions

View File

@ -845,6 +845,10 @@ void StarManager::reload_star_transaction(DialogId dialog_id, const string &tran
td_->create_handler<GetStarsTransactionsQuery>(std::move(query_promise))->send(dialog_id, transaction_id, is_refund);
}
void StarManager::reload_owned_star_count() {
do_get_star_transactions(td_->dialog_manager_->get_my_dialog_id(), string(), string(), 1, nullptr, Auto());
}
void StarManager::on_update_stars_revenue_status(
telegram_api::object_ptr<telegram_api::updateStarsRevenueStatus> &&update) {
DialogId dialog_id(update->peer_);

View File

@ -60,6 +60,8 @@ class StarManager final : public Actor {
void reload_star_transaction(DialogId dialog_id, const string &transaction_id, bool is_refund,
Promise<Unit> &&promise);
void reload_owned_star_count();
void on_update_stars_revenue_status(telegram_api::object_ptr<telegram_api::updateStarsRevenueStatus> &&update);
FileSourceId get_star_transaction_file_source_id(DialogId dialog_id, const string &transaction_id, bool is_refund);

View File

@ -2274,12 +2274,11 @@ void UpdatesManager::try_reload_data() {
td_->quick_reply_manager_->reload_quick_reply_shortcuts();
td_->reaction_manager_->reload_reactions();
td_->reaction_manager_->reload_message_effects();
for (int32 type = 0; type < MAX_REACTION_LIST_TYPE; type++) {
auto reaction_list_type = static_cast<ReactionListType>(type);
td_->reaction_manager_->reload_reaction_list(reaction_list_type, "try_reload_data");
}
td_->star_manager_->reload_owned_star_count();
for (int32 type = 0; type < MAX_STICKER_TYPE; type++) {
auto sticker_type = static_cast<StickerType>(type);
td_->stickers_manager_->get_installed_sticker_sets(sticker_type, Auto());