@@ -33,14 +33,14 @@ class MessagesCoordinator: BaseCoordinator {
34 let newVC = self.storyboard.instantiateViewController(withIdentifier: peopleToWriteVC) as! PeopleToWriteViewController
34 let newVC = self.storyboard.instantiateViewController(withIdentifier: peopleToWriteVC) as! PeopleToWriteViewController
36− newVC.whatToDoWithSelection = { [weak newVC, weak self] in
36+ newVC.whatToDoWithSelection = { [weak newVC, weak self] people in
37 newVC?.navigationController?.popViewController(animated: true)
37 newVC?.navigationController?.popViewController(animated: true)
39 // detect is it a user or group dialog
39 // detect is it a user or group dialog
40− let count = $0.count
40+ let count = people.count
41 if count == 1 {
41 if count == 1 {
43− let user = $0.first!.key
43+ let user = people.first!.key
44 let createdDialog = Model.Dialog.userChat(Model.UserChat(user: user))
44 let createdDialog = Model.Dialog.userChat(Model.UserChat(user: user))
46 let vc = DialogViewController()
46 let vc = DialogViewController()
@@ -49,11 +49,14 @@ class MessagesCoordinator: BaseCoordinator {
49 self?.navigationController?.pushViewController(vc, animated: true)
49 self?.navigationController?.pushViewController(vc, animated: true)
52− var group = Model.Group(users: $0, name: "Untitled", id: 0)
52+ var group = Model.Group(users: people, name: "Untitled", id: 0)
53+ group.users[DataStorage.standard.getUserId()] = Model.UserPermission(isAdmin: true)
53 Model.createGroupChat(from: group, completion: { [weak self] id in
55 Model.createGroupChat(from: group, completion: { [weak self] id in
55 let newVC1 = DialogViewController()
57 let newVC1 = DialogViewController()
56 group.id = id
58 group.id = id
59+ newVC1.users = Model.Channels.fullPeopleDict
57 newVC1.dialog = Model.Dialog.groupChat(Model.GroupChat(group: group))
60 newVC1.dialog = Model.Dialog.groupChat(Model.GroupChat(group: group))
58 self?.navigationController?.pushViewController(newVC1, animated: true)
61 self?.navigationController?.pushViewController(newVC1, animated: true)