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

Show toast on forward attempt to premium required.

This commit is contained in:
John Preston
2024-01-17 15:05:44 +04:00
parent 7c468052e6
commit eda7118df9
12 changed files with 428 additions and 64 deletions

View File

@@ -1504,8 +1504,11 @@ void PeerMenuShareContactBox(
*weak = navigation->parentController()->show(
Box<PeerListBox>(
std::make_unique<ChooseRecipientBoxController>(
&navigation->session(),
std::move(callback)),
ChooseRecipientArgs{
.session = &navigation->session(),
.callback = std::move(callback),
.premiumRequiredError = WritePremiumRequiredError,
}),
[](not_null<PeerListBox*> box) {
box->addButton(tr::lng_cancel(), [=] {
box->closeBox();
@@ -1742,10 +1745,12 @@ QPointer<Ui::BoxContent> ShowChooseRecipientBox(
}
};
*weak = navigation->parentController()->show(Box<PeerListBox>(
std::make_unique<ChooseRecipientBoxController>(
&navigation->session(),
std::move(callback),
std::move(filter)),
std::make_unique<ChooseRecipientBoxController>(ChooseRecipientArgs{
.session = &navigation->session(),
.callback = std::move(callback),
.filter = std::move(filter),
.premiumRequiredError = WritePremiumRequiredError,
}),
std::move(initBox)));
return weak->data();
}
@@ -1799,15 +1804,18 @@ QPointer<Ui::BoxContent> ShowForwardMessagesBox(
using Chosen = not_null<Data::Thread*>;
Controller(not_null<Main::Session*> session)
: ChooseRecipientBoxController(
session,
[=](Chosen thread) mutable { _singleChosen.fire_copy(thread); },
nullptr) {
: ChooseRecipientBoxController({
.session = session,
.callback = [=](Chosen thread) {
_singleChosen.fire_copy(thread);
},
.premiumRequiredError = WritePremiumRequiredError,
}) {
}
void rowClicked(not_null<PeerListRow*> row) override final {
const auto count = delegate()->peerListSelectedRowsCount();
if (count && row->peer()->isForum()) {
if (showLockedError(row) || (count && row->peer()->isForum())) {
return;
} else if (!count || row->peer()->isForum()) {
ChooseRecipientBoxController::rowClicked(row);
@@ -2126,10 +2134,12 @@ QPointer<Ui::BoxContent> ShowShareGameBox(
});
};
*weak = navigation->parentController()->show(Box<PeerListBox>(
std::make_unique<ChooseRecipientBoxController>(
&navigation->session(),
std::move(chosen),
std::move(filter)),
std::make_unique<ChooseRecipientBoxController>(ChooseRecipientArgs{
.session = &navigation->session(),
.callback = std::move(chosen),
.filter = std::move(filter),
.premiumRequiredError = WritePremiumRequiredError,
}),
std::move(initBox)));
return weak->data();
}