Simple promo box for Telegram Business.
After Width: | Height: | Size: 741 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 748 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2 KiB |
After Width: | Height: | Size: 873 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 784 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 564 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 562 B |
After Width: | Height: | Size: 940 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 760 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 751 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2 KiB |
|
@ -55,7 +55,6 @@ namespace {
|
|||
ChatLinks::ChatLinks(not_null<ApiWrap*> api) : _api(api) {
|
||||
}
|
||||
|
||||
|
||||
void ChatLinks::create(
|
||||
const QString &title,
|
||||
const TextWithEntities &message,
|
||||
|
|
|
@ -1210,11 +1210,13 @@ void DecorateListPromoBox(
|
|||
box->closeBox();
|
||||
});
|
||||
|
||||
Data::AmPremiumValue(
|
||||
session
|
||||
) | rpl::skip(1) | rpl::start_with_next([=] {
|
||||
box->closeBox();
|
||||
}, box->lifetime());
|
||||
if (!descriptor.hideSubscriptionButton) {
|
||||
Data::AmPremiumValue(
|
||||
session
|
||||
) | rpl::skip(1) | rpl::start_with_next([=] {
|
||||
box->closeBox();
|
||||
}, box->lifetime());
|
||||
}
|
||||
|
||||
if (const auto &hidden = descriptor.hiddenCallback) {
|
||||
box->boxClosing() | rpl::start_with_next(hidden, box->lifetime());
|
||||
|
@ -1274,11 +1276,10 @@ void Show(
|
|||
}));
|
||||
return;
|
||||
} else if (descriptor.section == PremiumFeature::Business) {
|
||||
const auto window = show->resolveWindow(
|
||||
ChatHelpers::WindowUsage::PremiumPromo);
|
||||
if (window) {
|
||||
Settings::ShowBusiness(window);
|
||||
}
|
||||
show->showBox(Box([=](not_null<Ui::GenericBox*> box) {
|
||||
TelegramBusinessPreviewBox(box, &show->session());
|
||||
DecorateListPromoBox(box, show, descriptor);
|
||||
}));
|
||||
return;
|
||||
}
|
||||
auto &list = Preloads();
|
||||
|
@ -1576,6 +1577,75 @@ void UpgradedStoriesPreviewBox(
|
|||
tr::lng_premium_stories_about_mobile());
|
||||
}
|
||||
|
||||
void TelegramBusinessPreviewBox(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
not_null<Main::Session*> session) {
|
||||
using namespace Ui::Text;
|
||||
|
||||
box->setTitle(tr::lng_business_title());
|
||||
|
||||
auto entries = std::vector<Ui::Premium::ListEntry>();
|
||||
const auto push = [&](
|
||||
tr::phrase<> title,
|
||||
tr::phrase<> description,
|
||||
const style::icon &icon) {
|
||||
entries.push_back({
|
||||
.title = title(),
|
||||
.about = description(WithEntities),
|
||||
.icon = &icon,
|
||||
});
|
||||
};
|
||||
for (const auto feature : Settings::BusinessFeaturesOrder(session)) {
|
||||
switch (feature) {
|
||||
case PremiumFeature::GreetingMessage: push(
|
||||
tr::lng_business_subtitle_greeting_messages,
|
||||
tr::lng_business_about_greeting_messages,
|
||||
st::settingsBusinessPromoGreeting);
|
||||
break;
|
||||
case PremiumFeature::AwayMessage: push(
|
||||
tr::lng_business_subtitle_away_messages,
|
||||
tr::lng_business_about_away_messages,
|
||||
st::settingsBusinessPromoAway);
|
||||
break;
|
||||
case PremiumFeature::QuickReplies: push(
|
||||
tr::lng_business_subtitle_quick_replies,
|
||||
tr::lng_business_about_quick_replies,
|
||||
st::settingsBusinessPromoReplies);
|
||||
break;
|
||||
case PremiumFeature::BusinessHours: push(
|
||||
tr::lng_business_subtitle_opening_hours,
|
||||
tr::lng_business_about_opening_hours,
|
||||
st::settingsBusinessPromoHours);
|
||||
break;
|
||||
case PremiumFeature::BusinessLocation: push(
|
||||
tr::lng_business_subtitle_location,
|
||||
tr::lng_business_about_location,
|
||||
st::settingsBusinessPromoLocation);
|
||||
break;
|
||||
case PremiumFeature::BusinessBots: push(
|
||||
tr::lng_business_subtitle_chatbots,
|
||||
tr::lng_business_about_chatbots,
|
||||
st::settingsBusinessPromoChatbots);
|
||||
break;
|
||||
case PremiumFeature::ChatIntro: push(
|
||||
tr::lng_business_subtitle_chat_intro,
|
||||
tr::lng_business_about_chat_intro,
|
||||
st::settingsBusinessPromoChatIntro);
|
||||
break;
|
||||
case PremiumFeature::ChatLinks: push(
|
||||
tr::lng_business_subtitle_chat_links,
|
||||
tr::lng_business_about_chat_links,
|
||||
st::settingsBusinessPromoChatLinks);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Ui::Premium::ShowListBox(
|
||||
box,
|
||||
st::defaultPremiumLimits,
|
||||
std::move(entries));
|
||||
}
|
||||
|
||||
object_ptr<Ui::GradientButton> CreateUnlockButton(
|
||||
QWidget *parent,
|
||||
rpl::producer<QString> text) {
|
||||
|
|
|
@ -45,6 +45,10 @@ void UpgradedStoriesPreviewBox(
|
|||
not_null<Ui::GenericBox*> box,
|
||||
not_null<Main::Session*> session);
|
||||
|
||||
void TelegramBusinessPreviewBox(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
not_null<Main::Session*> session);
|
||||
|
||||
enum class PremiumFeature {
|
||||
// Premium features.
|
||||
Stories,
|
||||
|
|
|
@ -113,6 +113,15 @@ settingsBusinessIconChatbots: icon {{ "settings/premium/business/business_chatbo
|
|||
settingsBusinessIconChatIntro: icon {{ "settings/premium/business/business_intro", settingsIconFg }};
|
||||
settingsBusinessIconChatLinks: icon {{ "settings/premium/business/business_links", settingsIconFg }};
|
||||
|
||||
settingsBusinessPromoLocation: icon {{ "settings/premium/promo/business_location", premiumButtonBg1 }};
|
||||
settingsBusinessPromoHours: icon {{ "settings/premium/promo/business_hours", premiumButtonBg1 }};
|
||||
settingsBusinessPromoReplies: icon {{ "settings/premium/promo/business_quickreply", premiumButtonBg1 }};
|
||||
settingsBusinessPromoGreeting: icon {{ "settings/premium/promo/business_greeting", premiumButtonBg1 }};
|
||||
settingsBusinessPromoAway: icon {{ "settings/premium/promo/business_away", premiumButtonBg1 }};
|
||||
settingsBusinessPromoChatbots: icon {{ "settings/premium/promo/business_chatbot", premiumButtonBg1 }};
|
||||
settingsBusinessPromoChatIntro: icon {{ "settings/premium/promo/business_intro", premiumButtonBg1 }};
|
||||
settingsBusinessPromoChatLinks: icon {{ "settings/premium/promo/business_chatlink", premiumButtonBg1 }};
|
||||
|
||||
settingsPremiumNewBadge: FlatLabel(defaultFlatLabel) {
|
||||
style: TextStyle(semiboldTextStyle) {
|
||||
font: font(10px semibold);
|
||||
|
|