mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Allow messages when accepting miniapp terms.
This commit is contained in:
parent
3da44eb5dd
commit
7d5d086ade
1 changed files with 32 additions and 35 deletions
|
@ -1537,8 +1537,10 @@ void AttachWebView::confirmAddToMenu(
|
|||
}
|
||||
_confirmAddBox = active->show(Box([=](not_null<Ui::GenericBox*> box) {
|
||||
const auto allowed = std::make_shared<Ui::Checkbox*>();
|
||||
const auto disclaimer = !disclaimerAccepted(bot);
|
||||
const auto done = [=](Fn<void()> close) {
|
||||
const auto state = ((*allowed) && (*allowed)->checked())
|
||||
const auto state = (disclaimer
|
||||
|| (*allowed) && (*allowed)->checked())
|
||||
? ToggledState::AllowedToWrite
|
||||
: ToggledState::Added;
|
||||
toggleInMenu(bot.user, state, [=] {
|
||||
|
@ -1551,13 +1553,22 @@ void AttachWebView::confirmAddToMenu(
|
|||
});
|
||||
close();
|
||||
};
|
||||
const auto disclaimer = !disclaimerAccepted(bot);
|
||||
if (disclaimer) {
|
||||
FillDisclaimerBox(box, [=] {
|
||||
_disclaimerAccepted.emplace(bot.user);
|
||||
_attachBotsUpdates.fire({});
|
||||
done([] {});
|
||||
});
|
||||
box->addRow(object_ptr<Ui::FixedHeightWidget>(
|
||||
box,
|
||||
st::boxRowPadding.left()));
|
||||
box->addRow(object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
tr::lng_bot_will_be_added(
|
||||
lt_bot,
|
||||
rpl::single(Ui::Text::Bold(bot.name)),
|
||||
Ui::Text::WithEntities),
|
||||
st::boxLabel));
|
||||
} else {
|
||||
Ui::ConfirmBox(box, {
|
||||
(bot.inMainMenu
|
||||
|
@ -1569,40 +1580,26 @@ void AttachWebView::confirmAddToMenu(
|
|||
Ui::Text::WithEntities),
|
||||
done,
|
||||
});
|
||||
}
|
||||
if (bot.requestWriteAccess) {
|
||||
(*allowed) = box->addRow(
|
||||
object_ptr<Ui::Checkbox>(
|
||||
box,
|
||||
tr::lng_url_auth_allow_messages(
|
||||
tr::now,
|
||||
lt_bot,
|
||||
Ui::Text::Bold(bot.name),
|
||||
Ui::Text::WithEntities),
|
||||
true,
|
||||
st::urlAuthCheckbox),
|
||||
style::margins(
|
||||
st::boxRowPadding.left(),
|
||||
(disclaimer
|
||||
? st::boxPhotoCaptionSkip
|
||||
: st::boxRowPadding.left()),
|
||||
st::boxRowPadding.right(),
|
||||
st::boxRowPadding.left()));
|
||||
(*allowed)->setAllowTextLines();
|
||||
}
|
||||
if (disclaimer) {
|
||||
if (!bot.requestWriteAccess) {
|
||||
box->addRow(object_ptr<Ui::FixedHeightWidget>(
|
||||
box,
|
||||
st::boxRowPadding.left()));
|
||||
if (bot.requestWriteAccess) {
|
||||
(*allowed) = box->addRow(
|
||||
object_ptr<Ui::Checkbox>(
|
||||
box,
|
||||
tr::lng_url_auth_allow_messages(
|
||||
tr::now,
|
||||
lt_bot,
|
||||
Ui::Text::Bold(bot.name),
|
||||
Ui::Text::WithEntities),
|
||||
true,
|
||||
st::urlAuthCheckbox),
|
||||
style::margins(
|
||||
st::boxRowPadding.left(),
|
||||
(disclaimer
|
||||
? st::boxPhotoCaptionSkip
|
||||
: st::boxRowPadding.left()),
|
||||
st::boxRowPadding.right(),
|
||||
st::boxRowPadding.left()));
|
||||
(*allowed)->setAllowTextLines();
|
||||
}
|
||||
box->addRow(object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
tr::lng_bot_will_be_added(
|
||||
lt_bot,
|
||||
rpl::single(Ui::Text::Bold(bot.name)),
|
||||
Ui::Text::WithEntities),
|
||||
st::boxLabel));
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue