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 .customWallpaperLevel = group
? levelLimits.groupCustomWallpaperLevelMin() ? levelLimits.groupCustomWallpaperLevelMin()
: levelLimits.channelCustomWallpaperLevelMin(), : levelLimits.channelCustomWallpaperLevelMin(),
.sponsoredLevel = levelLimits.channelRestrictSponsoredLevelMin(),
}; };
} }

View file

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

View file

@ -40,6 +40,7 @@ struct BoostFeatures {
int wallpaperLevel = 0; int wallpaperLevel = 0;
int wallpapersCount = 0; int wallpapersCount = 0;
int customWallpaperLevel = 0; int customWallpaperLevel = 0;
int sponsoredLevel = 0;
}; };
struct BoostBoxData { 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 }}; boostFeatureName: icon{{ "settings/premium/features/feature_color_names", windowBgActive }};
boostFeatureStories: icon{{ "settings/premium/features/feature_stories", windowBgActive }}; boostFeatureStories: icon{{ "settings/premium/features/feature_stories", windowBgActive }};
boostFeatureTranscribe: icon{{ "settings/premium/features/feature_voice", windowBgActive }}; boostFeatureTranscribe: icon{{ "settings/premium/features/feature_voice", windowBgActive }};
boostFeatureOffSponsored: icon{{ "settings/premium/features/feature_off_sponsored", windowBgActive }};