2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Name color changing for me / channels.

This commit is contained in:
John Preston
2023-10-27 17:49:37 +04:00
parent effc9873c9
commit bcdb1bdfd2
16 changed files with 952 additions and 195 deletions

View File

@@ -41,6 +41,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/text/format_values.h"
#include "ui/text/text_utilities.h"
#include "ui/text/text_utilities.h"
#include "ui/toast/toast.h"
#include "ui/widgets/checkbox.h" // Ui::RadiobuttonGroup.
#include "ui/widgets/gradient_round_button.h"
#include "ui/widgets/labels.h"
@@ -1466,6 +1467,36 @@ QString LookupPremiumRef(PremiumPreview section) {
return QString();
}
void ShowPremiumPromoToast(
std::shared_ptr<ChatHelpers::Show> show,
TextWithEntities textWithLink,
const QString &ref) {
using WeakToast = base::weak_ptr<Ui::Toast::Instance>;
const auto toast = std::make_shared<WeakToast>();
(*toast) = show->showToast({
.text = std::move(textWithLink),
.st = &st::defaultMultilineToast,
.duration = Ui::Toast::kDefaultDuration * 2,
.multiline = true,
.filter = crl::guard(&show->session(), [=](
const ClickHandlerPtr &,
Qt::MouseButton button) {
if (button == Qt::LeftButton) {
if (const auto strong = toast->get()) {
strong->hideAnimated();
(*toast) = nullptr;
if (const auto controller = show->resolveWindow(
ChatHelpers::WindowUsage::PremiumPromo)) {
Settings::ShowPremium(controller, ref);
}
return true;
}
}
return false;
}),
});
}
not_null<Ui::GradientButton*> CreateSubscribeButton(
SubscribeButtonArgs &&args) {
Expects(args.show || args.controller);