mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-30 22:25:12 +00:00
Implement full theming of attachments in stories.
This commit is contained in:
@@ -1782,6 +1782,11 @@ QString LookupPremiumRef(PremiumPreview section) {
|
||||
|
||||
not_null<Ui::GradientButton*> CreateSubscribeButton(
|
||||
SubscribeButtonArgs &&args) {
|
||||
Expects(args.show || args.controller);
|
||||
|
||||
if (!args.show && args.controller) {
|
||||
args.show = args.controller->uiShow();
|
||||
}
|
||||
const auto result = Ui::CreateChild<Ui::GradientButton>(
|
||||
args.parent.get(),
|
||||
args.gradientStops
|
||||
@@ -1789,9 +1794,14 @@ not_null<Ui::GradientButton*> CreateSubscribeButton(
|
||||
: Ui::Premium::ButtonGradientStops());
|
||||
|
||||
result->setClickedCallback([
|
||||
controller = args.controller,
|
||||
show = args.show,
|
||||
computeRef = args.computeRef,
|
||||
computeBotUrl = args.computeBotUrl] {
|
||||
const auto window = show->resolveWindow(
|
||||
ChatHelpers::WindowUsage::PremiumPromo);
|
||||
if (!window) {
|
||||
return;
|
||||
}
|
||||
const auto url = computeBotUrl ? computeBotUrl() : QString();
|
||||
if (!url.isEmpty()) {
|
||||
const auto local = Core::TryConvertUrlToLocal(url);
|
||||
@@ -1801,12 +1811,12 @@ not_null<Ui::GradientButton*> CreateSubscribeButton(
|
||||
UrlClickHandler::Open(
|
||||
local,
|
||||
QVariant::fromValue(ClickHandlerContext{
|
||||
.sessionWindow = base::make_weak(controller),
|
||||
.sessionWindow = base::make_weak(window),
|
||||
.botStartAutoSubmit = true,
|
||||
}));
|
||||
} else {
|
||||
SendScreenAccept(controller);
|
||||
StartPremiumPayment(controller, computeRef());
|
||||
SendScreenAccept(window);
|
||||
StartPremiumPayment(window, computeRef());
|
||||
}
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user