mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Send to buy premium from miniapps emoji status.
This commit is contained in:
parent
06b85442f8
commit
d0911b6a45
2 changed files with 22 additions and 1 deletions
|
@ -77,7 +77,7 @@ bool operator==(const Descriptor &a, const Descriptor &b) {
|
||||||
struct Preload {
|
struct Preload {
|
||||||
Descriptor descriptor;
|
Descriptor descriptor;
|
||||||
std::shared_ptr<Data::DocumentMedia> media;
|
std::shared_ptr<Data::DocumentMedia> media;
|
||||||
std::weak_ptr<ChatHelpers::Show> show;
|
std::weak_ptr<Main::SessionShow> show;
|
||||||
};
|
};
|
||||||
|
|
||||||
[[nodiscard]] std::vector<Preload> &Preloads() {
|
[[nodiscard]] std::vector<Preload> &Preloads() {
|
||||||
|
|
|
@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "base/timer_rpl.h"
|
#include "base/timer_rpl.h"
|
||||||
#include "base/unixtime.h"
|
#include "base/unixtime.h"
|
||||||
#include "boxes/peer_list_controllers.h"
|
#include "boxes/peer_list_controllers.h"
|
||||||
|
#include "boxes/premium_preview_box.h"
|
||||||
#include "boxes/share_box.h"
|
#include "boxes/share_box.h"
|
||||||
#include "chat_helpers/stickers_lottie.h"
|
#include "chat_helpers/stickers_lottie.h"
|
||||||
#include "chat_helpers/tabbed_panel.h"
|
#include "chat_helpers/tabbed_panel.h"
|
||||||
|
@ -514,6 +515,20 @@ std::unique_ptr<Ui::RpWidget> MakeEmojiSetStatusPreview(
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CheckEmojiStatusPremium(not_null<UserData*> bot) {
|
||||||
|
if (bot->session().premium()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const auto window = ChatHelpers::ResolveWindowDefault()(
|
||||||
|
&bot->session(),
|
||||||
|
ChatHelpers::WindowUsage::PremiumPromo);
|
||||||
|
if (window) {
|
||||||
|
ShowPremiumPreviewBox(window, PremiumFeature::EmojiStatus);
|
||||||
|
window->window().activate();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void ConfirmEmojiStatusAccessBox(
|
void ConfirmEmojiStatusAccessBox(
|
||||||
not_null<Ui::GenericBox*> box,
|
not_null<Ui::GenericBox*> box,
|
||||||
not_null<UserData*> bot,
|
not_null<UserData*> bot,
|
||||||
|
@ -554,6 +569,9 @@ void ConfirmEmojiStatusAccessBox(
|
||||||
st::botEmojiStatusText));
|
st::botEmojiStatusText));
|
||||||
|
|
||||||
box->addButton(tr::lng_bot_emoji_status_access_allow(), [=] {
|
box->addButton(tr::lng_bot_emoji_status_access_allow(), [=] {
|
||||||
|
if (!CheckEmojiStatusPremium(bot)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
*set = true;
|
*set = true;
|
||||||
box->closeBox();
|
box->closeBox();
|
||||||
done(true);
|
done(true);
|
||||||
|
@ -610,6 +628,9 @@ void ConfirmEmojiStatusBox(
|
||||||
object_ptr<Ui::RpWidget>::fromRaw(ownedSet.release()));
|
object_ptr<Ui::RpWidget>::fromRaw(ownedSet.release()));
|
||||||
|
|
||||||
box->addButton(tr::lng_bot_emoji_status_confirm(), [=] {
|
box->addButton(tr::lng_bot_emoji_status_confirm(), [=] {
|
||||||
|
if (!CheckEmojiStatusPremium(bot)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
document->owner().emojiStatuses().set(
|
document->owner().emojiStatuses().set(
|
||||||
document->id,
|
document->id,
|
||||||
duration ? (base::unixtime::now() + duration) : 0);
|
duration ? (base::unixtime::now() + duration) : 0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue