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

Added initial ability to gift premium to contacts from settings.

This commit is contained in:
23rd
2023-12-17 09:49:26 +03:00
parent 82d73e2396
commit b9b6226692
7 changed files with 254 additions and 7 deletions

View File

@@ -32,6 +32,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/buttons.h"
#include "ui/text/text_utilities.h"
#include "ui/toast/toast.h"
#include "ui/new_badges.h"
#include "ui/vertical_list.h"
#include "info/profile/info_profile_badge.h"
#include "info/profile/info_profile_emoji_status_panel.h"
@@ -60,6 +61,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/file_utilities.h"
#include "core/application.h"
#include "base/call_delayed.h"
#include "base/unixtime.h"
#include "base/platform/base_platform_info.h"
#include "styles/style_settings.h"
#include "styles/style_boxes.h"
@@ -417,6 +419,21 @@ void SetupPremium(
controller->setPremiumRef("settings");
showOther(PremiumId());
});
{
const auto button = AddButtonWithIcon(
container,
tr::lng_settings_gift_premium(),
st::settingsButton,
{ .icon = &st::menuIconGiftPremium }
);
button->addClickHandler([=] {
controller->showGiftPremiumsBox();
});
constexpr auto kNewExpiresAt = int(1735689600);
if (base::unixtime::now() < kNewExpiresAt) {
Ui::NewBadge::AddToRight(button);
}
}
Ui::AddSkip(container);
}