MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / fillSetCount

Method fillSetCount

Telegram/SourceFiles/boxes/stickers_box.cpp:2585–2622  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2583}
2584
2585int StickersBox::Inner::fillSetCount(not_null<StickersSet*> set) const {
2586 const auto skipPremium = this->skipPremium();
2587 int result = set->stickers.isEmpty()
2588 ? set->count
2589 : set->stickers.size();
2590 if (skipPremium && !set->stickers.isEmpty()) {
2591 result -= ranges::count(
2592 set->stickers,
2593 true,
2594 &DocumentData::isPremiumSticker);
2595 }
2596 auto added = 0;
2597 if (set->id == Data::Stickers::CloudRecentSetId) {
2598 const auto &sets = session().data().stickers().sets();
2599 const auto &recent = session().data().stickers().getRecentPack();
2600 auto customIt = sets.find(Data::Stickers::CustomSetId);
2601 if (customIt != sets.cend()) {
2602 auto &custom = customIt->second->stickers;
2603 added = custom.size();
2604 if (skipPremium) {
2605 added -= ranges::count(
2606 custom,
2607 true,
2608 &DocumentData::isPremiumSticker);
2609 }
2610 for (const auto &sticker : recent) {
2611 if (skipPremium && sticker.first->isPremiumSticker()) {
2612 continue;
2613 } else if (customIt->second->stickers.indexOf(sticker.first) < 0) {
2614 ++added;
2615 }
2616 }
2617 } else {
2618 added = recent.size();
2619 }
2620 }
2621 return result + added;
2622}
2623
2624Data::StickersSetFlags StickersBox::Inner::fillSetFlags(
2625 not_null<StickersSet*> set) const {

Callers

nothing calls this directly

Calls 9

skipPremiumMethod · 0.95
isPremiumStickerMethod · 0.80
isEmptyMethod · 0.45
sizeMethod · 0.45
stickersMethod · 0.45
dataMethod · 0.45
findMethod · 0.45
cendMethod · 0.45
indexOfMethod · 0.45

Tested by

no test coverage detected