mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
feat: show toast
This commit is contained in:
parent
ddf74e5f78
commit
e796011deb
4 changed files with 45 additions and 9 deletions
|
@ -6399,6 +6399,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"ayu_ContextCopyCallbackData" = "Copy Callback Data";
|
"ayu_ContextCopyCallbackData" = "Copy Callback Data";
|
||||||
"ayu_RegisterURLScheme" = "Register URL Scheme";
|
"ayu_RegisterURLScheme" = "Register URL Scheme";
|
||||||
"ayu_LocalPremiumNotice" = "You're using **local** Telegram Premium.\nIt **won't** give you any benefits.\n**Enjoy the star near your nickname!**";
|
"ayu_LocalPremiumNotice" = "You're using **local** Telegram Premium.\nIt **won't** give you any benefits.\n**Enjoy the star near your nickname!**";
|
||||||
|
"ayu_DeveloperPopup" = "**{item}** is a member of the **exteraGram** development team.";
|
||||||
|
"ayu_SupporterPopup" = "**{item}** supported the development of **exteraGram** or **AyuGram** and received an exclusive badge.";
|
||||||
"ayu_SettingsWatermark" = "AyuGram developed and maintained by Radolyn Labs.";
|
"ayu_SettingsWatermark" = "AyuGram developed and maintained by Radolyn Labs.";
|
||||||
"ayu_ConfirmationSticker" = "Do you want to send this sticker?";
|
"ayu_ConfirmationSticker" = "Do you want to send this sticker?";
|
||||||
"ayu_ConfirmationGIF" = "Do you want to send this GIF?";
|
"ayu_ConfirmationGIF" = "Do you want to send this GIF?";
|
||||||
|
|
|
@ -61,3 +61,11 @@ topBarRecentActions: IconButton {
|
||||||
color: windowBgOver;
|
color: windowBgOver;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exteraBadgeToast: Toast(defaultToast) {
|
||||||
|
minWidth: msgMinWidth;
|
||||||
|
maxWidth: 480px;
|
||||||
|
padding: margins(54px, 13px, 19px, 12px);
|
||||||
|
icon: icon {{ "ayu/extera_badge", toastFg }};
|
||||||
|
iconPosition: point(13px, 13px);
|
||||||
|
}
|
||||||
|
|
|
@ -45,7 +45,9 @@ namespace {
|
||||||
|
|
||||||
[[nodiscard]] bool HasPremiumClick(const Badge::Content &content) {
|
[[nodiscard]] bool HasPremiumClick(const Badge::Content &content) {
|
||||||
return content.badge == BadgeType::Premium
|
return content.badge == BadgeType::Premium
|
||||||
|| (content.badge == BadgeType::Verified && content.emojiStatusId);
|
|| (content.badge == BadgeType::Verified && content.emojiStatusId)
|
||||||
|
|| (content.badge == BadgeType::Extera)
|
||||||
|
|| (content.badge == BadgeType::ExteraSupporter);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -48,6 +48,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
// AyuGram includes
|
// AyuGram includes
|
||||||
#include "ayu/utils/telegram_helpers.h"
|
#include "ayu/utils/telegram_helpers.h"
|
||||||
|
#include "styles/style_ayu_styles.h"
|
||||||
|
#include "ui/toast/toast.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Info::Profile {
|
namespace Info::Profile {
|
||||||
|
@ -411,9 +413,38 @@ Cover::Cover(
|
||||||
::Settings::ShowEmojiStatusPremium(_controller, _peer);
|
::Settings::ShowEmojiStatusPremium(_controller, _peer);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (_peer->isUser()) {
|
||||||
|
_exteraBadge->setPremiumClickCallback([=]
|
||||||
|
{
|
||||||
|
TextWithEntities text;
|
||||||
|
if (isExteraPeer(getBareID(_peer))) {
|
||||||
|
text = tr::ayu_DeveloperPopup(
|
||||||
|
tr::now,
|
||||||
|
lt_item,
|
||||||
|
TextWithEntities{_peer->name()},
|
||||||
|
Ui::Text::RichLangValue);
|
||||||
|
} else if (isSupporterPeer(getBareID(_peer))) {
|
||||||
|
text = tr::ayu_SupporterPopup(
|
||||||
|
tr::now,
|
||||||
|
lt_item,
|
||||||
|
TextWithEntities{_peer->name()},
|
||||||
|
Ui::Text::RichLangValue);
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ui::Toast::Show({
|
||||||
|
.text = text,
|
||||||
|
.st = &st::exteraBadgeToast,
|
||||||
|
.adaptive = true,
|
||||||
|
.duration = 3 * crl::time(1000),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
rpl::merge(
|
rpl::merge(
|
||||||
_verify->updated(),
|
_verify->updated(),
|
||||||
_badge->updated()
|
_badge->updated(),
|
||||||
|
_exteraBadge->updated()
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
refreshNameGeometry(width());
|
refreshNameGeometry(width());
|
||||||
}, _name->lifetime());
|
}, _name->lifetime());
|
||||||
|
@ -426,13 +457,6 @@ Cover::Cover(
|
||||||
_exteraBadge->setContent(Info::Profile::Badge::Content{BadgeType::None});
|
_exteraBadge->setContent(Info::Profile::Badge::Content{BadgeType::None});
|
||||||
}
|
}
|
||||||
|
|
||||||
_exteraBadge->updated() | rpl::start_with_next(
|
|
||||||
[=]
|
|
||||||
{
|
|
||||||
refreshNameGeometry(width());
|
|
||||||
},
|
|
||||||
_name->lifetime());
|
|
||||||
|
|
||||||
initViewers(std::move(title));
|
initViewers(std::move(title));
|
||||||
setupChildGeometry();
|
setupChildGeometry();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue