2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Handle GiftCode links, show Gift Link box.

This commit is contained in:
John Preston
2023-09-28 22:44:22 +04:00
parent 3fc9ed0ccb
commit 744c1b925e
15 changed files with 715 additions and 57 deletions

View File

@@ -60,8 +60,8 @@ const style::InfoTopBar &TopBarStyle(Wrap wrap) {
[[nodiscard]] bool HasCustomTopBar(not_null<const Controller*> controller) {
const auto section = controller->section();
return (section.type() == Section::Type::Settings
&& (section.settingsType() == ::Settings::PremiumId()));
return (section.type() == Section::Type::Settings)
&& section.settingsType()->hasCustomTopBar();
}
} // namespace
@@ -788,8 +788,8 @@ void WrapWidget::showNewContent(
newController->takeStepData(_controller.get());
}
auto newContent = object_ptr<ContentWidget>(nullptr);
const auto enableBackButton = hasBackButton();
const auto createInAdvance = needAnimation || enableBackButton;
const auto withBackButton = willHaveBackButton(params);
const auto createInAdvance = needAnimation || withBackButton;
if (createInAdvance) {
newContent = createContent(memento, newController.get());
}
@@ -823,7 +823,7 @@ void WrapWidget::showNewContent(
_historyStack.clear();
}
if (enableBackButton) {
if (withBackButton) {
newContent->enableBackButton();
}
@@ -969,6 +969,17 @@ bool WrapWidget::hasBackButton() const {
return (wrap() == Wrap::Narrow || hasStackHistory());
}
bool WrapWidget::willHaveBackButton(
const Window::SectionShow &params) const {
using Way = Window::SectionShow::Way;
const auto willSaveToStack = (_content != nullptr)
&& (params.way == Way::Forward);
const auto willClearStack = (params.way == Way::ClearStack);
const auto willHaveStack = !willClearStack
&& (hasStackHistory() || willSaveToStack);
return (wrap() == Wrap::Narrow) || willHaveStack;
}
WrapWidget::~WrapWidget() = default;
} // namespace Info