/* This file is part of Telegram Desktop, the official desktop application for the Telegram messaging service. For license and copyright information please follow this link: https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once #include "boxes/star_gift_cover_box.h" #include "data/data_star_gift.h" namespace Api { class PremiumGiftCodeOptions; } // namespace Api namespace ChatHelpers { class Show; } // namespace ChatHelpers namespace Data { struct UniqueGift; struct GiftCode; struct CreditsHistoryEntry; class SavedStarGiftId; struct GiftAuctionState; } // namespace Data namespace Info::PeerGifts { struct GiftDescriptor; } // namespace Info::PeerGifts namespace Main { class Session; class SessionShow; } // namespace Main namespace Payments { enum class CheckoutResult; } // namespace Payments namespace MTP { class Error; } // namespace MTP namespace Settings { struct GiftWearBoxStyleOverride; struct CreditsEntryBoxStyleOverrides; } // namespace Settings namespace Window { class SessionController; } // namespace Window namespace Ui::Text { class CustomEmoji; } // namespace Ui::Text namespace Ui { class RpWidget; class PopupMenu; class GenericBox; class Show; class VerticalLayout; void ChooseStarGiftRecipient( not_null controller); void ShowStarGiftBox( not_null controller, not_null peer); void AddWearGiftCover( not_null container, const Data::UniqueGift &data, not_null peer); void AttachGiftSenderBadge( not_null box, std::shared_ptr show, not_null from, const QDateTime &date, bool crafted); void ShowUniqueGiftWearBox( std::shared_ptr show, not_null peer, const Data::UniqueGift &gift, Settings::GiftWearBoxStyleOverride st); void PreloadUniqueGiftResellPrices(not_null session); void UpdateGiftSellPrice( std::shared_ptr show, std::shared_ptr unique, Data::SavedStarGiftId savedId, CreditsAmount price); void ShowUniqueGiftSellBox( std::shared_ptr show, std::shared_ptr unique, Data::SavedStarGiftId savedId, Settings::GiftWearBoxStyleOverride st); void ShowOfferBuyBox( std::shared_ptr show, std::shared_ptr unique); struct StarGiftUpgradeArgs { not_null controller; Data::StarGift stargift; Fn ready; Fn upgraded; not_null peer; Data::SavedStarGiftId savedId; QString giftPrepayUpgradeHash; int cost = 0; bool canAddSender = false; bool canAddComment = false; bool canAddMyComment = false; bool addDetailsDefault = false; }; void ShowStarGiftUpgradeBox(StarGiftUpgradeArgs &&args); void SubmitStarsForm( std::shared_ptr show, MTPInputInvoice invoice, uint64 formId, uint64 price, Fn done); void SubmitTonForm( std::shared_ptr show, MTPInputInvoice invoice, uint64 formId, CreditsAmount ton, Fn done); void RequestOurForm( std::shared_ptr show, MTPInputInvoice invoice, Fn failure)> done); void RequestStarsFormAndSubmit( std::shared_ptr show, MTPInputInvoice invoice, Fn done); void ShowGiftTransferredToast( std::shared_ptr show, not_null to, const Data::UniqueGift &gift); [[nodiscard]] bool ShowGiftErrorToast( std::shared_ptr show, const MTP::Error &error); [[nodiscard]] CreditsAmount StarsFromTon( not_null session, CreditsAmount ton); [[nodiscard]] CreditsAmount TonFromStars( not_null session, CreditsAmount stars); struct GiftsDescriptor { std::vector list; std::shared_ptr api; }; enum class GiftsListMode { Send, Craft, CraftResale, }; struct GiftsListArgs { not_null window; GiftsListMode mode = GiftsListMode::Send; not_null peer; rpl::producer gifts; std::vector> selected; Fn loadMore; Fn handler; }; [[nodiscard]] object_ptr MakeGiftsList(GiftsListArgs &&args); void SendGiftBox( not_null box, not_null window, not_null peer, std::shared_ptr api, const Info::PeerGifts::GiftDescriptor &descriptor, rpl::producer auctionState); [[nodiscard]] Data::CreditsHistoryEntry EntryForUpgradedGift( const std::shared_ptr &gift, uint64 nextToUpgradeStickerId = 0, Fn nextToUpgradeShow = nullptr, Fn craftAnother = nullptr); [[nodiscard]] std::shared_ptr FindUniqueGift( not_null session, const MTPUpdates &updates); } // namespace Ui