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

Separate form controller from view controller.

This commit is contained in:
John Preston
2018-03-29 23:49:31 +04:00
parent b0a9d26a94
commit a2dabfde56
19 changed files with 668 additions and 302 deletions

View File

@@ -507,7 +507,7 @@ void AddParticipantsBoxController::Start(
base::flat_set<not_null<UserData*>> &&alreadyIn,
bool justCreated) {
auto initBox = [channel, justCreated](not_null<PeerListBox*> box) {
auto subscription = std::make_shared<base::Subscription>();
auto subscription = std::make_shared<rpl::lifetime>();
box->addButton(langFactory(lng_participant_invite), [box, channel, subscription] {
auto rows = box->peerListCollectSelectedRows();
if (!rows.empty()) {
@@ -528,9 +528,9 @@ void AddParticipantsBoxController::Start(
});
box->addButton(langFactory(justCreated ? lng_create_group_skip : lng_cancel), [box] { box->closeBox(); });
if (justCreated) {
*subscription = box->boxClosing.add_subscription([channel] {
box->boxClosing() | rpl::start_with_next([=] {
Ui::showPeerHistory(channel, ShowAtTheEndMsgId);
});
}, *subscription);
}
};
Ui::show(Box<PeerListBox>(std::make_unique<AddParticipantsBoxController>(channel, std::move(alreadyIn)), std::move(initBox)));