mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Provided window controller to box of converting channel to gigagroup.
This commit is contained in:
parent
6bcca6c94e
commit
bc6d69319c
3 changed files with 18 additions and 8 deletions
|
@ -314,7 +314,11 @@ ChatAdminRights AdminRightsForOwnershipTransfer(bool isGroup) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Fn<void()> AboutGigagroupCallback(not_null<ChannelData*> channel) {
|
Fn<void()> AboutGigagroupCallback(
|
||||||
|
not_null<ChannelData*> channel,
|
||||||
|
not_null<Window::SessionController*> controller) {
|
||||||
|
const auto weak = base::make_weak(controller.get());
|
||||||
|
|
||||||
const auto converting = std::make_shared<bool>();
|
const auto converting = std::make_shared<bool>();
|
||||||
const auto convertSure = [=] {
|
const auto convertSure = [=] {
|
||||||
if (*converting) {
|
if (*converting) {
|
||||||
|
@ -332,10 +336,11 @@ Fn<void()> AboutGigagroupCallback(not_null<ChannelData*> channel) {
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
const auto convertWarn = [=] {
|
const auto convertWarn = [=] {
|
||||||
if (*converting) {
|
const auto strongController = weak.get();
|
||||||
|
if (*converting || !strongController) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Ui::show(Box([=](not_null<Ui::GenericBox*> box) {
|
strongController->show(Box([=](not_null<Ui::GenericBox*> box) {
|
||||||
box->setTitle(tr::lng_gigagroup_warning_title());
|
box->setTitle(tr::lng_gigagroup_warning_title());
|
||||||
box->addRow(
|
box->addRow(
|
||||||
object_ptr<Ui::FlatLabel>(
|
object_ptr<Ui::FlatLabel>(
|
||||||
|
@ -348,10 +353,11 @@ Fn<void()> AboutGigagroupCallback(not_null<ChannelData*> channel) {
|
||||||
}), Ui::LayerOption::KeepOther);
|
}), Ui::LayerOption::KeepOther);
|
||||||
};
|
};
|
||||||
return [=] {
|
return [=] {
|
||||||
if (*converting) {
|
const auto strongController = weak.get();
|
||||||
|
if (*converting || !strongController) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Ui::show(Box([=](not_null<Ui::GenericBox*> box) {
|
strongController->show(Box([=](not_null<Ui::GenericBox*> box) {
|
||||||
box->setTitle(tr::lng_gigagroup_convert_title());
|
box->setTitle(tr::lng_gigagroup_convert_title());
|
||||||
const auto addFeature = [&](rpl::producer<QString> text) {
|
const auto addFeature = [&](rpl::producer<QString> text) {
|
||||||
using namespace rpl::mappers;
|
using namespace rpl::mappers;
|
||||||
|
@ -607,7 +613,9 @@ void EditPeerPermissionsBox::addSuggestGigagroup(
|
||||||
container,
|
container,
|
||||||
tr::lng_rights_gigagroup_convert(),
|
tr::lng_rights_gigagroup_convert(),
|
||||||
rpl::single(QString()),
|
rpl::single(QString()),
|
||||||
AboutGigagroupCallback(_peer->asChannel()),
|
AboutGigagroupCallback(
|
||||||
|
_peer->asChannel(),
|
||||||
|
_navigation->parentController()),
|
||||||
st::peerPermissionsButton));
|
st::peerPermissionsButton));
|
||||||
|
|
||||||
container->add(
|
container->add(
|
||||||
|
|
|
@ -16,6 +16,7 @@ class VerticalLayout;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
namespace Window {
|
namespace Window {
|
||||||
|
class SessionController;
|
||||||
class SessionNavigation;
|
class SessionNavigation;
|
||||||
} // namespace Window
|
} // namespace Window
|
||||||
|
|
||||||
|
@ -50,7 +51,8 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
[[nodiscard]] Fn<void()> AboutGigagroupCallback(
|
[[nodiscard]] Fn<void()> AboutGigagroupCallback(
|
||||||
not_null<ChannelData*> channel);
|
not_null<ChannelData*> channel,
|
||||||
|
not_null<Window::SessionController*> controller);
|
||||||
|
|
||||||
template <typename Flags>
|
template <typename Flags>
|
||||||
struct EditFlagsControl {
|
struct EditFlagsControl {
|
||||||
|
|
|
@ -3935,7 +3935,7 @@ void HistoryWidget::checkSuggestToGigagroup() {
|
||||||
st::infoAboutGigagroup));
|
st::infoAboutGigagroup));
|
||||||
box->addButton(
|
box->addButton(
|
||||||
tr::lng_gigagroup_suggest_more(),
|
tr::lng_gigagroup_suggest_more(),
|
||||||
AboutGigagroupCallback(group));
|
AboutGigagroupCallback(group, controller()));
|
||||||
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue