Added support of min boost level for channel ads to feature list.

This commit is contained in:
23rd 2024-07-04 10:07:18 +03:00 committed by John Preston
parent 66d6b461f3
commit b377c02ad3
7 changed files with 12 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 771 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -459,6 +459,7 @@ Ui::BoostFeatures LookupBoostFeatures(not_null<ChannelData*> channel) {
.customWallpaperLevel = group
? levelLimits.groupCustomWallpaperLevelMin()
: levelLimits.channelCustomWallpaperLevelMin(),
.sponsoredLevel = levelLimits.channelRestrictSponsoredLevelMin(),
};
}

View File

@ -175,7 +175,7 @@ void AddFeaturesList(
st::boostFeatureIconPosition);
};
const auto proj = &Ui::Text::RichLangValue;
const auto max = std::max({
const auto lowMax = std::max({
features.linkLogoLevel,
features.transcribeLevel,
features.emojiPackLevel,
@ -189,9 +189,13 @@ void AddFeaturesList(
? 0
: features.linkStylesByLevel.back().first),
});
const auto highMax = std::max(lowMax, features.sponsoredLevel);
auto nameColors = 0;
auto linkStyles = 0;
for (auto i = std::max(startFromLevel, 1); i <= max; ++i) {
for (auto i = std::max(startFromLevel, 1); i <= highMax; ++i) {
if ((i > lowMax) && (i < highMax)) {
continue;
}
const auto unlocks = (i == startFromLevel);
container->add(
MakeFeaturesBadge(
@ -202,6 +206,9 @@ void AddFeaturesList(
lt_count,
rpl::single(float64(i)))),
st::boostLevelBadgePadding);
if (i >= features.sponsoredLevel) {
add(tr::lng_channel_earn_off(proj), st::boostFeatureOffSponsored);
}
if (i >= features.customWallpaperLevel) {
add(
(group

View File

@ -40,6 +40,7 @@ struct BoostFeatures {
int wallpaperLevel = 0;
int wallpapersCount = 0;
int customWallpaperLevel = 0;
int sponsoredLevel = 0;
};
struct BoostBoxData {

View File

@ -364,3 +364,4 @@ boostFeatureLink: icon{{ "settings/premium/features/feature_links", windowBgActi
boostFeatureName: icon{{ "settings/premium/features/feature_color_names", windowBgActive }};
boostFeatureStories: icon{{ "settings/premium/features/feature_stories", windowBgActive }};
boostFeatureTranscribe: icon{{ "settings/premium/features/feature_voice", windowBgActive }};
boostFeatureOffSponsored: icon{{ "settings/premium/features/feature_off_sponsored", windowBgActive }};