mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-27 02:51:12 +00:00
Added support of min boost level for channel ads to feature list.
This commit is contained in:
parent
66d6b461f3
commit
b377c02ad3
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 |
@ -459,6 +459,7 @@ Ui::BoostFeatures LookupBoostFeatures(not_null<ChannelData*> channel) {
|
||||
.customWallpaperLevel = group
|
||||
? levelLimits.groupCustomWallpaperLevelMin()
|
||||
: levelLimits.channelCustomWallpaperLevelMin(),
|
||||
.sponsoredLevel = levelLimits.channelRestrictSponsoredLevelMin(),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -40,6 +40,7 @@ struct BoostFeatures {
|
||||
int wallpaperLevel = 0;
|
||||
int wallpapersCount = 0;
|
||||
int customWallpaperLevel = 0;
|
||||
int sponsoredLevel = 0;
|
||||
};
|
||||
|
||||
struct BoostBoxData {
|
||||
|
@ -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 }};
|
||||
|
Loading…
Reference in New Issue
Block a user