Refactor PeerInfoUI and related modules

This commit is contained in:
Peter
2019-08-15 14:12:19 +03:00
parent ad79e4143e
commit b6316ab12c
141 changed files with 6957 additions and 489 deletions

View File

@@ -64,7 +64,7 @@ private func fixListNodeScrolling(_ listNode: ListView, searchNode: NavigationBa
return false
}
public class ChatListController: TelegramBaseController, UIViewControllerPreviewingDelegate {
public class ChatListControllerImpl: TelegramBaseController, ChatListController, UIViewControllerPreviewingDelegate {
private var validLayout: ContainerViewLayout?
public let context: AccountContext
@@ -711,7 +711,7 @@ public class ChatListController: TelegramBaseController, UIViewControllerPreview
self.chatListDisplayNode.chatListNode.groupSelected = { [weak self] groupId in
if let strongSelf = self {
if let navigationController = strongSelf.navigationController as? NavigationController {
let chatListController = ChatListController(context: strongSelf.context, groupId: groupId, controlsHistoryPreload: false, enableDebugActions: false)
let chatListController = ChatListControllerImpl(context: strongSelf.context, groupId: groupId, controlsHistoryPreload: false, enableDebugActions: false)
navigationController.pushViewController(chatListController)
strongSelf.chatListDisplayNode.chatListNode.clearHighlightAnimated(true)
}
@@ -1183,7 +1183,11 @@ public class ChatListController: TelegramBaseController, UIViewControllerPreview
}
}
@objc public func composePressed() {
public func activateCompose() {
self.composePressed()
}
@objc private func composePressed() {
(self.navigationController as? NavigationController)?.replaceAllButRootController(self.context.sharedContext.makeComposeController(context: self.context), animated: true)
}
@@ -1260,7 +1264,7 @@ public class ChatListController: TelegramBaseController, UIViewControllerPreview
return nil
}
case let .groupReference(groupId, _, _, _, _):
let chatListController = ChatListController(context: self.context, groupId: groupId, controlsHistoryPreload: false, enableDebugActions: false)
let chatListController = ChatListControllerImpl(context: self.context, groupId: groupId, controlsHistoryPreload: false, enableDebugActions: false)
chatListController.containerLayoutUpdated(ContainerViewLayout(size: contentSize, metrics: LayoutMetrics(), intrinsicInsets: UIEdgeInsets(), safeInsets: UIEdgeInsets(), statusBarHeight: nil, inputHeight: nil, standardInputHeight: 216.0, inputHeightIsInteractivellyChanging: false, inVoiceOver: false), transition: .immediate)
return (chatListController, sourceRect)
}

View File

@@ -21,7 +21,7 @@ private final class ChatListControllerNodeView: UITracingLayerView, PreviewingHo
})
}
weak var controller: ChatListController?
weak var controller: ChatListControllerImpl?
}
private struct TestItem: Comparable, Identifiable {
@@ -49,7 +49,7 @@ final class ChatListControllerNode: ASDisplayNode {
private var chatListEmptyIndicator: ActivityIndicator?
let chatListNode: ChatListNode
var navigationBar: NavigationBar?
weak var controller: ChatListController?
weak var controller: ChatListControllerImpl?
var toolbar: Toolbar?
private var toolbarNode: ToolbarNode?
@@ -69,7 +69,7 @@ final class ChatListControllerNode: ASDisplayNode {
let debugListView = ListView()
init(context: AccountContext, groupId: PeerGroupId, controlsHistoryPreload: Bool, presentationData: PresentationData, controller: ChatListController) {
init(context: AccountContext, groupId: PeerGroupId, controlsHistoryPreload: Bool, presentationData: PresentationData, controller: ChatListControllerImpl) {
self.context = context
self.groupId = groupId
self.presentationData = presentationData