| 2583 | } |
| 2584 | |
| 2585 | int 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 | |
| 2624 | Data::StickersSetFlags StickersBox::Inner::fillSetFlags( |
| 2625 | not_null<StickersSet*> set) const { |
nothing calls this directly
no test coverage detected