mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Provided window controller to box of converting channel to gigagroup.
This commit is contained in:
@@ -314,7 +314,11 @@ ChatAdminRights AdminRightsForOwnershipTransfer(bool isGroup) {
|
||||
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 convertSure = [=] {
|
||||
if (*converting) {
|
||||
@@ -332,10 +336,11 @@ Fn<void()> AboutGigagroupCallback(not_null<ChannelData*> channel) {
|
||||
}).send();
|
||||
};
|
||||
const auto convertWarn = [=] {
|
||||
if (*converting) {
|
||||
const auto strongController = weak.get();
|
||||
if (*converting || !strongController) {
|
||||
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->addRow(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
@@ -348,10 +353,11 @@ Fn<void()> AboutGigagroupCallback(not_null<ChannelData*> channel) {
|
||||
}), Ui::LayerOption::KeepOther);
|
||||
};
|
||||
return [=] {
|
||||
if (*converting) {
|
||||
const auto strongController = weak.get();
|
||||
if (*converting || !strongController) {
|
||||
return;
|
||||
}
|
||||
Ui::show(Box([=](not_null<Ui::GenericBox*> box) {
|
||||
strongController->show(Box([=](not_null<Ui::GenericBox*> box) {
|
||||
box->setTitle(tr::lng_gigagroup_convert_title());
|
||||
const auto addFeature = [&](rpl::producer<QString> text) {
|
||||
using namespace rpl::mappers;
|
||||
@@ -607,7 +613,9 @@ void EditPeerPermissionsBox::addSuggestGigagroup(
|
||||
container,
|
||||
tr::lng_rights_gigagroup_convert(),
|
||||
rpl::single(QString()),
|
||||
AboutGigagroupCallback(_peer->asChannel()),
|
||||
AboutGigagroupCallback(
|
||||
_peer->asChannel(),
|
||||
_navigation->parentController()),
|
||||
st::peerPermissionsButton));
|
||||
|
||||
container->add(
|
||||
|
||||
Reference in New Issue
Block a user