diff --git a/submodules/TelegramUI/TelegramUI/InviteContactsController.swift b/submodules/TelegramUI/TelegramUI/InviteContactsController.swift index b75b86f8f8..ad400e0859 100644 --- a/submodules/TelegramUI/TelegramUI/InviteContactsController.swift +++ b/submodules/TelegramUI/TelegramUI/InviteContactsController.swift @@ -39,7 +39,6 @@ public class InviteContactsController: ViewController, MFMessageComposeViewContr self.title = self.presentationData.strings.Contacts_InviteFriends self.navigationItem.backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Back, style: .plain, target: nil, action: nil) - self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: presentationData.strings.Contacts_SelectAll, style: .plain, target: self, action: #selector(self.selectAllPressed)) self.scrollToTop = { [weak self] in if let strongSelf = self { @@ -67,6 +66,7 @@ public class InviteContactsController: ViewController, MFMessageComposeViewContr self.searchContentNode = NavigationBarSearchContentNode(theme: self.presentationData.theme, placeholder: self.presentationData.strings.Common_Search, activate: { [weak self] in self?.activateSearch() }) + self.searchContentNode?.setIsEnabled(false) self.navigationBar?.setContentNode(self.searchContentNode, animated: false) } @@ -84,6 +84,7 @@ public class InviteContactsController: ViewController, MFMessageComposeViewContr self.searchContentNode?.updateThemeAndPlaceholder(theme: self.presentationData.theme, placeholder: self.presentationData.strings.Common_Search) self.title = self.presentationData.strings.Contacts_InviteFriends self.navigationItem.backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Back, style: .plain, target: nil, action: nil) + self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: presentationData.strings.Contacts_SelectAll, style: .plain, target: self, action: #selector(self.selectAllPressed)) } override public func loadDisplayNode() { @@ -92,6 +93,14 @@ public class InviteContactsController: ViewController, MFMessageComposeViewContr self.contactsNode.navigationBar = self.navigationBar + self.contactsNode.loadedContacts = { [weak self] in + if let strongSelf = self { + self?.searchContentNode?.setIsEnabled(true) + + strongSelf.navigationItem.rightBarButtonItem = UIBarButtonItem(title: strongSelf.presentationData.strings.Contacts_SelectAll, style: .plain, target: self, action: #selector(strongSelf.selectAllPressed)) + } + } + self.contactsNode.requestDeactivateSearch = { [weak self] in self?.deactivateSearch() } diff --git a/submodules/TelegramUI/TelegramUI/InviteContactsControllerNode.swift b/submodules/TelegramUI/TelegramUI/InviteContactsControllerNode.swift index 0ee253c743..d674b85775 100644 --- a/submodules/TelegramUI/TelegramUI/InviteContactsControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/InviteContactsControllerNode.swift @@ -265,6 +265,8 @@ final class InviteContactsControllerNode: ASDisplayNode { return self._ready.get() } + var loadedContacts: (() -> Void)? + private var disposable: Disposable? private let currentContactIds = Atomic<[String]>(value: []) @@ -578,7 +580,10 @@ final class InviteContactsControllerNode: ASDisplayNode { activityIndicator.removeFromSupernode() } - let _ = strongSelf.currentSortedContacts.swap(transition.sortedContacts) + let previous = strongSelf.currentSortedContacts.swap(transition.sortedContacts) + if previous == nil && transition.sortedContacts != nil { + strongSelf.loadedContacts?() + } } }) }